From 128a9eb53b1d3ed70db66987abf8396a99100a60 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sun, 18 Aug 2024 09:57:02 -0300 Subject: [PATCH 1/3] BUG: fix the Frequency Response plot of Flight class --- rocketpy/plots/flight_plots.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/rocketpy/plots/flight_plots.py b/rocketpy/plots/flight_plots.py index 74caaeb33..b0e97d6ca 100644 --- a/rocketpy/plots/flight_plots.py +++ b/rocketpy/plots/flight_plots.py @@ -731,32 +731,33 @@ def stability_and_control_data(self): # pylint: disable=too-many-statements ax1.grid() ax2 = plt.subplot(212) - max_attitude = max(self.flight.attitude_frequency_response[:, 1]) + x_axis = np.arange(0, 5, 0.01) + max_attitude = self.flight.attitude_frequency_response.max max_attitude = max_attitude if max_attitude != 0 else 1 ax2.plot( - self.flight.attitude_frequency_response[:, 0], - self.flight.attitude_frequency_response[:, 1] / max_attitude, + x_axis, + self.flight.attitude_frequency_response(x_axis) / max_attitude, label="Attitude Angle", ) - max_omega1 = max(self.flight.omega1_frequency_response[:, 1]) + max_omega1 = self.flight.omega1_frequency_response.max max_omega1 = max_omega1 if max_omega1 != 0 else 1 ax2.plot( - self.flight.omega1_frequency_response[:, 0], - self.flight.omega1_frequency_response[:, 1] / max_omega1, + x_axis, + self.flight.omega1_frequency_response(x_axis) / max_omega1, label=r"$\omega_1$", ) - max_omega2 = max(self.flight.omega2_frequency_response[:, 1]) + max_omega2 = self.flight.omega2_frequency_response.max max_omega2 = max_omega2 if max_omega2 != 0 else 1 ax2.plot( - self.flight.omega2_frequency_response[:, 0], - self.flight.omega2_frequency_response[:, 1] / max_omega2, + x_axis, + self.flight.omega2_frequency_response(x_axis) / max_omega2, label=r"$\omega_2$", ) max_omega3 = max(self.flight.omega3_frequency_response[:, 1]) max_omega3 = max_omega3 if max_omega3 != 0 else 1 ax2.plot( - self.flight.omega3_frequency_response[:, 0], - self.flight.omega3_frequency_response[:, 1] / max_omega3, + x_axis, + self.flight.omega3_frequency_response(x_axis) / max_omega3, label=r"$\omega_3$", ) ax2.set_title("Frequency Response") From dfdbd1b5034207ca6966361ba69a5e0b0bd64791 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sun, 18 Aug 2024 10:00:06 -0300 Subject: [PATCH 2/3] =?UTF-8?q?DEV=C3=87=20adds=20#653=20to=20CHANGELOG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f1828872..d600e391f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ Attention: The newest changes should be on top --> ### Fixed - +- BUG: fix the Frequency Response plot of Flight class [#653](https://github.com/RocketPy-Team/RocketPy/pull/653) ## [v1.4.2] - 2024-08-03 From 7e2c6bfaaa7b743e3c08fcaf33f8c33390296260 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Sun, 18 Aug 2024 10:02:27 -0300 Subject: [PATCH 3/3] ENH: improves max_omega3 calculation --- rocketpy/plots/flight_plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocketpy/plots/flight_plots.py b/rocketpy/plots/flight_plots.py index b0e97d6ca..1e5c53449 100644 --- a/rocketpy/plots/flight_plots.py +++ b/rocketpy/plots/flight_plots.py @@ -753,7 +753,7 @@ def stability_and_control_data(self): # pylint: disable=too-many-statements self.flight.omega2_frequency_response(x_axis) / max_omega2, label=r"$\omega_2$", ) - max_omega3 = max(self.flight.omega3_frequency_response[:, 1]) + max_omega3 = self.flight.omega3_frequency_response.max max_omega3 = max_omega3 if max_omega3 != 0 else 1 ax2.plot( x_axis,