Skip to content

Commit 90c0749

Browse files
committed
Merge branch 'enh/changing-ellipses-axis-label' of https://github.com/RocketPy-Team/RocketPy into enh/changing-ellipses-axis-label
2 parents 3bbe340 + 6713f0b commit 90c0749

File tree

78 files changed

+4783
-1450
lines changed

Some content is hidden

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

78 files changed

+4783
-1450
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/test-pytest-slow.yaml

Lines changed: 2 additions & 1 deletion
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/**"
@@ -24,6 +24,7 @@ jobs:
2424
python-version: [3.9, 3.13]
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: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,18 @@ jobs:
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 .

.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: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,37 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131
Attention: The newest changes should be on top -->
3232

3333
### Added
34+
- ENH: Tank Fluids with Variable Density from Temperature and Pressure [#852](https://github.com/RocketPy-Team/RocketPy/pull/852)
35+
- ENH: Controller (AirBrakes) and Sensors Encoding [#849](https://github.com/RocketPy-Team/RocketPy/pull/849)
36+
- EHN: Addition of ensemble variable to ECMWF dictionaries [#842](https://github.com/RocketPy-Team/RocketPy/pull/842)
37+
- ENH: Added Crop and Clip Methods to Function Class [#817](https://github.com/RocketPy-Team/RocketPy/pull/817)
38+
- DOC: Add Flight class usage documentation and update index [#841](https://github.com/RocketPy-Team/RocketPy/pull/841)
39+
- ENH: Discretized and No-Pickle Encoding Options [#827](https://github.com/RocketPy-Team/RocketPy/pull/827)
40+
- ENH: Add the Coriolis Force to the Flight class [#799](https://github.com/RocketPy-Team/RocketPy/pull/799)
41+
- ENH: Improve parachute geometric parametrization [#835](https://github.com/RocketPy-Team/RocketPy/pull/835)
42+
43+
### Changed
44+
45+
- DOC: Update docs dependencies and sub dependencies [#851](https://github.com/RocketPy-Team/RocketPy/pull/851)
46+
- MNT: extract flight data exporters [#845](https://github.com/RocketPy-Team/RocketPy/pull/845)
47+
- ENH: _MotorPrints inheritance - issue #460 [#828](https://github.com/RocketPy-Team/RocketPy/pull/828)
48+
- MNT: fix deprecations and warnings [#829](https://github.com/RocketPy-Team/RocketPy/pull/829)
49+
50+
### Fixed
51+
52+
- BUG: Fix no time initialization when passing initial_solution as array to Flight object [#844](https://github.com/RocketPy-Team/RocketPy/pull/844)
53+
54+
55+
## [v1.10.0] - 2025-05-16
56+
57+
### Added
58+
- ENH: Support for ND arithmetic in Function class. [#810] (https://github.com/RocketPy-Team/RocketPy/pull/810)
3459
- ENH: allow users to provide custom samplers [#803](https://github.com/RocketPy-Team/RocketPy/pull/803)
35-
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
60+
- ENH: Implement Multivariate Rejection Sampling (MRS) [#738] (https://github.com/RocketPy-Team/RocketPy/pull/738)
3661
- ENH: Create a rocketpy file to store flight simulations [#800](https://github.com/RocketPy-Team/RocketPy/pull/800)
3762
- ENH: Support for the RSE file format has been added to the library [#798](https://github.com/RocketPy-Team/RocketPy/pull/798)
3863
- ENH: Introduce Net Thrust with pressure corrections [#789](https://github.com/RocketPy-Team/RocketPy/pull/789)
64+
- ENH: Environment object from EnvironmentAnalysis [#813](https://github.com/RocketPy-Team/RocketPy/pull/813)
3965

4066
### Changed
4167

@@ -48,7 +74,7 @@ Attention: The newest changes should be on top -->
4874
- BUG: Wrong Phi Initialization For nose_to_tail Rockets [#809](https://github.com/RocketPy-Team/RocketPy/pull/809)
4975
- BUG: Fix StochasticFlight time_overshoot None bug [#805](https://github.com/RocketPy-Team/RocketPy/pull/805)
5076

51-
## v1.9.0 - 2025-03-24
77+
## [v1.9.0] - 2025-03-24
5278

5379
### Added
5480

@@ -290,6 +316,7 @@ You can install this version by running `pip install rocketpy==1.3.0`
290316

291317
### Fixed
292318

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

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
[![Instagram](https://img.shields.io/badge/Instagram-E4405F?style=flat&logo=instagram&logoColor=white)](https://www.instagram.com/rocketpyteam)
1919
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white)](https://www.linkedin.com/company/rocketpy)
2020
[![DOI](https://img.shields.io/badge/DOI-10.1061%2F%28ASCE%29AS.1943--5525.0001331-blue.svg)](http://dx.doi.org/10.1061/%28ASCE%29AS.1943-5525.0001331)
21+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/RocketPy-Team/RocketPy)
2122

2223
# RocketPy
2324

@@ -261,6 +262,9 @@ main = calisto.add_parachute(
261262
sampling_rate=105,
262263
lag=1.5,
263264
noise=(0, 8.3, 0.5),
265+
radius=1.5,
266+
height=1.5,
267+
porosity=0.0432,
264268
)
265269

266270
drogue = calisto.add_parachute(
@@ -270,6 +274,9 @@ drogue = calisto.add_parachute(
270274
sampling_rate=105,
271275
lag=1.5,
272276
noise=(0, 8.3, 0.5),
277+
radius=1.5,
278+
height=1.5,
279+
porosity=0.0432,
273280
)
274281
```
275282

0 commit comments

Comments
 (0)