Repository navigation
Conversation
Each batch derived a root of its own, so a study could not be repeated and the same max_simulations reached different samples per batch size. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1198 +/- ##
========================================
Coverage 87.84% 87.85%
========================================
Files 130 130
Lines 18185 18194 +9
========================================
+ Hits 15975 15984 +9
Misses 2210 2210 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Nine findings inline. The one on random_seed=random_seed affects what the feature promises; the rest are smaller.
develop now carries the seed pass-through and its changelog entry (9e3cc63, RocketPy-Team#1209), so both conflicts take develop's side. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
simulate_convergence handed its seed to every batch but bootstrapped each confidence interval from SciPy's global generator, so the same seed gave a different confidence_interval_history and, near the tolerance, a different stopping batch. The bootstrap now takes a 32-bit seed spawned off the study seed. That also covers a study that drew its own seed and is run again with the one it recorded. A random_seed of the wrong type or sign is now refused with the other inputs, before the logs are read, including when they already hold every simulation and nothing would run. The docstring says what the seed does not fix: where the study stops can depend on batch_size, and a finished study runs nothing whatever seed it is given. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
The cross-batch test compared mass alone, which comes from the rocket's stream, so a change in the environment or flight draws would still pass. It now compares each input row in full and in order. The three tests this branch added ran twenty Calisto flights, keyed the rows they compared by index, and copied their helpers from other files. What they checked is now covered next to the convergence tests develop already has, on its light release_study fixture, so the file is gone. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
3f7b767 to
1176b3e
Compare
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Thanks for the thorough round. One finding left, inline: with parallel=True the seeded bootstrap can still give a different stopping batch.
Parallel workers append rows as they finish, so two runs with the same seed could hand the seeded bootstrap the same values in a different order and get different widths, which near the tolerance means a different stopping batch. Each batch now reads the outputs, sorts both logs by index and rebuilds results before the bootstrap. Sorting the inputs as well keeps each input row next to its output. The changelog entry for this pull request now mentions the seeded bootstrap. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
|
|
||
| return confidence_interval_history | ||
|
|
||
| def __read_outputs_in_simulation_order(self): |
There was a problem hiding this comment.
Nit (optional): the order fix only exists inside simulate_convergence. After it returns, results, inputs_log and outputs_log are sorted in memory while the files keep arrival order, and the next simulate or import_outputs reloads them unsorted.
So estimate_confidence_interval(..., random_state=s) called by a user on a parallel study still depends on which worker finished first, and gives different numbers before and after a reload. Fix: sort once where the logs are read (set_outputs_log / set_inputs_log) so every path sees index order.
There was a problem hiding this comment.
Done in 5d214b3. set_inputs_log and set_outputs_log now sort the rows by index when every row has an integer one, and keep the file order otherwise, as in the old example.outputs.txt fixture. test_logs_written_out_of_order_are_read_back_by_index reverses both logs, reloads them, and checks the order and that a seeded estimate_confidence_interval gives the same interval as before.
…study-from-one-seed-v2 Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> # Conflicts: # CHANGELOG.md
Sorting by index only inside simulate_convergence left results, and any seeded estimate_confidence_interval a user ran, in arrival order after the next reload. set_inputs_log and set_outputs_log now sort when every row records an integer index, so the convergence loop no longer parses the outputs a second time per batch or rebuilds results next to a stale processed_results. A finished study now warns that nothing was run, also when the logs hold more than max_simulations rows, and the Returns section says so. The study seed defaults to None on the class, so a class overriding simulate no longer has to set the mangled name. The convergence tests derive their tolerance from the run's own widths, run the parallel case on two workers for two batches, and compare its widths with pytest.approx. Since v1.14.0 has shipped, the changelog gets a new entry under Unreleased. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
|
Merged develop. v1.14.0 shipped with the earlier changelog line, so the seeded bootstrap, the log order and the warning have a new entry under Unreleased.
One docs example now warns. In |
|
Two pre-existing bugs showed up in this round; neither comes from this PR, so they shouldn't block it, but could you track them?
|
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Everything from the previous rounds is fixed in 5d214b3, and CI is green. Thanks!
|
Opened #1255 for the blank-line count. It reproduces on develop: two rows and two blank lines load as four simulations, and |
|
@thc1006 could you kindly fix git conflict before merging? |
develop added the RocketPy-Team#1254 and RocketPy-Team#1199 lines under Fixed. The RocketPy-Team#1198 line goes above them, since the changelog asks for the newest changes on top. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
Addresses #1077.
While this was open, #1213, for the release blockers in #1209, put the seed pass-through and its changelog entry on develop (9e3cc63). I merged develop and took its side of both conflicts, so what this PR adds now is the follow-up from review.
Pull request type
Checklist
ruff check/ruff format --check,pylint) has passed locallyCHANGELOG.md: a line under Unreleased. The changelog workflow skips a PR that already has one.Current behavior
simulate_convergencepassesrandom_seedto every batch but bootstraps each confidence interval from SciPy's global generator. Two runs with the same seed can return different widths and, near the tolerance, stop after a different number of batches. A badrandom_seedfails only inside the first batch, and not at all if the logs already holdmax_simulationsrows or more.New behavior
The bootstrap is seeded from the study's seed, and
set_inputs_logandset_outputs_logreturn the rows in simulation order when each row records its index. So a study run again with the same seed stops after the same batch, in parallel or not. That includes a study that drew its own seed, run again with the one it printed.random_seedis checked with the other inputs, before any log is read, and the docstring says what the seed does not fix: where the study stops can depend onbatch_size, and a finished study runs nothing. That case now warns.Breaking change
Additional information
The integration tests sit in
test_monte_carlo_release.py, beside the convergence tests develop added, and the cross-batch one there now compares whole input rows. Taking out the bootstrap seed, seeding it from the argument instead of the study, reading the logs in the order workers wrote them, or dropping the up-front check or the warning each makes one of them fail.Merged with develop at v1.14.0, the unit, integration, doctest and acceptance tests pass on Python 3.10 and 3.14 with
.[all], and so do the slow Monte Carlo tests. ruff 0.17.6 and pylint 4.1.4 are clean.Two things I found along the way are filed separately as #1229 and #1230.