diff options
author | Nadia Dencheva <nadia.dencheva@gmail.com> | 2016-12-15 16:58:28 -0500 |
---|---|---|
committer | Nadia Dencheva <nadia.dencheva@gmail.com> | 2016-12-15 16:58:28 -0500 |
commit | 4b46410a60318138892d9726eb2f472f619d425d (patch) | |
tree | 0a04dd2a1024b01948d83f8958dfe41afa9ae85b /stwcs/updatewcs | |
parent | a6eb705d7bcb11ae1951a9fef0c8256a49f5f52c (diff) | |
download | stwcs_hcf-4b46410a60318138892d9726eb2f472f619d425d.tar.gz |
Add tests
Diffstat (limited to 'stwcs/updatewcs')
-rw-r--r-- | stwcs/updatewcs/apply_corrections.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/stwcs/updatewcs/apply_corrections.py b/stwcs/updatewcs/apply_corrections.py index c554564..247dba0 100644 --- a/stwcs/updatewcs/apply_corrections.py +++ b/stwcs/updatewcs/apply_corrections.py @@ -212,6 +212,28 @@ def isOldStyleDGEO(fname, dgname): def apply_d2im_correction(fname, d2imcorr): + """ + Logic to decide whether to apply the D2IM correction. + + Parameters + ---------- + fname : str + Science file name. + d2imcorr : bool + Flag indicating if D2IM is should be enabled if allowed. + + Return + ------ + applyD2IMCorr : bool + Flag whether to apply the correction. + + The D2IM correction is applied to a science file if it is in the + allowed corrections for the instrument. The name of the file + with the correction is saved in the ``D2IMFILE`` keyword in the + primary header. When the correction is applied the name of the + file is saved in the ``D2IMEXT`` keyword in the 1st extension header. + + """ applyD2IMCorr = True if not d2imcorr: logger.info("D2IM correction not requested - not applying it.") @@ -221,7 +243,7 @@ def apply_d2im_correction(fname, d2imcorr): fd2im0 = fits.getval(fname, 'D2IMFILE') except KeyError: logger.info("D2IMFILE keyword is missing - D2IM correction will not be applied.") - + return False if fd2im0 == 'N/A': utils.remove_distortion(fname, "D2IMFILE") return False |