Closed jchiang87 closed 3 months ago
Looking through imsim-config.yaml, I see:
output.camera: LsstCam
output.readout.bias_levels_file: LSSTCam_bias_levels_run_13421.json
input.vignetting.file_name: LSSTCam_vignetting_data.json
input.telescope.file_name: $f"LSST_{band}.yaml"
and potentially stuff like
output.nfiles: 189 # 9 for comcam
Some ideas on how to handle:
In galsim-config-language something like:
input.telescope.file_name: $ f"LSST_{band}.yaml" if @output.cameraName == 'LsstCam' else f"ComCam_{band}.yaml"
though that doesn't really scale past 2 cameras (maybe that's enough?).
Or, in imsim-config.yaml at least, shove all the camera-dependent stuff into various eval_variables
and have one section uncommented for ComCam and another for LsstCam:
eval_variables:
sband: r
# For LSSTCam
scameraName: LsstCam
sopticsFileName: LSST_{band}.yaml
inumdet: 189
# # For ComCam
# scameraName: LsstComCamSim
# sopticsFileName: ComCam_{band}.yaml
# inumdet: 9
That keeps everything related to the camera choice localized at least.
Or there's the approach in https://github.com/LSSTDESC/imSim/blob/main/devel-tools/vignetting/imsim-vignetting.yaml where I made a boolean config variable and used a bunch of $ ... if IsComCam else ...
lower in the config.
I think this makes for an uglier config, but does have the advantage that you can easily swap the camera on the command line, e.g.: galsim blah.yaml eval_variables.bIsComCam=True
.
Haven't experimented, but you might be able to combine 2&3 with some kind of dictionary...
eval_variables:
sband: r
bIsComCam: False
camera_vars: |
dict( |
cameraName='LsstCam',
opticsFileName=f'LSST_{band}.yaml',
numdet=189 |
) if not IsComCam else |
dict( |
cameraName='LsstComCamSim',
opticsFileName=f'ComCam_{band}.yaml',
numdet=9 |
)
...
input:
telescope:
filename: $camera_vars['opticsFileName']
I was thinking we could have an Instrument
class that serves a similar purpose as the OpsimData
class in that all of the relevant info would be gathered in one place for other code to find what's needed. Doing this entirely with config-level manipulations seems confusing (to me at least) and error-prone.
A simpler approach would be to have per instrument yaml configs that just set the options relevant for each particular camera. One could then just include the config file for the desired camera, though it's not clear to me that the yaml-handling code we have is able to support this.
closed by #456
Currently, to switch from
LsstCam
toLsstComCamSim
, (at least?) three entries in the yaml config need to be changed:obs_lsst
:These can all be set independently to inconsistent values and simulations will run to completion without any warnings (though an info message regarding the tree rings file used will be emitted).
It would be great if all of this could be handled with a single config parameter, i.e.,