LSSTDESC / imSim

GalSim based Rubin Observatory image simulation package
https://lsstdesc.org/imSim
BSD 3-Clause "New" or "Revised" License
36 stars 15 forks source link

Race when perturbing telescope? #338

Closed jmeyers314 closed 1 year ago

jmeyers314 commented 1 year ago

I've been testing out simulating donuts and then processing them with the active optics framework. In a recent test, I tried perturbing the telescope (by adding a Zernike-shaped figure error to M1) and then making images at the centers of each raft and each wavefront sensor. I then iterated over telescope perturbations (which Zernike polynomial to add to M1). However, something is off when I plot the donuts over different perturbations from a single wavefront sensor:

Donuts

These should all be moderate perturbations around the same fiducial donut, but some images have been made completely in-focus! Similarly, if I plot an in-focus spot across different telescope perturbations, most look plausible but a few have been turned into donuts!

In-focus

I'm pretty sure which images are effected is random from running this multiple times.

Not sure if it's relevant, but I have been using multiprocessing. Maybe something is wrong with TelescopeLoader.setupImage (I don't see anything obvious though). Or maybe there's some kind of race where GetInputObj('telescope', config, base, 'telescope') returns before setupImage is done or is improperly cached?

jmeyers314 commented 1 year ago

I just regenerated all the sims using output.nproc=1, and looks correct so far. So looks like this is something with multiprocessing and input objects.