Skip to content

Conversation

@Gui-FernandesBR
Copy link
Member

No description provided.

@Gui-FernandesBR Gui-FernandesBR requested a review from Copilot June 17, 2025 01:59
@Gui-FernandesBR Gui-FernandesBR self-assigned this Jun 17, 2025
@Gui-FernandesBR Gui-FernandesBR requested a review from a team as a code owner June 17, 2025 01:59
@Gui-FernandesBR Gui-FernandesBR linked an issue Jun 17, 2025 that may be closed by this pull request
5 tasks
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the motor-printing classes to share common behavior via a new _MotorPrints base class, cleans up duplicate imports, and adjusts import formatting in an integration test.

  • Introduces _MotorPrints base and updates Solid, Liquid, and Hybrid motor print classes to inherit from it, removing redundant motor_details methods.
  • Removes a duplicate Enum import and reorders imports in mathutils/function.py.
  • Adds a blank line in the integration test to separate imports.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/integration/test_environment_analysis.py Added a blank line before from rocketpy import to separate groups
rocketpy/prints/solid_motor_prints.py Extended _SolidMotorPrints from _MotorPrints and removed dup code
rocketpy/prints/liquid_motor_prints.py Extended _LiquidMotorPrints from _MotorPrints and removed dup code
rocketpy/prints/hybrid_motor_prints.py Extended _HybridMotorPrints from _MotorPrints and removed dup code
rocketpy/mathutils/function.py Moved and deduplicated Enum import to the top of the stdlib block
Comments suppressed due to low confidence (1)

tests/integration/test_environment_analysis.py:5

  • [nitpick] Consider importing the pyplot submodule explicitly with import matplotlib.pyplot as plt for clarity and common practice.
import matplotlib as plt

@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.03%. Comparing base (4df0b38) to head (10d5a10).
Report is 23 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #828      +/-   ##
===========================================
+ Coverage    79.11%   80.03%   +0.91%     
===========================================
  Files           96       98       +2     
  Lines        11575    12019     +444     
===========================================
+ Hits          9158     9619     +461     
+ Misses        2417     2400      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Gui-FernandesBR Gui-FernandesBR merged commit 71ed18c into develop Jun 19, 2025
7 checks passed
@Gui-FernandesBR Gui-FernandesBR deleted the enh/issue-460 branch June 19, 2025 23:56
@github-project-automation github-project-automation bot moved this from Backlog to Closed in LibDev Roadmap Jun 19, 2025
aZira371 pushed a commit to aZira371/RocketPy that referenced this pull request Sep 9, 2025
…m#828)

* ENH: refactor motor prints classes to inherit from _MotorPrints

* STY: make format

