Revert RNG switch to np.random.default_rng()

Restore use of the global np.random state in pseudo_Obs (misc.py) and the
prior id generation (fits.py), keeping seed behavior unchanged. The switch
to a module-local generator is out of scope for this lint-focused PR.
This commit is contained in:
Fabian Joswig 2026-06-18 10:49:11 +02:00
commit 9be9fb6767
3 changed files with 3 additions and 22 deletions

View file

@ -22,18 +22,3 @@ def test_obs_errorbar():
def test_print_config():
pe.print_config()
def test_pseudo_Obs_seed_independence():
# pseudo_Obs now uses a module-local np.random.default_rng() generator,
# so np.random.seed() no longer controls its output. The per-sample
# deltas therefore differ between successive calls even with a re-seed,
# though the normalized value / dvalue still match the requested inputs.
np.random.seed(0)
a = pe.pseudo_Obs(1.0, 0.1, "e")
np.random.seed(0)
b = pe.pseudo_Obs(1.0, 0.1, "e")
assert not np.allclose(a.deltas["e"], b.deltas["e"])
assert np.isclose(a.value, b.value)
assert np.isclose(a.dvalue, b.dvalue)