Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use global rng in NTSeason.simulate_background #395

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

jvansanten
Copy link
Contributor

NTSeason.simulate_background() instantiates a fresh RNG each time it is called, using entropy from the system, whereas most (all?) of the rest of flarestack uses the global RNG numpy.random. Use the global RNG instead, so that MinimizationHandler.prepare_dataset() setting of the global seed has the intended effect.

@mlincett
Copy link
Collaborator

mlincett commented Sep 3, 2024

Indeed.

I think this was my choice because at the time I thought we would transition to default_rng() everywhere (see #129).

Clearly that does not work well for reproducibility unless the global seed is propagated to individual RNG objects (that can become cumbersome). But in that case the RNG should be an attribute of the object, and not be recreated at every call of the method.

Sorry this caused (unexpected) trouble. I am fine with the workaround as it seems the path of least friction.

@jvansanten jvansanten merged commit 5950bc4 into icecube:master Sep 6, 2024
9 of 13 checks passed
@jvansanten jvansanten deleted the reproducibility branch September 6, 2024 06:59
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