Skip to content

Commit ef3eee8

Browse files
authored
Merge pull request #859 from RocketPy-Team/develop
Update master with develop to release v1.11.0
2 parents 2655a4f + 857c4f4 commit ef3eee8

File tree

116 files changed

+4192
-1328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+4192
-1328
lines changed

.github/copilot-instructions.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# GitHub Copilot Instructions for RocketPy
2+
3+
This file provides instructions for GitHub Copilot when working on the RocketPy codebase.
4+
These guidelines help ensure consistency with the project's coding standards and development practices.
5+
6+
## Project Overview
7+
8+
RocketPy is a Python library for 6-DOF rocket trajectory simulation.
9+
It's designed for high-power rocketry applications with focus on accuracy, performance, and ease of use.
10+
11+
## Coding Standards
12+
13+
### Naming Conventions
14+
- **Use `snake_case` for all new code** - variables, functions, methods, and modules
15+
- **Use descriptive names** - prefer `angle_of_attack` over `a` or `alpha`
16+
- **Class names use PascalCase** - e.g., `SolidMotor`, `Environment`, `Flight`
17+
- **Constants use UPPER_SNAKE_CASE** - e.g., `DEFAULT_GRAVITY`, `EARTH_RADIUS`
18+
19+
### Code Style
20+
- Follow **PEP 8** guidelines
21+
- Line length: **88 characters** (Black's default)
22+
- Organize imports with **isort**
23+
- Our official formatter is the **ruff frmat**
24+
25+
### Documentation
26+
- **All public classes, methods, and functions must have docstrings**
27+
- Use **NumPy style docstrings**
28+
- Include **Parameters**, **Returns**, and **Examples** sections
29+
- Document **units** for physical quantities (e.g., "in meters", "in radians")
30+
31+
### Testing
32+
- Write **unit tests** for all new features using pytest
33+
- Follow **AAA pattern** (Arrange, Act, Assert)
34+
- Use descriptive test names following: `test_methodname_expectedbehaviour`
35+
- Include test docstrings explaining expected behavior
36+
- Use **parameterization** for testing multiple scenarios
37+
- Create pytest fixtures to avoid code repetition
38+
39+
## Domain-Specific Guidelines
40+
41+
### Physical Units and Conventions
42+
- **SI units by default** - meters, kilograms, seconds, radians
43+
- **Document coordinate systems** clearly (e.g., "tail_to_nose", "nozzle_to_combustion_chamber")
44+
- **Position parameters** are critical - always document reference points
45+
- Use **descriptive variable names** for physical quantities
46+
47+
### Rocket Components
48+
- **Motors**: SolidMotor, HybridMotor and LiquidMotor classes are children classes of the Motor class
49+
- **Aerodynamic Surfaces**: They have Drag curves and lift coefficients
50+
- **Parachutes**: Trigger functions, deployment conditions
51+
- **Environment**: Atmospheric models, weather data, wind profiles
52+
53+
### Mathematical Operations
54+
- Use **numpy arrays** for vectorized operations (this improves performance)
55+
- Prefer **scipy functions** for numerical integration and optimization
56+
- **Handle edge cases** in calculations (division by zero, sqrt of negative numbers)
57+
- **Validate input ranges** for physical parameters
58+
- Monte Carlo simulations: sample from `numpy.random` for random number generation and creates several iterations to assess uncertainty in simulations.
59+
60+
## File Structure and Organization
61+
62+
### Source Code Organization
63+
64+
Reminds that `rocketpy` is a Python package served as a library, and its source code is organized into several modules to facilitate maintainability and clarity. The following structure is recommended:
65+
66+
```
67+
rocketpy/
68+
├── core/ # Core simulation classes
69+
├── motors/ # Motor implementations
70+
├── environment/ # Atmospheric and environmental models
71+
├── plots/ # Plotting and visualization
72+
├── tools/ # Utility functions
73+
└── mathutils/ # Mathematical utilities
74+
```
75+
76+
Please refer to popular Python packages like `scipy`, `numpy`, and `matplotlib` for inspiration on module organization.
77+
78+
### Test Organization
79+
```
80+
tests/
81+
├── unit/ # Unit tests
82+
├── integration/ # Integration tests
83+
├── acceptance/ # Acceptance tests
84+
└── fixtures/ # Test fixtures organized by component
85+
```
86+
87+
### Documentation Structure
88+
```
89+
docs/
90+
├── user/ # User guides and tutorials
91+
├── development/ # Development documentation
92+
├── reference/ # API reference
93+
├── examples/ # Flight examples and notebooks
94+
└── technical/ # Technical documentation
95+
```
96+
97+
## Common Patterns and Practices
98+
99+
### Error Handling
100+
- Use **descriptive error messages** with context
101+
- **Validate inputs** at class initialization and method entry
102+
- Raise **appropriate exception types** (ValueError, TypeError, etc.)
103+
- Include **suggestions for fixes** in error messages
104+
105+
### Performance Considerations
106+
- Use **vectorized operations** where possible
107+
- **Cache expensive computations** when appropriate (we frequently use `cached_property`)
108+
- Keep in mind that RocketPy must be fast!
109+
110+
### Backward Compatibility
111+
- **Avoid breaking changes** in public APIs
112+
- Use **deprecation warnings** before removing features
113+
- **Document code changes** in docstrings and CHANGELOG
114+
115+
## AI Assistant Guidelines
116+
117+
### Code Generation
118+
- **Always include docstrings** for new functions and classes
119+
- **Follow existing patterns** in the codebase
120+
- **Consider edge cases** and error conditions
121+
122+
### Code Review and Suggestions
123+
- **Check for consistency** with existing code style
124+
- **Verify physical units** and coordinate systems
125+
- **Ensure proper error handling** and input validation
126+
- **Suggest performance improvements** when applicable
127+
- **Recommend additional tests** for new functionality
128+
129+
### Documentation Assistance
130+
- **Use NumPy docstring format** consistently
131+
- **Include practical examples** in docstrings
132+
- **Document physical meanings** of parameters
133+
- **Cross-reference related functions** and classes
134+
135+
## Testing Guidelines
136+
137+
### Unit Tests
138+
- **Test individual methods** in isolation
139+
- **Use fixtures** from the appropriate test fixture modules
140+
- **Mock external dependencies** when necessary
141+
- **Test both happy path and error conditions**
142+
143+
### Integration Tests
144+
- **Test interactions** between components
145+
- **Verify end-to-end workflows** (Environment → Motor → Rocket → Flight)
146+
147+
### Test Data
148+
- **Use realistic parameters** for rocket simulations
149+
- **Include edge cases** (very small/large rockets, extreme conditions)
150+
- **Test with different coordinate systems** and orientations
151+
152+
## Project-Specific Considerations
153+
154+
### User Experience
155+
- **Provide helpful error messages** with context and suggestions
156+
- **Include examples** in docstrings and documentation
157+
- **Support common use cases** with reasonable defaults
158+
159+
## Examples of Good Practices
160+
161+
### Function Definition
162+
```python
163+
def calculate_drag_force(
164+
velocity,
165+
air_density,
166+
drag_coefficient,
167+
reference_area
168+
):
169+
"""Calculate drag force using the standard drag equation.
170+
171+
Parameters
172+
----------
173+
velocity : float
174+
Velocity magnitude in m/s.
175+
air_density : float
176+
Air density in kg/m³.
177+
drag_coefficient : float
178+
Dimensionless drag coefficient.
179+
reference_area : float
180+
Reference area in m².
181+
182+
Returns
183+
-------
184+
float
185+
Drag force in N.
186+
187+
Examples
188+
--------
189+
>>> drag_force = calculate_drag_force(100, 1.225, 0.5, 0.01)
190+
>>> print(f"Drag force: {drag_force:.2f} N")
191+
"""
192+
if velocity < 0:
193+
raise ValueError("Velocity must be non-negative")
194+
if air_density <= 0:
195+
raise ValueError("Air density must be positive")
196+
if reference_area <= 0:
197+
raise ValueError("Reference area must be positive")
198+
199+
return 0.5 * air_density * velocity**2 * drag_coefficient * reference_area
200+
```
201+
202+
### Test Example
203+
```python
204+
def test_calculate_drag_force_returns_correct_value():
205+
"""Test drag force calculation with known inputs."""
206+
# Arrange
207+
velocity = 100.0 # m/s
208+
air_density = 1.225 # kg/m³
209+
drag_coefficient = 0.5
210+
reference_area = 0.01 #
211+
expected_force = 30.625 # N
212+
213+
# Act
214+
result = calculate_drag_force(velocity, air_density, drag_coefficient, reference_area)
215+
216+
# Assert
217+
assert abs(result - expected_force) < 1e-6
218+
```
219+
220+
221+
Remember: RocketPy prioritizes accuracy, performance, and usability. Always consider the physical meaning of calculations and provide clear, well-documented interfaces for users.

.github/workflows/linters.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
python-version: ["3.9"]
19+
python-version: ["3.10"]
2020
steps:
2121
- uses: actions/checkout@main
2222
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/publish-to-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Python
2020
uses: actions/setup-python@main
2121
with:
22-
python-version: "3.9"
22+
python-version: "3.10"
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip

.github/workflows/test-pytest-slow.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- cron: "0 17 * * 5" # at 05:00 PM, only on Friday
66
push:
77
branches:
8-
- main
8+
- master
99
paths:
1010
- "**.py"
1111
- ".github/**"
@@ -21,9 +21,10 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
python-version: [3.9, 3.13]
24+
python-version: ["3.10", "3.14"]
2525
env:
2626
PYTHON: ${{ matrix.python-version }}
27+
MPLBACKEND: Agg
2728
steps:
2829
- uses: actions/checkout@main
2930
- name: Set up Python

.github/workflows/test_pytest.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,22 @@ jobs:
1919
strategy:
2020
matrix:
2121
os: [ubuntu-latest, macos-latest, windows-latest]
22-
python-version: [3.9, 3.13]
22+
python-version: ["3.10", "3.14"]
2323
env:
2424
OS: ${{ matrix.os }}
2525
PYTHON: ${{ matrix.python-version }}
26+
MPLBACKEND: Agg
2627
steps:
2728
- uses: actions/checkout@main
2829
- name: Set up Python
2930
uses: actions/setup-python@main
3031
with:
3132
python-version: ${{ matrix.python-version }}
32-
33-
- name: Cache Python dependencies
34-
uses: actions/cache@main
35-
with:
36-
path: ~/.cache/pip
37-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-tests.txt') }}
38-
restore-keys: |
39-
${{ runner.os }}-pip-
33+
cache: 'pip'
34+
cache-dependency-path: |
35+
requirements.txt
36+
requirements-tests.txt
37+
requirements-optional.txt
4038
4139
- name: Install rocketpy
4240
run: pip install .

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ persistent=yes
8888

8989
# Minimum Python version to use for version dependent checks. Will default to
9090
# the version used to run pylint.
91-
py-version=3.9
91+
py-version=3.10
9292

9393
# Discover python modules and packages in the file system subtree.
9494
recursive=no

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
"filt",
120120
"firstsimulation",
121121
"flightcsys",
122+
"flightusage",
122123
"Fluxogram",
123124
"fmax",
124125
"fmin",
@@ -181,6 +182,7 @@
181182
"Kaleb",
182183
"Karman",
183184
"Krasser",
185+
"Kutta",
184186
"labelrotation",
185187
"linalg",
186188
"Lince",
@@ -273,6 +275,7 @@
273275
"rtol",
274276
"rtype",
275277
"rucsoundings",
278+
"Runge",
276279
"runslow",
277280
"rwork",
278281
"savetxt",

CHANGELOG.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,38 @@ Attention: The newest changes should be on top -->
3232

3333
### Added
3434

35+
- ENH: Tank Fluids with Variable Density from Temperature and Pressure [#852](https://github.com/RocketPy-Team/RocketPy/pull/852)
36+
- ENH: Controller (AirBrakes) and Sensors Encoding [#849](https://github.com/RocketPy-Team/RocketPy/pull/849)
37+
- EHN: Addition of ensemble variable to ECMWF dictionaries [#842](https://github.com/RocketPy-Team/RocketPy/pull/842)
38+
- ENH: Added Crop and Clip Methods to Function Class [#817](https://github.com/RocketPy-Team/RocketPy/pull/817)
39+
- DOC: Add Flight class usage documentation and update index [#841](https://github.com/RocketPy-Team/RocketPy/pull/841)
40+
- ENH: Discretized and No-Pickle Encoding Options [#827](https://github.com/RocketPy-Team/RocketPy/pull/827)
41+
- ENH: Add the Coriolis Force to the Flight class [#799](https://github.com/RocketPy-Team/RocketPy/pull/799)
42+
- ENH: Improve parachute geometric parametrization [#835](https://github.com/RocketPy-Team/RocketPy/pull/835)
43+
- ENH: Changing ellipses plot axis label [#855](https://github.com/RocketPy-Team/RocketPy/pull/855)
3544

3645
### Changed
3746

47+
- MNT: allow for exporting of non apogee flights. [#863](https://github.com/RocketPy-Team/RocketPy/pull/863)
48+
- TST: remove remaining files after test session. [#862](https://github.com/RocketPy-Team/RocketPy/pull/862)
49+
- MNT: bumps min python version to 3.10 [#857](https://github.com/RocketPy-Team/RocketPy/pull/857)
50+
- DOC: Update docs dependencies and sub dependencies [#851](https://github.com/RocketPy-Team/RocketPy/pull/851)
51+
- MNT: extract flight data exporters [#845](https://github.com/RocketPy-Team/RocketPy/pull/845)
52+
- ENH: _MotorPrints inheritance - issue #460 [#828](https://github.com/RocketPy-Team/RocketPy/pull/828)
53+
- MNT: fix deprecations and warnings [#829](https://github.com/RocketPy-Team/RocketPy/pull/829)
3854

3955
### Fixed
4056

57+
- BUG: correct encoding for trapezoidal sweep length and angle. [#861](https://github.com/RocketPy-Team/RocketPy/pull/861)
58+
- BUG: Fix no time initialization when passing initial_solution as array to Flight object [#844](https://github.com/RocketPy-Team/RocketPy/pull/844)
59+
4160

4261
## [v1.10.0] - 2025-05-16
4362

4463
### Added
4564
- ENH: Support for ND arithmetic in Function class. [#810] (https://github.com/RocketPy-Team/RocketPy/pull/810)
4665
- ENH: allow users to provide custom samplers [#803](https://github.com/RocketPy-Team/RocketPy/pull/803)
47-
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
66+
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
4867
- ENH: Create a rocketpy file to store flight simulations [#800](https://github.com/RocketPy-Team/RocketPy/pull/800)
4968
- ENH: Support for the RSE file format has been added to the library [#798](https://github.com/RocketPy-Team/RocketPy/pull/798)
5069
- ENH: Introduce Net Thrust with pressure corrections [#789](https://github.com/RocketPy-Team/RocketPy/pull/789)
@@ -303,6 +322,7 @@ You can install this version by running `pip install rocketpy==1.3.0`
303322

304323
### Fixed
305324

325+
- BUG: Fixes StochasticNoseCone powerseries issue #838 [#839](https://github.com/RocketPy-Team/RocketPy/pull/839)
306326
- MNT: Alter PYPI classifier naming. [#615](https://github.com/RocketPy-Team/RocketPy/pull/615)
307327
- DOC: Solve Dependencies Conflicts and pyproject build [#613](https://github.com/RocketPy-Team/RocketPy/pull/613)
308328
- BUG: Fixes nose cone bluffness issue #610 [#611](https://github.com/RocketPy-Team/RocketPy/pull/611)

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ main = calisto.add_parachute(
262262
sampling_rate=105,
263263
lag=1.5,
264264
noise=(0, 8.3, 0.5),
265+
radius=1.5,
266+
height=1.5,
267+
porosity=0.0432,
265268
)
266269

267270
drogue = calisto.add_parachute(
@@ -271,6 +274,9 @@ drogue = calisto.add_parachute(
271274
sampling_rate=105,
272275
lag=1.5,
273276
noise=(0, 8.3, 0.5),
277+
radius=1.5,
278+
height=1.5,
279+
porosity=0.0432,
274280
)
275281
```
276282

0 commit comments

Comments
 (0)