* ENH: add entry for _MotorPrints inheritance in changelog
Gui-FernandesBR added a commit that referenced this pull request Nov 27, 2025
* DRAFT: for ENH/3-dof-simulation (See  #655)

ENH: adds 3 DOF simulation capability to rocketpy.Flight.

*ENH: added "u_dot_3dof" for "solid_propulsion"
mode

*ENH: adding "u_dot_generalized_3dof" for "standard"
mode (still incomplete)

*ENH: new parameter "simulation_mode" for swtiching
between 3 dof and 6 dof

*ENH: updated conditions for "__init_equations_of_motion"

*ENH: 2 new example files have been created to test 3 dof model
"test_bella_lui_flight_sim" and "test_camoes_flight_sim"

* ENH/3-dof-simulation (See  RocketPy-Team#655)
ENH: adds 3 DOF simulation capability to rocketpy.Flight.

*ENH: added "u_dot_3dof" for "solid_propulsion"
mode

*ENH: added "u_dot_generalized_3dof" for "standard"
mode

*ENH: new parameter "simulation_mode" for swtiching
between 3 dof and 6 dof

*ENH: updated conditions for "__init_equations_of_motion"

* MNT: cleaned up new functions and
ENH: fixed standard 3 dof

*MNT: Cleaned up the "u_dot_3dof" and "u_dot_generalized_3_dof"

*MNT: Corrected Typos in "simulation_mode"
description

*ENH: "u_dot_generalized_3_dof" fixed and tested
on examples.

* ENH: Addition of point mass classes to rocketpy.rocket and rocketpy.motor

ENH: added "BaseRocket" and "PointMassRocket" to rocket class

ENH: added "PointMassMotor" to motor class with various input cases of thrust values

* ENH: PointMassMotor and PointMassRocket working as intended after some tests

ENH: Added a new jupyter notebook for a simplified 3 DOF example

MNT: PointMassMotor intialization error fixed

MNT: PointMassRocket properties enhanced based on the example runs

* MNT: Removing unnecessary files added by mistake.

* MNT: Cleaned up PointMassMotor and PointMassRocket class

MNT: Cleaned up the flight class u_dot_generalized_3dof

TODO: Add info for 3 dof cases and fix some new issues when parachute is added.

* MNT: Cleaning up flight class and PointMassMotor class

* MNT: point mass motor cleanup

-MNT: removing the parameters not needed for point mass kind of motors

-MNT: removing extra parameter thrust_curve

-MNT: fixing problems with motor class inheritance

* ENH: restructuring rocket class

-ENH: removed 'BaseRocket' class now 'PointMassRocket' inherits directly from 'Rocket' class

* MNT: fixing certain calculations on point mass motor

-MNT: fixed calculations of mass flow rate and exhaust velocity
-MNT: adjusted propellant initial mass setter error by allocating the input initial mass to the property

* Rename PointMassMotor.py to pointmassmotor.py

MNT: renaming pointmassmotor.py

-MNT:snake case renaming

* MNT: updates to 3dof example

-MNT: incorporating latest structural changes made to PointMassMotor and PointMassRocket

* MNT: lint cleanup and adding 3dof to init

-MNT: cleaned up PointMassRocket rocket.py for linters.
-ENH: including PointMassMotor in motors and rocketpy __init__.py
-MNT: adopting to structural changes in 3dof on the 3_DOF_TRIAL.ipynb
-MNT: including pointmassmotor in settings.json as a spell word

* MNT: Point mass motor and rocket fixes

- MNT: pointmassmotor fixing the various properties.
- MNT: fixing super init and init inheritance by changing order in pointmassrocket
- MNT: pointmassrocket property setter and default value fixes

* MNT: flight class fix on simulation mode detection

- MNT: implemented identification of simulation mode based on check if point mass objects are used

* MNT: make format changes

- MNT: used make format to correct formatting mistakes on all the new classes.

* MNT: point mass motor cleanup

-MNT: removing the parameters not needed for point mass kind of motors

-MNT: removing extra parameter thrust_curve

-MNT: fixing problems with motor class inheritance

* ENH: restructuring rocket class

-ENH: removed 'BaseRocket' class now 'PointMassRocket' inherits directly from 'Rocket' class

* MNT: fixing certain calculations on point mass motor

-MNT: fixed calculations of mass flow rate and exhaust velocity
-MNT: adjusted propellant initial mass setter error by allocating the input initial mass to the property

* Rename PointMassMotor.py to pointmassmotor.py

MNT: renaming pointmassmotor.py

-MNT:snake case renaming

* ENH: _MotorPrints inheritance - issue #460 (#828)

* ENH: refactor motor prints classes to inherit from _MotorPrints

* STY: make format

* ENH: add entry for _MotorPrints inheritance in changelog

* MNT: fix deprecations and warnings (#829)

* MNT: update code and remove deprecated functions

* MNT: simplify geodesic_to_utm import and usage in Environment class

* MNT: update CHANGELOG to fix deprecations and warnings

* make lint

* MNT: remove unused post_processed attribute from Flight class

* MNT: update matplotlib version to 3.8.3 in requirements.txt

* MNT: update matplotlib version to 3.10.0 in requirements.txt

* MNT: downgrade matplotlib version to 3.9.0 in requirements.txt

* MNT: change boxplot orientation to horizontal for compatibility with future Python versions

* MNT: change boxplot orientation from horizontal to vertical for consistency

* DEV: streamline caching of Python dependencies in GitHub Actions

* ENH: Add the Coriolis Force to the Flight class (#799)

* wind factor bug corrected

the wind factor wasn't applied to the env.wind_velocity properties

* BUG: StochasticModel visualize attributes of a uniform distribution

It showed the nominal and the standard deviation values and it doesn't make sense in a uniform distribution. In a np.random.uniform the 'nominal value' is the lower bound of the distribution, and the 'standard deviation' value is the upper bound. Now, a new condition has been added for the uniform distributions where the mean and semi range are calculated and showed. This way the visualize_attribute function will show the whole range where the random values are uniformly taken in

* variable names corrections

* Corrections requested by the pylint test

* ENH: add multiplication for 2D functions in rocketpy.function

Added the ability to multiply functions with 2D domains in the __mul__ function

* ENH: StochasticAirBrakes class created

The StochasticAirBrakes class has been created. The __init__.py files in the stochastic and rocketpy folders have also been modified accordingly to incorporate this new class

* ENH: set_air_brakes function created

This functions appends an airbrake and controller objects previuosly created to the rocket

* ENH: add StochasticAirBrake to rocketpy.stochastic_rocket

Some functions has been modified and other has been created in order to include the new StochasticAirBrakes feature into the StochasticRocket class. A new function named 'add_air_brakes' has been created to append a StochasticAirBrakes and Controller objects to the StochasticRocket object. A new function '_create_air_brake' has been introduced to create a sample of an AirBrake object through a StochasticAirBrake object. Enventually, the 'create_object' function has been modified to add the sampled AirBrakes to the sampled Rocket

* BUG: StochasticAirBrake object input in _Controller

When defining the _Controller object a StochasticAirBrake was input. This is already corrected and a AirBrake object is now introduced

* ENH: add time_overshoot option to rocketpy.stochastic_flight

Since the new StochasticAirBrake class is defined, we need the 'time_overshoot' option in the Flight class to ensure that the time step defined in the simulation is the controller sampling rate. The MonteCarlo class has had to be modified as well to include this option.

* DOC: StochasticAirBrakes related documentation added

Documentation related to the StochasticAirBrakes implementation has been added in StochasticAirBrakes, StochasticRocket and Rocket classes.

* ENH: pylint recommendations done

* ENH: Reformatted files to pass Ruff linting checks

* ENH: Update rocketpy/stochastic/stochastic_rocket.py

Unnecessary comment

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* ENH: more intuitive uniform distribution display in StochasticModel

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* DOC: improve drag curve factor definition in StochasticAirBrakes

* ENH: Change assert statement to if

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* DOC: better explanation of __mul__ function

Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>

* ENH: delete set_air_brakes function for simplicity

* ENH: inertial foreces added to u_dot_generalized

* ENH: define Earth's angular velocity vector in Environment

* ENH: some corrections to the Flight class

* ENH: modifications in the Flight class

* DOC: improving Environment documentation

* DOC: more improvements in the Environment class

* ENH: format changes done

* DOC: env.earth_rotation_vector improved

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* ENH: Coriolis acceleration added to u_dot

* BUG: print left

* ENH: ruff changes

* ENH: CHANGELOG updated

* ENH: remove unecessary frame rotation

* ENH: remove rotation from solid prop udot

* ENH: add coriolis to parachute

* TST: fix tests values

* MNT: remove debug functions

* DEV: changelog

---------

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>
Co-authored-by: MateusStano <go34lap@mytum.de>
Co-authored-by: MateusStano <mateusstano@usp.br>

* MNT: deprecated decorator (#830)

* ENH: refactor motor prints classes to inherit from _MotorPrints

* STY: make format

* MNT: update code and remove deprecated functions

* ENH: add deprecation decorator and update deprecated methods

* make format

* fix warnings

* MNT: updates to 3dof example

-MNT: incorporating latest structural changes made to PointMassMotor and PointMassRocket

* MNT: lint cleanup and adding 3dof to init

-MNT: cleaned up PointMassRocket rocket.py for linters.
-ENH: including PointMassMotor in motors and rocketpy __init__.py
-MNT: adopting to structural changes in 3dof on the 3_DOF_TRIAL.ipynb
-MNT: including pointmassmotor in settings.json as a spell word

* MNT: Point mass motor and rocket fixes

- MNT: pointmassmotor fixing the various properties.
- MNT: fixing super init and init inheritance by changing order in pointmassrocket
- MNT: pointmassrocket property setter and default value fixes

* MNT: flight class fix on simulation mode detection

- MNT: implemented identification of simulation mode based on check if point mass objects are used

* MNT: make format changes

- MNT: used make format to correct formatting mistakes on all the new classes.

* MNT: rocket.py removed pointmassrocket inertia

- MNT: removed dry inertia setters from pointmassrocket

* MNT: flight.py review updates

- MNT: fixed the order of attributes shifted simulation mode after ode solver
- MNT: added flight.simulation in docstring

* MNT: flight.py sanitization

- MNT: manually updated flight.py to match the current version on develop

* MNT: make format and renaming 3 dof example

- MNT: make format changes to flight.py
- MNT: "3_DOF_TRIAL.ipynb" renamed to "3_dof_trial_sim.ipynb"

* MNT: Update flight.py to remove duplicate line

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>

* MNT: correcting indentation in flight.py

- MNT: indentation error in flight class for callback under parachute trigger

* MNT: docstring for pointmassrocket in rocket.py

- MNT: added a short doc string describing pointmassrocket class

* MNT: removing property from rocket.py poitmassrocket

- MNT: properties which are similar to attributes are not needed were removed from pointmassrocket
- MNT: removing default set values for attributes for pointmassrocket

* ENH: first version of tests for 3dof rocketpy

- ENH: added first versions of tests using python assert statements for pointmassmotor, pointmassrocket and 3dof segments of flight.

* adds docs

* Refactor PointMassRocket class into its own module for improved organization and clarity

* refactored tests

* fix test

* remove example notebook

* type hint fix

* Configure matplotlib to use non-interactive backend for tests

* fix tests

* solve comments by copilot

* small fix

* DOC: Update test docstrings to follow RocketPy NumPy style guidelines

* docs: Update test docstrings to follow RocketPy style guidelines

Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>

---------

Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com>
Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br>
Co-authored-by: Kevin Alcañiz <kevinalcaniz22@gmail.com>
Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com>
Co-authored-by: MateusStano <go34lap@mytum.de>
Co-authored-by: MateusStano <mateusstano@usp.br>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Closed

Development

Successfully merging this pull request may close these issues.

ENH: Add _MotorPrints Inheritance to Motor Prints Classes

2 participants