Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't understand. Are we introducing any breaking changes with the next minor release or not?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes. New serial studies number from 0 instead of 1, and a fixed random_seed gives different results than v1.13, because every simulation is reseeded and object seeds are ignored. The old ### Breaking changes section repeated the #1187 entry, so b1e75cb folds both points into that single ### Changed entry. Whether this ships as 1.14.0 or needs a major bump is up to us.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Attention: The newest changes should be on top -->

### Added

- ENH: Accept `random_seed` in `MonteCarlo.simulate_convergence`, including across batches. [#1198](https://github.com/RocketPy-Team/RocketPy/pull/1198) [#1209](https://github.com/RocketPy-Team/RocketPy/issues/1209)
- ENH: Reproducible Monte Carlo seeding, and an append that continues the same study [#1187](https://github.com/RocketPy-Team/RocketPy/pull/1187) [#1053](https://github.com/RocketPy-Team/RocketPy/issues/1053) [#1075](https://github.com/RocketPy-Team/RocketPy/issues/1075)
- ENH: 3-DOF single rail button flight phase (tip-off analysis), enabled with the opt-in `Flight(use_udot_rail2=True)`. Between the upper rail button leaving the rail and the lower one following it, the rocket pivots about the lower button under a solved constraint wrench instead of jumping straight to free 6-DOF flight. The window is reported as `between_rails_time`, `between_rails_velocity` and `tip_off_duration`, printed by `Flight.info()` and shaded in the attitude plots. Requires `simulation_mode="6 DOF"` and `equations_of_motion="standard"`. [#920](https://github.com/RocketPy-Team/RocketPy/pull/920)
- ENH: Support fixed-time parachute deployment triggers [#1133](https://github.com/RocketPy-Team/RocketPy/pull/1133) [#437](https://github.com/RocketPy-Team/RocketPy/issues/437)
Expand All @@ -50,7 +51,7 @@ Attention: The newest changes should be on top -->

### Changed

- ENH: Number the simulations of a serial Monte Carlo run from zero, as the parallel path already did — the two used to name the same simulation `1, 2, 3` and `0, 1, 2`. The `index` field written into the inputs and outputs rows shifts by one for serial runs, so code reading indices off those files has to expect a run of `n` simulations to be numbered `0` to `n - 1`. An append onto a study written before this release is refused rather than continued, since its rows do not record which root drew them. [#1187](https://github.com/RocketPy-Team/RocketPy/pull/1187)
- ENH: Number new Monte Carlo runs from zero in both execution modes, as the parallel path already did; serial runs used `1..n`, so their `index` shifts by one. Every simulation is now reseeded from one study `random_seed` (a non-negative integer), so individual object seeds are ignored and fixed-seed results from v1.13 change. New input rows record that `seed`; metadata is kept out of results, statistics and plots. Legacy checkpoints keep their numbering when extended, with a warning that their original draws cannot be reproduced. [#1187](https://github.com/RocketPy-Team/RocketPy/pull/1187) [#1209](https://github.com/RocketPy-Team/RocketPy/issues/1209)
- ENH: Compute the rocket static margin lazily [#1135](https://github.com/RocketPy-Team/RocketPy/pull/1135) [#780](https://github.com/RocketPy-Team/RocketPy/issues/780)
- DOC: Tighten the comments that came with the sampler seed groups [#1154](https://github.com/RocketPy-Team/RocketPy/pull/1154)
- CI: make the Gemini PR reviewer actually review [#1140](https://github.com/RocketPy-Team/RocketPy/pull/1140)
Expand All @@ -61,6 +62,7 @@ Attention: The newest changes should be on top -->

### Fixed

- BUG: Keep checkpoint metadata out of Monte Carlo plots and statistics, recover missing simulation indices without repeating completed flights, and warn when appending v1.13 logs. Preserve explicit initial flight states, `terminate_on_apogee`, `use_udot_rail2` and solid-motor grain bonding in stochastic models. [#1209](https://github.com/RocketPy-Team/RocketPy/issues/1209)
- BUG: A `Flight` continued from another `Flight` object now records `t_initial`, so a rocket carrying sensors or controllers no longer raises `AttributeError` on that path. [#920](https://github.com/RocketPy-Team/RocketPy/pull/920)
- BUG: Correct the gravity sign an `Accelerometer` applies when `consider_gravity=True`. The gravitational field was added to the inertial acceleration instead of subtracted from it, so the sensor reported the negative of the proper acceleration along the vertical: one at rest read -g rather than +g. Recorded accelerometer data taken with `consider_gravity=True` changes sign in that term. [#1175](https://github.com/RocketPy-Team/RocketPy/pull/1175)
- BUG: Report a Monte Carlo worker that fails instead of hanging or passing for a finished run [#1182](https://github.com/RocketPy-Team/RocketPy/pull/1182)
Expand All @@ -84,7 +86,7 @@ Attention: The newest changes should be on top -->
- BUG: Restore the UTC fallback without timezonefinder [#1143](https://github.com/RocketPy-Team/RocketPy/pull/1143)
- BUG: Pick between the candidate values of a list input with the stochastic model's own seeded generator. `random.choice` was used, which draws from the interpreter-wide stream that `_set_stochastic` does not reseed, so a fixed seed did not reproduce the values chosen from a list, and Monte Carlo workers forked from one process walked a single shared stream instead of sampling independently. Fixed-seed baselines that vary a list input change. [#953](https://github.com/RocketPy-Team/RocketPy/issues/953)
- BUG: Report the atmospheric model time period and ensemble member count for lower-case model types. `set_atmospheric_model` documents `type` as case-insensitive, but `Environment.info()` and `all_info()` compared against capitalised literals, so `type="ensemble"` printed no time period and no member count, and skipped the ensemble comparison plot. [#520](https://github.com/RocketPy-Team/RocketPy/issues/520)
- BUG: Give each `CustomSampler` input its own deterministic stream, and seed samplers sharing one generator once as a group. Existing fixed-seed `CustomSampler` baselines change, and samplers built on the legacy `RandomState` must move to `default_rng` because seeds now carry the full 128 bits. [#1102](https://github.com/RocketPy-Team/RocketPy/pull/1102)
- BUG: Give each `CustomSampler` input its own deterministic stream, and seed samplers sharing one generator once as a group. Reset callbacks receive a 32-bit integer compatible with both `RandomState` and `default_rng`; existing fixed-seed baselines change. [#1102](https://github.com/RocketPy-Team/RocketPy/pull/1102) [#1209](https://github.com/RocketPy-Team/RocketPy/issues/1209)
- BUG: Accept the callable parachute triggers `StochasticParachute` documents, and reject the ones it cannot mean. An invalid string, an empty list or a boolean now fails during validation instead of reaching `Parachute` or becoming a one-metre height trigger. [#1103](https://github.com/RocketPy-Team/RocketPy/pull/1103)
- BUG: Accept a deterministic aerodynamic surface in `StochasticRocket.add_nose`, `add_trapezoidal_fins`, `add_elliptical_fins` and `add_tail`. Each wrapped the surface with a `component=` keyword none of the stochastic classes accept, so passing anything other than an already-stochastic surface raised a `TypeError`. [#953](https://github.com/RocketPy-Team/RocketPy/issues/953)
- BUG: rocket with a late-starting thrust curve never leaves the rail [#1085](https://github.com/RocketPy-Team/RocketPy/pull/1085)
Expand Down
35 changes: 27 additions & 8 deletions docs/user/stochastic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,9 @@ on equal values, and a specification with no spread always will.
The reset is what builds the tree, not ``add_parachute`` or ``add_nose``. A
rocket resets itself once while being constructed, when it has no components
yet, so anything attached afterwards keeps the generator it was built with until
something resets it again. A serial ``MonteCarlo`` run does not reset it at
all. A parallel one tries to, once per worker, but hands the model a
``SeedSequence`` where an integer is wanted, so that path does not get as far
as building the tree either. Resetting per simulation, from an integer seed the
caller chooses, is what the Monte Carlo seeding work adds.
something resets it again. ``MonteCarlo`` resets the tree before every
simulation in both serial and parallel runs, using the study seed and the
simulation index to derive independent streams.

Each collection is spawned separately, so adding an aerodynamic surface does not
move what the parachutes draw. Within a collection the stream follows insertion
Expand Down Expand Up @@ -348,10 +346,12 @@ draws under a fixed seed. The rocket's own inputs, such as ``mass`` and
split over any number of workers, and whether it was reached first or last.
A run of ``n`` simulations numbers them 0 to ``n - 1`` either way, which is
what makes one index name one simulation.
Every input row records the root it came from, so appending carries that
Every input row records one integer ``seed``, so appending carries that
study on whether or not the seed is given again, and a different one is
refused rather than mixed in. Without a seed a run draws fresh entropy and
reproduces nothing.
refused rather than mixed in. Without a seed, a new run generates and prints
one. Pass that integer as ``random_seed`` to reproduce the study. Seeds on
individual stochastic models are overridden; a new study without
``random_seed`` warns when these models have already been seeded.

An index fixes the draw, not the object it is drawn around. Where the note
above says a value follows its deterministic object, moving that object
Expand All @@ -360,6 +360,25 @@ draws under a fixed seed. The rocket's own inputs, such as ``mass`` and
rather than from the generator it is handed sits outside all of this, as
:ref:`custom_sampler` warns.

``simulate_convergence(random_seed=...)`` uses the same study seed for every
batch. Changing the batch size does not change the inputs of a given index.

Resuming a study
----------------

Use ``simulate(number_of_simulations=100, append=True)`` to reach a total of
100 simulations. A completed index is kept; missing indices below the target
are simulated, including gaps left by interrupted parallel workers. Keep the
input and output logs together: they are checked for matching indices and
duplicate records before any new rows are written. The study's models must
still describe the same rocket, flight and environment.

Logs from v1.13 have no study seed. Appending preserves their rows and emits a
warning: the old random stream cannot be recovered. New rows record the reported
seed. Existing one-based serial numbering is preserved; new studies start at
zero. Checkpoint fields (``index``, ``seed`` and the earlier ``run_root`` field)
are excluded from ``results``, summary statistics and plots.

Conclusion
----------

Expand Down
Loading
Loading