gbrammer / grizli

Grizli: The "Grism redshift and line" analysis software
MIT License
69 stars 51 forks source link

Use environ context for tweak align #260

Open TheSkyentist opened 2 weeks ago

TheSkyentist commented 2 weeks ago

During tweak align, grizli uses a hard-coded CRDS context to apply a photom correction. However, this is quite an old context, and if the CRDS folder is write only (as it is in shared environments), it will cause a failure. As this doesn't affect the final output (only used to compute the tweak shifts) I have added in a check to use the environment context value if it exists.

PJ-Watson commented 2 weeks ago

This isn't the only place that I've noticed the CRDS is essentially hard-coded - it also appears as a default parameter in get_crds_zeropoint() (although this seems to be a redundant function), and in aws.visit_processor.cutout_mosaic() (which itself also calls utils.drizzle_from_visit()). The latter function is a bit of a problem, as the context parameter isn't passed through or checked when using prep.iterate_tweak_align(). I can always submit a separate pull request though if that's easier!

TheSkyentist commented 2 weeks ago

Yes, this is mostly to handle when utils.drizzle_from_visit() is called. Though I agree that it would be better to try and fix it by passing it through at the high level for both cutout_mosaic and iterate_tweak_align, so feel free to open a new PR that handles this better. I'm not sure where get_crds_zeropoint gets used, so perhaps its okay to leave that for later.