From 017210c33147d36d4faa26428963d9316470b20b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:27:46 +0000 Subject: [PATCH 1/5] Initial plan From db6e9f6262db2aa30c3f09e859bcaaaed08a2409 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:36:52 +0000 Subject: [PATCH 2/5] ENH: Restore power_off/on_drag as Function, add _input attributes for raw user input Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> --- rocketpy/rocket/point_mass_rocket.py | 13 +++++++++++++ rocketpy/rocket/rocket.py | 23 ++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/rocketpy/rocket/point_mass_rocket.py b/rocketpy/rocket/point_mass_rocket.py index eaddaadec..d55477b53 100644 --- a/rocketpy/rocket/point_mass_rocket.py +++ b/rocketpy/rocket/point_mass_rocket.py @@ -41,6 +41,18 @@ class PointMassRocket(Rocket): center_of_mass_without_motor : float Position, in meters, of the rocket's center of mass without motor relative to the rocket's coordinate system. + power_off_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is off. Alias for ``power_off_drag_by_mach``. + power_on_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is on. Alias for ``power_on_drag_by_mach``. + power_off_drag_input : int, float, callable, array, string, Function + Original user input for the drag coefficient with motor off. + Preserved for reconstruction and Monte Carlo workflows. + power_on_drag_input : int, float, callable, array, string, Function + Original user input for the drag coefficient with motor on. + Preserved for reconstruction and Monte Carlo workflows. power_off_drag_7d : Function Drag coefficient function with seven inputs in the order: alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate. @@ -53,6 +65,7 @@ class PointMassRocket(Rocket): Convenience wrapper for power-on drag as a Mach-only function. """ + def __init__( self, radius: float, diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index 86fa981a9..67548f6dd 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -147,12 +147,18 @@ class Rocket: Rocket.static_margin : float Float value corresponding to rocket static margin when loaded with propellant in units of rocket diameter or calibers. - Rocket.power_off_drag : int, float, callable, string, array, Function + Rocket.power_off_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is off. Alias for ``power_off_drag_by_mach``. + Rocket.power_on_drag : Function + Rocket's drag coefficient as a function of Mach number when the + motor is on. Alias for ``power_on_drag_by_mach``. + Rocket.power_off_drag_input : int, float, callable, string, array, Function Original user input for rocket's drag coefficient when the motor is - off. This is preserved for reconstruction and Monte Carlo workflows. - Rocket.power_on_drag : int, float, callable, string, array, Function + off. Preserved for reconstruction and Monte Carlo workflows. + Rocket.power_on_drag_input : int, float, callable, string, array, Function Original user input for rocket's drag coefficient when the motor is - on. This is preserved for reconstruction and Monte Carlo workflows. + on. Preserved for reconstruction and Monte Carlo workflows. Rocket.power_off_drag_7d : Function Rocket's drag coefficient with motor off as a 7D function of (alpha, beta, mach, reynolds, pitch_rate, yaw_rate, roll_rate). @@ -375,9 +381,12 @@ def __init__( # pylint: disable=too-many-statements interpolation="linear", extrapolation="constant", ) - # Saving user input for monte carlo - self.power_off_drag = power_off_drag - self.power_on_drag = power_on_drag + # Saving raw user input for reconstruction and Monte Carlo + self.power_off_drag_input = power_off_drag + self.power_on_drag_input = power_on_drag + # Public API attributes: keep as Function (Mach-only) for backward compatibility + self.power_off_drag = self.power_off_drag_by_mach + self.power_on_drag = self.power_on_drag_by_mach # Create a, possibly, temporary empty motor # self.motors = Components() # currently unused, only 1 motor is supported From e750b182260e7c095041215d717c98f0b8598dc8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 01:56:33 +0000 Subject: [PATCH 3/5] DOC: Add PR #941 compatibility fix to changelog Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e62f91e2c..68cacbf9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ Attention: The newest changes should be on top --> ### Fixed -- +- BUG: Restore `Rocket.power_off_drag` and `Rocket.power_on_drag` as `Function` objects while preserving raw inputs in `power_off_drag_input` and `power_on_drag_input` [#941](https://github.com/RocketPy-Team/RocketPy/pull/941) ## [v1.12.0] - 2026-03-08 From 7766f8853c652ec53475efec6127581f110508ce Mon Sep 17 00:00:00 2001 From: Mateus Stano Junqueira <69485049+MateusStano@users.noreply.github.com> Date: Wed, 18 Mar 2026 22:35:19 -0300 Subject: [PATCH 4/5] Update rocketpy/rocket/rocket.py Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> --- rocketpy/rocket/rocket.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index 67548f6dd..6a934ecf4 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -382,8 +382,8 @@ def __init__( # pylint: disable=too-many-statements extrapolation="constant", ) # Saving raw user input for reconstruction and Monte Carlo - self.power_off_drag_input = power_off_drag - self.power_on_drag_input = power_on_drag + self._power_off_drag_input = power_off_drag + self._power_on_drag_input = power_on_drag # Public API attributes: keep as Function (Mach-only) for backward compatibility self.power_off_drag = self.power_off_drag_by_mach self.power_on_drag = self.power_on_drag_by_mach From a640c04096e4c8623ea0052e6c98b903b92ebe2d Mon Sep 17 00:00:00 2001 From: MateusStano Date: Thu, 19 Mar 2026 21:54:20 -0300 Subject: [PATCH 5/5] MNT: ruff pylint --- rocketpy/rocket/point_mass_rocket.py | 1 - 1 file changed, 1 deletion(-) diff --git a/rocketpy/rocket/point_mass_rocket.py b/rocketpy/rocket/point_mass_rocket.py index d55477b53..d94363d2b 100644 --- a/rocketpy/rocket/point_mass_rocket.py +++ b/rocketpy/rocket/point_mass_rocket.py @@ -65,7 +65,6 @@ class PointMassRocket(Rocket): Convenience wrapper for power-on drag as a Mach-only function. """ - def __init__( self, radius: float,