Skip to content

Commit db10e08

Browse files
MateusStanoclaude
andcommitted
DOC: document the Solution container and canonical state guarantees
Describe flight.solution as the new Solution container (list-like plus queries by variable name), note that event/parachute callbacks always receive the full canonical state even during reduced-state phases, and record the change, deprecations and result shift in the changelog. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ea18a9f commit db10e08

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

CHANGELOG.md

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

3333
### Added
3434

35+
- ENH: Solution class for variable-length flight state, so each flight phase can integrate only the variables it needs (e.g. a translational-only parachute descent). `flight.solution` keeps its list-like behavior and adds queries by variable name (`flight.solution["vz"]`, `flight.solution.at(t)`).
3536
- ENH: MNT: introduce pressure unit conversion when using forecast/reanalysis/ensemble data [#955](https://github.com/RocketPy-Team/RocketPy/pull/955)
3637
- ENH: Auto Populate Changelog [#919](https://github.com/RocketPy-Team/RocketPy/pull/919)
3738
- ENH: Adaptive Monte Carlo via Convergence Criteria [#922](https://github.com/RocketPy-Team/RocketPy/pull/922)
3839
- TST: Add acceptance tests for 3DOF flight simulation based on Bella Lui rocket [#914](https://github.com/RocketPy-Team/RocketPy/pull/914)
3940

4041
### Changed
4142

42-
-
43+
- ENH: The parachute descent now integrates only position and velocity (attitude is held fixed at deployment), which changes descent-phase results slightly. `np.array(flight.solution)` now raises for flights whose phases integrate different variables; use `flight.solution["name"]` or `flight.solution.canonical_array` instead.
44+
45+
### Deprecated
46+
47+
- ENH: `Flight.solution_array` and `Flight.get_solution_at_time` are deprecated (removal targeted v1.14); use `flight.solution["name"]` / `flight.solution.canonical_array` and `flight.solution.at(t)`. Exporting flight data with no variable names is deprecated for the same reason.
4348

4449
### Fixed
4550

rocketpy/simulation/events/event.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ def __init__( # pylint: disable=too-many-arguments
7070
``kwargs["event"].context``.
7171
The following keys are always available in ``kwargs``:
7272
``time`` (float, s),
73-
``state`` (list ``[x, y, z, vx, vy, vz, e0, e1, e2, e3, wx, wy, wz]``),
73+
``state`` (list ``[x, y, z, vx, vy, vz, e0, e1, e2, e3, wx, wy, wz]``;
74+
always this full layout, even in phases that integrate fewer
75+
variables — during a parachute descent the attitude and angular
76+
rates hold their values from when the parachute deployed),
7477
``sensors`` (list of sensor objects),
7578
``sensors_by_name`` (dict of sensor objects),
7679
``environment`` (:class:`rocketpy.Environment`),

rocketpy/simulation/flight.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,16 @@ class Flight: # pylint: disable=too-many-instance-attributes, too-many-public-m
157157
e2_init, e3_init, w1_init, w2_init, w3_init]
158158
Flight.t_initial : int, float
159159
Initial simulation time in seconds. Usually 0.
160-
Flight.solution : list
161-
Solution array which keeps results from each numerical
162-
integration.
160+
Flight.solution : rocketpy.simulation.solution.Solution
161+
The state history of the flight. It behaves like the list of rows
162+
``[t, x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]`` it has always
163+
been (supporting ``len()``, iteration and integer indexing), and also
164+
answers queries by variable name: ``flight.solution["vz"]`` returns the
165+
``[t, value]`` history of the vertical velocity across the whole flight,
166+
and ``flight.solution.at(t)`` returns the state at a given time. A phase
167+
that integrates fewer variables (such as a parachute descent, which
168+
follows only position and velocity) stores only those; the rest are
169+
reconstructed or held at their value when the phase began.
163170
Flight.t : float
164171
Current integration time.
165172
Flight.y : list

0 commit comments

Comments
 (0)