sweverett / Balrog-GalSim

Modules for GalSim that will be useful for DES images in conjunction with Balrog.
MIT License
5 stars 5 forks source link

Have injector grab fits HDU extension for initial image #44

Open sweverett opened 6 years ago

sweverett commented 6 years ago

@mcclearyj found the following error when using image files with the image not in HDU extension 0:

ValueError: WCS does not have longitude type of 'RA', therefore (ra, dec) data can not be returned

While GalSim natively can handle this case with ext : 1, for example, this doesn't currently propagate to injector.py. I believe the fix is simply to add the following to injector.AddOnImageBuilder.buildImage():

try:
    ext = config['wcs']['ext']
except KeyError:
    ext = 0
initial_image = galsim.fits.read(initial_image_name, hdu=ext)

@mcclearyj: Can you confirm that this solved your issue? Thanks!