GalSim-developers / GalSim

The modular galaxy image simulation toolkit. Documentation:
http://galsim-developers.github.io/GalSim/
Other
224 stars 105 forks source link

Don't error if two photon_arrays being convolved both have allocated ancillary arrays. #1242

Closed rmjarvis closed 1 year ago

rmjarvis commented 1 year ago

When convolving two PhotonArrays, we had a feature where GalSim would check if both of them had various ancillary arrays set (and not identical), and if they were both set, it would raise an exception. The thought was that this probably indicated an error. But in practice it meant that when two PhaseScreenPSFs were convolved, they couldn't be drawn with photon shooting, since each of them would have set the pupil coordinates and the time independently.

If you want to be really careful about these ancillary arrays, then you can put the PSFs in photon_ops, in which case they will be processed sequentially and PhaseScreenPSF won't overwrite e.g. pupil coordinates that are already there. But if you don't much care about these ancillary arrays, it should be allowed to just convolve two PSF objects and draw them any old way. So now you can.

This bug showed up in imSim when doOpt=True. The workaround was to put the psfs in photon_ops, as I mentioned above. cf. https://github.com/LSSTDESC/imSim/pull/410