Skip to content

Commit

Permalink
Updates during 2015_3 HSTDP testing
Browse files Browse the repository at this point in the history
    - Updates to try and fix trailer file output information. Part of the problem is the change in name of the output RAC_TMP file, the functions which create input and output trailer file naming conventions look for the dot to separate extensions so I need to change some expectations. But in addition the association trailers are not being fully concatinated
    - Update to check for the raw header value of PCTENSMD and update the cte parameter table accordingly (though only a value of 0 is valid right now)



git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/hstcal/trunk@48457 fe389314-cf27-0410-b35b-8c050e845b92
  • Loading branch information
sosey committed Jan 19, 2016
1 parent d6b6bdc commit bde92d0
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 43 deletions.
7 changes: 7 additions & 0 deletions pkg/wfc3/calwf3/Dates
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
19-Jan-2016 - MLS -- Version 3.3
- Updates to fix trailer file output information. Part of the problem is the change in name of the output RAC_TMP file, the functions which create input and output trailer file naming conventions look for the dot to separate extensions so I need to change some expectations.
- Update to check for the raw header value of PCTENSMD and update the cte parameter table accordingly (though only a value of 0 is valid right now)

08-Jan-2016 - MLS -- Version 3.3
- changed the name of the output rac file to rac_tmp so that archive could handle deleting it better

05-Nov-2015 - MLS -- Version 3.3
- removed explicit downcasts and added calloc returns in procccd

Expand Down
7 changes: 7 additions & 0 deletions pkg/wfc3/calwf3/History
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### 19-Jan-2016 MLS -- Version 3.3
- Updates to fix trailer file output information. Part of the problem is the change in name of the output RAC_TMP file, the functions which create input and output trailer file naming conventions look for the dot to separate extensions so I need to change some expectations.
- Update to check for the raw header value of PCTENSMD and update the cte parameter table accordingly (though only a value of 0 is valid right now)

### 08-Jan-2016 MLS -- Version 3.3
- changed the name of the output rac file to rac_tmp so that archive could handle deleting it better

### 05-Nov-2015 MLS -- Version 3.3
- removed explicit downcasts and added calloc returns in procccd

Expand Down
7 changes: 7 additions & 0 deletions pkg/wfc3/calwf3/Updates
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Updates for Version 3.3 19-Jan-2016 MLS
- Updates to fix trailer file output information. Part of the problem is the change in name of the output RAC_TMP file, the functions which create input and output trailer file naming conventions look for the dot to separate extensions so I need to change some expectations.
- Update to check for the raw header value of PCTENSMD and update the cte parameter table accordingly (though only a value of 0 is valid right now)

Updates for Version 3.3 08-Jan-2016 MLS
- changed the name of the output rac file to rac_tmp so that archive could handle deleting it better

Updates for Version 3.3 05-Nov-2015 MLS
- removed explicit downcasts and added calloc returns in procccd

Expand Down
2 changes: 1 addition & 1 deletion pkg/wfc3/calwf3/calwf3/calwf3.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ int CalWf3Run (char *input, int printtime, int save_tmp, int verbose, int debug,

for (prod = 0; prod < asn.numprod; prod++) {
wf3dth_input = BuildDthInput (&asn, prod, suffix_flt);
printf("\n\nwf3dth_inpt is %s\n\n",wf3dth_input);

/* Skip this product if the input list is empty */
if (wf3dth_input == NULL) {
Expand Down Expand Up @@ -406,7 +407,6 @@ char* BuildDthInput (AsnInfo *asn, int prod, char *suffix_name) {
strcat(wf3dth_input, ",");
}
}

return(wf3dth_input);
}

Expand Down
42 changes: 21 additions & 21 deletions pkg/wfc3/calwf3/calwf3/procccd.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
M. Sosey, 2015: fixed some logic associated with crcorr processing and
removing the tmp files
M. Sosey 2016: updated the trailer file concatination; the trailer files for
association files are not being concatinated correctly.
*/

Expand Down Expand Up @@ -235,6 +238,13 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int

}

/* COPY ALL MESSAGES UP TO HERE INTO PREFACE BUFFER
TO BE PREPENDED TO ALL INPUT FILE TRAILER FILES */
if (newpreface == YES) {
InitTrlPreface();
}
SetTrlPrefaceMode (YES);

if (wf3hdr->sci_basic_cte == PERFORM ) {

/*correct for CTE issues and THEN complete the calibration
Expand Down Expand Up @@ -262,13 +272,6 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int

/* THIS IS CALWF3CCD; NOTE WE USE WF3CCD_SCI_SW. */

/* COPY ALL MESSAGES UP TO HERE INTO PREFACE BUFFER
** TO BE PREPENDED TO ALL INPUT FILE TRAILER FILES */
if (newpreface == YES) {
InitTrlPreface();
}
SetTrlPrefaceMode (YES);

/*DO WF3CCD STUFF ON THE RAC IMAGE */
if (WF3ccd (wf3hdr->rac_tmp, wf3hdr->blc_tmp,
&wf3ccd_sci_sw, &sciref, printtime,
Expand Down Expand Up @@ -299,28 +302,20 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
strcat(wf3rej_cte_input, ",");
}

/* ALSO ADD BLC_TMP TO LIST OF FILES TO BE DELETED */
/* ALSO ADD BLC_TMP and RAC_TMP TO LIST OF FILES TO BE DELETED */
strcpy (asn->product[prod].subprod[posid].exp[expid].blc_tmp,
wf3hdr->blc_tmp);
strcpy (asn->product[prod].subprod[posid].exp[expid].rac_tmp,
wf3hdr->rac_tmp);

}

} /*END CTE PROCESSING TO BLC_TMP LEVEL*/


/*ALWAYS REPEAT THE PROCESS WITHOUT THE CTE CORRECTION SO BOTH ARE PRODUCED*/
if (wf3hdr->sci_basic_ccd == PERFORM) {

/*INITIALIZE THE TRAILER INFO IF CTE NOT PERFORMED*/
if (wf3hdr->sci_basic_cte == OMIT){

/* COPY ALL MESSAGES UP TO HERE INTO PREFACE BUFFER
TO BE PREPENDED TO ALL INPUT FILE TRAILER FILES */
if (newpreface == YES) {
InitTrlPreface();
}
SetTrlPrefaceMode (YES);
}


if (WF3ccd (wf3hdr->rawfile, wf3hdr->blv_tmp,
&wf3ccd_sci_sw, &sciref, printtime,
asn->verbose))
Expand Down Expand Up @@ -410,6 +405,10 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
}

}/* END EXPID LOOP OVER INDIVIDUAL EXPOSURES,GO ON TO CREATE PRODUCTS */

/* Reset the trailer file preface to NULL since
** it has already been copied into trailer files */
ResetTrlPreface();

