From 9b4d92100db08c9f686df9eab978c41b8f59d286 Mon Sep 17 00:00:00 2001 From: mdlpstsci Date: Wed, 12 Jan 2022 08:56:59 -0500 Subject: [PATCH] Fixed a bug which was triggered ONLY when executing the condaforge (#560) distribution on MacOS where failure was due to a missing return statement. Only call computeDarktime() once to compute the updated DARKTIME primary keyword and function return is now void. Update the keyword in main to avoid passing extra data by reference. --- pkg/acs/calacs/Dates | 5 +++ pkg/acs/calacs/History | 7 +++++ pkg/acs/calacs/Updates | 7 +++++ pkg/acs/calacs/acsccd/doccd.c | 49 ++++++++++++++--------------- pkg/acs/calacs/include/acsversion.h | 4 +-- 5 files changed, 45 insertions(+), 27 deletions(-) diff --git a/pkg/acs/calacs/Dates b/pkg/acs/calacs/Dates index 1ef0fcf8..e3a3c90e 100644 --- a/pkg/acs/calacs/Dates +++ b/pkg/acs/calacs/Dates @@ -1,3 +1,8 @@ + 11-Jan-2022 CALACS 10.3.4 Fixed a bug which was triggered ONLY when executing the condaforge + distribution on MacOS where failure was due to a missing return statement. + Only call computeDarktime() once to compute the updated + DARKTIME primary keyword and function return is now void. Update + the keyword in main to avoid passing extra data by reference. 24-May-2021 CALACS 10.3.3 Fixed a bug associated with the FLASHDUR computation. The FLASHDUR keyword was updated in the CRJ/CRC headers to be the sum of the individual input images as this keyword is used in ACS2D to diff --git a/pkg/acs/calacs/History b/pkg/acs/calacs/History index 8e377327..a8cd545a 100644 --- a/pkg/acs/calacs/History +++ b/pkg/acs/calacs/History @@ -1,3 +1,10 @@ +### 11-Jan-2022 - MDD - Version 10.3.4 + Fixed a bug which was triggered ONLY when executing the condaforge + distribution on MacOS where failure was due to a missing return + statement. Only call computeDarktime() once to compute the updated + DARKTIME primary keyword and function return is now void. Update + the keyword in main to avoid passing extra data by reference. + ### 24-May-2021 - MDD - Version 10.3.3 Fixed a bug associated with the FLASHDUR computation. The FLASHDUR keyword was updated in the CRJ/CRC headers to be the sum of diff --git a/pkg/acs/calacs/Updates b/pkg/acs/calacs/Updates index 4acaa5db..67aff207 100644 --- a/pkg/acs/calacs/Updates +++ b/pkg/acs/calacs/Updates @@ -1,3 +1,10 @@ +Update for version 10.3.4 - 11-Jan-2022 (MDD) + pkg/acs/calacs/Dates + pkg/acs/calacs/History + pkg/acs/calacs/Updates + pkg/acs/calacs/acsccd/doccd.c + pkg/acs/calacs/include/acsversion.h + Update for version 10.3.3 - 24-May-2021 (MDD) pkg/acs/calacs/Dates pkg/acs/calacs/History diff --git a/pkg/acs/calacs/acsccd/doccd.c b/pkg/acs/calacs/acsccd/doccd.c index 8a2b0d46..085c1950 100644 --- a/pkg/acs/calacs/acsccd/doccd.c +++ b/pkg/acs/calacs/acsccd/doccd.c @@ -25,6 +25,11 @@ circumstances. The offset values is applicable for WFC and HRC only. The code was moved from acs2d/dodark.c which contained the original implementation. + 11-Jan-2022 MDD: Only call computeDarktime() once to compute the updated + DARKTIME primary keyword. Update the keyword in main to avoid passing + of the reference of the output data unnecessarily. Return type of the + computeDarktime() is void. Mods triggered by routine failing under the + condaforge compilation. ** This code is a trimmed down version of CALSTIS1 do2d.c. */ @@ -87,7 +92,7 @@ int DoCCD (ACSInfo *acs_info) { char buff[ACS_FITS_REC+1]; int to_electrons(ACSInfo *, SingleGroup *); - int computeDarktime(ACSInfo *, SingleGroup *); + void computeDarktime(ACSInfo *, float *); int doBias (ACSInfo *, SingleGroup *); int biasHistory (ACSInfo *, Hdr *); int doBlev (ACSInfo *, SingleGroup *, int, float *, int *, int *); @@ -708,13 +713,15 @@ int DoCCD (ACSInfo *acs_info) { /************************************************************************/ /* Compute the DARKTIME */ - {unsigned int i; - for (i = 0; i < acs_info->nimsets; i++) { - if (computeDarktime(&acs[i], &x[i])) { - freeOnExit (&ptrReg); - return (status); - } - }} + float darktime = 0.0; /* final darktime value after applicable offset, if any */ + + /* Only need to invoke once as the needed keywords are inherited from + the primary, and the DARKTIME applies to all imsets */ + computeDarktime(&acs[0], &darktime); + if (PutKeyFlt(x[0].globalhdr, "DARKTIME", darktime, "")) { + freeOnExit (&ptrReg); + return (status); + } /************************************************************************/ /************************************************************************/ @@ -922,16 +929,13 @@ int DoCCD (ACSInfo *acs_info) { } /* - * This routine updates the DARKTIME keyword such that every BLV_TMP file will - * have the correct DARKTIME value. + * This routine updates the DARKTIME value such that every BLV_TMP file will + * have the correct DARKTIME keyword. */ -int computeDarktime(ACSInfo *acs, SingleGroup *x) { +void computeDarktime(ACSInfo *acs, float *darktime) { float darktimeFromHeader; /* base darktime value from FITS keyword DARKTIME in image header */ float darktimeOffset; /* overhead offset time (s) based upon full-frame/subarray and post-flashed/unflashed */ - float darktime; /* final darktime value after applicable offset, if any */ - - int PutKeyFlt (Hdr *, char *, float, char *); /* Get the DARKTIME FITS keyword value stored in the ACSInfo structure */ darktimeFromHeader = (float)acs->darktime; @@ -961,14 +965,14 @@ int computeDarktime(ACSInfo *acs, SingleGroup *x) { Effectively the additive factor only applies to ACS/WFC as the HRC was no longer operational by SM4MJD or CYCLE24, and SBC is a MAMA detector. */ - darktime = darktimeFromHeader; /* Default */ + *darktime = darktimeFromHeader; /* Default */ /* Full-frame data */ if (acs->subarray == NO) { if (acs->expstart >= SM4MJD) { - darktime = darktimeFromHeader + darktimeOffset; + *darktime = darktimeFromHeader + darktimeOffset; } - sprintf(MsgText, "Full Frame adjusted Darktime: %f\n", darktime); + sprintf(MsgText, "Full Frame adjusted Darktime: %f\n", *darktime); trlmessage(MsgText); /* Subarray data */ @@ -976,20 +980,15 @@ int computeDarktime(ACSInfo *acs, SingleGroup *x) { if (acs->expstart >= CYCLE24) { for (unsigned int i = 0; i < numSupportedDarkSubApertures; i++) { if (strcmp(acs->aperture, darkSubApertures[i]) == 0) { - darktime = darktimeFromHeader + darktimeOffset; - sprintf(MsgText, "Supported Subarray adjusted Darktime: %f for aperture: %s\n", darktime, darkSubApertures[i]); + *darktime = darktimeFromHeader + darktimeOffset; + sprintf(MsgText, "Supported Subarray adjusted Darktime: %f for aperture: %s\n", *darktime, darkSubApertures[i]); trlmessage(MsgText); break; } } } } - sprintf(MsgText, "DARKTIME from SCI header: %f Offset from CCDTAB: %f Final DARKTIME: %f", darktimeFromHeader, darktimeOffset, darktime); - trlmessage(MsgText); - - (void) PutKeyFlt(x->globalhdr, "DARKTIME", darktime, ""); - - sprintf(MsgText, "Updated DARKTIME %f.", darktime); + sprintf(MsgText, "DARKTIME from SCI header: %f Offset from CCDTAB: %f Final DARKTIME: %f", darktimeFromHeader, darktimeOffset, *darktime); trlmessage(MsgText); } diff --git a/pkg/acs/calacs/include/acsversion.h b/pkg/acs/calacs/include/acsversion.h index fbb6d50d..671c83c3 100644 --- a/pkg/acs/calacs/include/acsversion.h +++ b/pkg/acs/calacs/include/acsversion.h @@ -2,8 +2,8 @@ #define INCL_ACSVERSION_H /* This string is written to the output primary header as CAL_VER. */ -#define ACS_CAL_VER "10.3.3 (24-May-2021)" -#define ACS_CAL_VER_NUM "10.3.3" +#define ACS_CAL_VER "10.3.4 (11-Jan-2022)" +#define ACS_CAL_VER_NUM "10.3.4" /* name and version number of the CTE correction algorithm */ #define ACS_GEN1_CTE_NAME "PixelCTE 2012"