From 8e173798594286ae39f462c353b9dd7388c56434 Mon Sep 17 00:00:00 2001 From: Gui-FernandesBR Date: Fri, 13 Oct 2023 17:14:57 -0300 Subject: [PATCH] BUG: cannot print max_acceleration_power_on_time - This happens when we use EmptyMotors - ValueError: attempt to get argmax of an empty sequence --- rocketpy/simulation/flight.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rocketpy/simulation/flight.py b/rocketpy/simulation/flight.py index 1a5533643..ca3c7195f 100644 --- a/rocketpy/simulation/flight.py +++ b/rocketpy/simulation/flight.py @@ -2137,6 +2137,9 @@ def max_acceleration_power_on_time(self): burn_out_time_index = find_closest( self.acceleration.source[:, 0], self.rocket.motor.burn_out_time ) + if burn_out_time_index == 0: + return 0 # the burn out time is before the first time step + max_acceleration_time_index = np.argmax( self.acceleration[:burn_out_time_index, 1] )