/*** DO CRCORR/RPTCORR PROCESSING ***/
if (wf3hdr->sci_crcorr == PERFORM || wf3hdr->sci_rptcorr == PERFORM) {
Expand Down Expand Up @@ -580,7 +579,7 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
return (status);

if (wf3hdr->sci_basic_2d == PERFORM){
SetTrlPrefaceMode(YES);
SetTrlPrefaceMode(NO);

/* RESET SWITCHES*/
ResetCCDSw (&wf3ccd_sci_sw, &wf32d_sci_sw);
Expand Down Expand Up @@ -628,6 +627,7 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
if (*save_tmp == NO) {
for (expid=1; expid <= asn->spmems[posid]; expid++) {
remove (asn->product[prod].subprod[posid].exp[expid].blc_tmp);
remove (asn->product[prod].subprod[posid].exp[expid].rac_tmp);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/wfc3/calwf3/calwf3/wf3init.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
H.Bushouse, 2002-Nov-26: Removed use of sflfile (following CALACS changes).
H.Bushouse, 2008-Aug-20: Changed dithfile suffix from "dth" to "drz".
M. Sosey, 2015 June: Updates for CTE implementation with UVIS 2.0
M. Sosey, 2016 Jan: changed name of rac file to rac_tmp
*/

int CCDRefInit (WF3Info *wf3, CCD_Switch *sci_sw, RefFileInfo *sciref) {
Expand Down Expand Up @@ -155,10 +156,10 @@ int InsertWF3Suffix (WF3Info *wf3) {
if (MkName (wf3->crc_root, "_crc", "_crc_tmp", "", wf3->crc_tmp, SZ_LINE))
return (status);

if (MkName (wf3->rootname, "_raw","_rac","", wf3->rac_tmp, SZ_LINE))
if (MkName (wf3->rootname, "_raw","_rac_tmp","", wf3->rac_tmp, SZ_LINE))
return(status);

if (MkName (wf3->rootname, "_rac", "_blc_tmp", "", wf3->blc_tmp, SZ_LINE))
if (MkName (wf3->rootname, "_rac_tmp", "_blc_tmp", "", wf3->blc_tmp, SZ_LINE))
return (status);

if (MkName (wf3->rootname, "_raw", "_ima", "", wf3->imafile, SZ_LINE))
Expand Down
2 changes: 1 addition & 1 deletion pkg/wfc3/calwf3/include/wf3version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* This string is written to the output primary header as CAL_VER. */

# define WF3_CAL_VER "3.3(05-Nov-2015)"
# define WF3_CAL_VER "3.3(19-Jan-2016)"
# define WF3_CAL_VER_NUM "3.3"
19 changes: 19 additions & 0 deletions pkg/wfc3/calwf3/wf3cte/getctepars.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
MLS 2015: read in the CTE parameters from the PCTETAB file
Jan 19, 2016: MLS Updated to check for existence of PCTENSMD in
raw science header
*/

# include <time.h>
Expand Down Expand Up @@ -509,6 +512,13 @@ int CompareCTEParams(SingleGroup *group, CTEParams *pars) {
int n_forward;
int n_par;
int fix_rocr;
int noise_mit;

cte_len=0;
n_forward=0;
n_par=0;
fix_rocr=0;
noise_mit=0;


/*always put the cte_name and cte_ver from the reference file in*/
Expand Down Expand Up @@ -538,6 +548,15 @@ int CompareCTEParams(SingleGroup *group, CTEParams *pars) {
return (status=HEADER_PROBLEM);
}

/*check the PCTENSMD keyword in the header*/
if (GetKeyInt(group->globalhdr, "PCTENSMD", NO_DEFAULT, -999, &noise_mit)){
trlmessage("(pctecorr) Error reading PCTENSMD keyword from header");
return (status=HEADER_PROBLEM);
}
if (noise_mit != pars->noise_mit){
pars->noise_mit = noise_mit;
}

/*check the PCTEDIM keyword in header*/
if (GetKeyInt(group->globalhdr, "PCTETLEN", NO_DEFAULT, -999, &cte_len)) {
trlmessage("(pctecorr) Error reading PCTETLEN keyword from header");
Expand Down
3 changes: 2 additions & 1 deletion pkg/wfc3/calwf3/wf3cte/maincte.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ as you would wf3ccd or wf32d
MLS 2015
Jan 19, 2016: update name of output from _rac to _rac_tmp
*/

Expand Down Expand Up @@ -193,7 +194,7 @@ int main (int argc, char **argv) {

} else if (cte_sw.pctecorr) {

if (MkName (input, "_raw", "_rac", "", output, SZ_FNAME)) {
if (MkName (input, "_raw", "_rac_tmp", "", output, SZ_FNAME)) {
WhichError (status);
sprintf (MsgText, "Skipping %s, problem making output name", input);
trlmessage (MsgText);
Expand Down
65 changes: 48 additions & 17 deletions pkg/wfc3/calwf3/wf3cte/wf3cte.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
M. sosey Aug-2014 Adapted for the pipeline from Jay Andersons CTE correction code for wfc3 UVIS
raw2raz_wfc3uv.F , an edited file was delivered december 2014, and both are different from the
fortran code currently served on the wfc3 website.
*/

# include <time.h>
Expand Down Expand Up @@ -1270,22 +1270,53 @@ int initCTETrl (char *input, char *output) {
trl_out[0] = '\0';
exist = EXISTS_UNKNOWN;


if (MkName (output, "_rac", "", TRL_EXTN, trl_out, SZ_LINE)) {
WhichError (status);
sprintf (MsgText, "Couldn't create trailer filename for %s",
output);
trlmessage (MsgText);
}

/* Test whether the output file already exists */
exist = TrlExists(trl_out);
if (exist == EXISTS_YES) {
/* The output file exists, so we want to overwrite them with
** the new trailer comments. */
SetTrlOverwriteMode (YES);
}

/* Input and output suffixes. */
char *isuffix[] = {"_raw"};
char *osuffix[] = {"_rac_tmp"};
char *trlsuffix[] = {"_rac_tmp"};

int nsuffix = 1;


/* Start by stripping off suffix from input/output filenames */
if (MkOutName (input, isuffix, trlsuffix, nsuffix, trl_in, SZ_LINE)) {
WhichError (status);
sprintf (MsgText, "Couldn't determine trailer filename for %s",
input);
trlmessage (MsgText);
}
if (MkOutName (output, osuffix, trlsuffix, nsuffix, trl_out, SZ_LINE)) {
WhichError (status);
sprintf (MsgText, "Couldn't create trailer filename for %s",
output);
trlmessage (MsgText);
}

/* NOW, CONVERT TRAILER FILENAME EXTENSIONS FROM '.FITS' TO '.TRL' */

if (MkNewExtn (trl_in, TRL_EXTN) ) {
sprintf (MsgText, "Error with input trailer filename %s", trl_in);
trlerror (MsgText);
WhichError (status);
}
if (MkNewExtn (trl_out, TRL_EXTN) ) {
sprintf (MsgText, "Error with output trailer filename %s", trl_out);
trlerror (MsgText);
WhichError (status);
}

/* If we are working with a RAW file, then see if a TRL file
needs to be overwritten after the generic conversion comments. */
if (strstr(input, isuffix[0]) != NULL) {
/* Test whether the output file already exists */
exist = TrlExists(trl_out);
if (exist == EXISTS_YES) {
/* The output file exists, so we want to add to them
** the new trailer comments. */
SetTrlOverwriteMode (NO);
}
}

/* Sets up temp trailer file for output and copies input
** trailer file into it. */
InitTrlFile (trl_in, trl_out);
Expand Down

0 comments on commit bde92d0

Please sign in to comment.