Skip to content

BUG: serialize numpy SeedSequence for sensor seeds (#1087) - #1124

Open
thatrandomasiandev wants to merge 1 commit into
RocketPy-Team:developfrom
thatrandomasiandev:bug/1087-sensor-seedsequence-serialize
Open

BUG: serialize numpy SeedSequence for sensor seeds (#1087)#1124
thatrandomasiandev wants to merge 1 commit into
RocketPy-Team:developfrom
thatrandomasiandev:bug/1087-sensor-seedsequence-serialize

Conversation

@thatrandomasiandev

Copy link
Copy Markdown

Summary

  • Teach RocketPyEncoder / RocketPyDecoder to round-trip numpy.random.SeedSequence via its reconstructible state (entropy, spawn_key, n_children_spawned, pool_size) plus a class signature.
  • Fixes TypeError: Object of type SeedSequence is not JSON serializable when dumping sensors (or any object) that hold a SeedSequence seed, including spawned child sequences used for parallel Monte Carlo.

Fixes #1087

Test plan

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTHONPATH=. pytest -p pytest_cov tests/unit/sensors/test_sensor_seeding.py -q (8 passed)
  • Regression: Accelerometer(..., seed=SeedSequence(0).spawn(1)[0]) then json.dumps(sensor.to_dict(), cls=RocketPyEncoder) succeeds and decoder restores matching .state

@thatrandomasiandev
thatrandomasiandev requested a review from a team as a code owner August 11, 2026 01:33
@Gui-FernandesBR
Gui-FernandesBR force-pushed the bug/1087-sensor-seedsequence-serialize branch from c586fd2 to 118d866 Compare August 11, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants