Skip to content

29 reproducible bolometer observations with a fixed seed - #30

Merged
jherf merged 2 commits into
mainfrom
29-reproducible-bolometer-observations-with-a-fixed-seed
Aug 28, 2026
Merged

jherf merged 2 commits into
mainfrom
29-reproducible-bolometer-observations-with-a-fixed-seed

Conversation

@MishaVeldhoen

@MishaVeldhoen MishaVeldhoen commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Context

Raysect sets the seed only in the primary worker, additional workers still use a random seed, so the result is still not deterministic. A possible upstream fix could be that raysect workers choose a distinct but non-random seed (based on seed), so we could follow up with that if this fix is too slow.

Solution

  • Introduced a new setting: BOLOMETER_PROPS.seed. Setting this seed to a specific number will set the seed in raysect, and restrict raysect to using only a single worker.

Drive-by fixes

  • Initialize RadDist.data in the constructor.

Tests

  • Add a test that verifies that subsequent observes are exactly the same.

Closes #29

@MishaVeldhoen
MishaVeldhoen force-pushed the 29-reproducible-bolometer-observations-with-a-fixed-seed branch from 65b3683 to 2c4a3d9 Compare June 30, 2026 23:07
@MishaVeldhoen
MishaVeldhoen marked this pull request as ready for review June 30, 2026 23:11
@MishaVeldhoen
MishaVeldhoen force-pushed the 29-reproducible-bolometer-observations-with-a-fixed-seed branch from 2c4a3d9 to bdee827 Compare June 30, 2026 23:18
@bensteinlubrano

Copy link
Copy Markdown
Collaborator

Looks good to me! Jeff knows this part of the code better than me though since it was part of the refactor so I will wait for his review.

@jherf
jherf marked this pull request as draft August 28, 2026 16:11
bolos_observe wrote to self.data before its own existence guard, so an
observe without a prior calc_radiated_power raised AttributeError. Make
self.data a class invariant set in __init__ and drop the now-redundant
guard, so the observe no longer depends on calc_radiated_power running first.
Add an optional `seed` to BOLOMETER_PROPS. When set, observations render
in-process (serial engine) and the ray-tracing RNG is seeded, so observing
a structure twice yields identical bolometer signals. The default path
(multicore, unseeded) is unchanged.

Add an opt-in regression test behind a `cherab` pytest marker (deselected
by default; run with `pytest -m cherab`) and register the marker.

Closes #29
@jherf
jherf force-pushed the 29-reproducible-bolometer-observations-with-a-fixed-seed branch from bdee827 to 37a9052 Compare August 28, 2026 16:56
@jherf
jherf marked this pull request as ready for review August 28, 2026 16:59

@jherf jherf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great work!

@jherf
jherf merged commit 48ec7f4 into main Aug 28, 2026
2 checks passed
@jherf
jherf deleted the 29-reproducible-bolometer-observations-with-a-fixed-seed branch August 28, 2026 17:02
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.

Reproducible bolometer observations with a fixed seed

3 participants