From 76b8784da0ff9ad09fe3a6307c58bac0f1a360e3 Mon Sep 17 00:00:00 2001 From: MateusStano Date: Fri, 6 Oct 2023 20:24:56 +0200 Subject: [PATCH 1/2] BUG: print length warning only when needed --- rocketpy/rocket/aero_surface.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rocketpy/rocket/aero_surface.py b/rocketpy/rocket/aero_surface.py index f285356b2..551c3531c 100644 --- a/rocketpy/rocket/aero_surface.py +++ b/rocketpy/rocket/aero_surface.py @@ -1,7 +1,6 @@ from abc import ABC, abstractmethod import warnings -import matplotlib.pyplot as plt import numpy as np from scipy.optimize import fsolve @@ -426,12 +425,13 @@ def final_shape(x): # Evaluate final geometry parameters self.shape_vec = [nosecone_x, nosecone_y] - self._length = nosecone_x[-1] - print( - "Due to the chosen bluffness ratio, the nose cone length was reduced to {:.3f} m.".format( - self.length + if abs(nosecone_x[-1] - self.length) >= 0.001: # 1 milimiter + print( + "Due to the chosen bluffness ratio, the nose cone length was reduced to m.".format( + self.length + ) ) - ) + self._length = nosecone_x[-1] self.fineness_ratio = self.length / (2 * self.base_radius) return None From 536224709fa2fd7256f0043cf9cd4c53af1f6309 Mon Sep 17 00:00:00 2001 From: MateusStano <69485049+MateusStano@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:42:53 -0300 Subject: [PATCH 2/2] BUG: change order of print and length set --- rocketpy/rocket/aero_surface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocketpy/rocket/aero_surface.py b/rocketpy/rocket/aero_surface.py index 551c3531c..354b1e59e 100644 --- a/rocketpy/rocket/aero_surface.py +++ b/rocketpy/rocket/aero_surface.py @@ -426,12 +426,12 @@ def final_shape(x): # Evaluate final geometry parameters self.shape_vec = [nosecone_x, nosecone_y] if abs(nosecone_x[-1] - self.length) >= 0.001: # 1 milimiter + self._length = nosecone_x[-1] print( "Due to the chosen bluffness ratio, the nose cone length was reduced to m.".format( self.length ) ) - self._length = nosecone_x[-1] self.fineness_ratio = self.length / (2 * self.base_radius) return None