What happened?
This is similar to identical to #298 , #295, #97.
PoorMansHxRGReadoutNoise and BasicReadoutNoise call np.random.seed(random_seed) each time that apply_to is called on a detector, with random_seed the same every time. ShotNoise calls rng = np.random.default_rng(self.meta["random_seed"]) with the same effect. Moving np.random_seed and the rng initialisation into __init__ should solve that, at least if several readout() are done in sequence (what about parallelisation?). That the various noise effects use the same seed is not ideal either, but may be not so harmful since different noise distributions are used.
Code to reproduce
cmd = sim.UserCommands(use_instrument="METIS", set_modes=["img_lm"])
cmd["!SIM.random.seed"] = 42
metis = sim.OpticalTrain(cmd)
metis.observe()
read_01 = metis.readout()[0]
read_02 = metis.readout()[0]
np.all(read_01[1].data == read_02[1].data)
# np.True_
Exception traceback
ScopeSim bug_report()
In [41]: sim.bug_report()
Python:
3.12.9 (main, Feb 5 2025, 01:31:18) [GCC 14.2.0]
Installed Python packages:
anisocado: 0.5.0
astar-utils: 0.6.0
astropy: 7.2.2
beautifulsoup4: 4.15.0
docutils: 0.21.2
httpxyz: 0.31.2
lxml: 6.1.1
matplotlib: 3.10.8
more-itertools: 10.2.0
numpy: 2.2.6
packaging: 26.2
pooch: 1.9.0
pyyaml: 6.0.3
scipy: 1.17.0
scopesim: 0.12.0b0.dev0
scopesim_data: could not be loaded.
scopesim_templates: 0.8.2a2
skycalc-ipy: 0.7.0
synphot: 1.7.0
tqdm: 4.70.0
IRDB installation
Cloned and linked IRDB repository
Use case
Pipeline development
What happened?
This is similar to identical to #298 , #295, #97.
PoorMansHxRGReadoutNoiseandBasicReadoutNoisecallnp.random.seed(random_seed)each time thatapply_tois called on a detector, withrandom_seedthe same every time.ShotNoisecallsrng = np.random.default_rng(self.meta["random_seed"])with the same effect. Movingnp.random_seedand the rng initialisation into__init__should solve that, at least if severalreadout()are done in sequence (what about parallelisation?). That the various noise effects use the same seed is not ideal either, but may be not so harmful since different noise distributions are used.Code to reproduce
Exception traceback
ScopeSim bug_report()
In [41]: sim.bug_report() Python: 3.12.9 (main, Feb 5 2025, 01:31:18) [GCC 14.2.0] Installed Python packages: anisocado: 0.5.0 astar-utils: 0.6.0 astropy: 7.2.2 beautifulsoup4: 4.15.0 docutils: 0.21.2 httpxyz: 0.31.2 lxml: 6.1.1 matplotlib: 3.10.8 more-itertools: 10.2.0 numpy: 2.2.6 packaging: 26.2 pooch: 1.9.0 pyyaml: 6.0.3 scipy: 1.17.0 scopesim: 0.12.0b0.dev0 scopesim_data: could not be loaded. scopesim_templates: 0.8.2a2 skycalc-ipy: 0.7.0 synphot: 1.7.0 tqdm: 4.70.0IRDB installation
Cloned and linked IRDB repository
Use case
Pipeline development