GalSim-developers / GalSim

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

Make inputs work if dependent on later input items #1239

Closed rmjarvis closed 1 year ago

rmjarvis commented 1 year ago

imSim has input types that depend on other input types. Most notably, many things implicitly depend on opsim_data, which is basically a dict with a bunch of values that things need. If the inputs are listed in order with dependencies first, everything is fine. But when using recursive templates, this can be difficult to get right. Currently, that causes the input items that are dependent on later ones not to load properly. The most critical of these is atm_psf, which needs to be loaded at the start to only build one set of atmospheric screens for all the CCDs to use. cf. https://github.com/LSSTDESC/imSim/pull/408

In this PR, when loading an input object, if it raises an exception that indicates it needs a different input type, it tries to load that one first before continuing on.