desihub / specsim

Quick simulations of spectrograph response
2 stars 9 forks source link

specsim.instrument and config random state #94

Open sbailey opened 6 years ago

sbailey commented 6 years ago

Spinning this off from desihub/desisim#393:

specsim.instrument.initialize(config) generates a random state and uses it for the positioner offsets, which is cached in the Simulator.instrument. This random state gets used every time Simulator.simulate() is called, meaning that the answer for simulating a set of spectra depends upon the history of what other spectra were simulated previously using the same Simulator object.

Similarly, simulating the same spectra twice in a row gives different answers. This could be considered a feature, like simulating the same inputs with different exposures with different fiber positioner offsets, but we need better control over this positioner offset random state, e.g. a way to reset the Simulator+Instrument back to the original state.

Related: #36 (provenance and reproducibility) and #51 (deepcopy of Simulator).