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@48569 fe389314-cf27-0410-b35b-8c050e845b92
  • Loading branch information
sosey committed Jan 22, 2016
1 parent bde92d0 commit b49c5a7
Show file tree
Hide file tree
Showing 14 changed files with 1,537 additions and 1,441 deletions.
5 changes: 5 additions & 0 deletions pkg/wfc3/calwf3/Dates
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
22-Jan-2016 - MLS -- Version 3.3
- Noticed I missed renaming the crc file with the call to WF3DTH and was setting the input to the crj suffix, but also needed updates to GetAsnTable to include crc filename population for subproducts and sending the correct subproduct through processing, it was always using crj
- some code cleanup as I went
- trailer file concatination update, but it's still not entirely correct

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)
Expand Down
5 changes: 5 additions & 0 deletions pkg/wfc3/calwf3/History
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 22-Jan-2016 MLS -- Version 3.3
- Noticed I missed renaming the crc file with the call to WF3DTH and was setting the input to the crj suffix, but also needed updates to GetAsnTable to include crc filename population for subproducts and sending the correct subproduct through processing, it was always using crj
- some code cleanup as I went
- trailer file concatination update, but it's still not entirely correct

### 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)
Expand Down
5 changes: 5 additions & 0 deletions pkg/wfc3/calwf3/Updates
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Updates for Version 3.3 22-Jan-2016 MLS
- Noticed I missed renaming the crc file with the call to WF3DTH and was setting the input to the crj suffix, but also needed updates to GetAsnTable to include crc filename population for subproducts and sending the correct subproduct through processing, it was always using crj
- some code cleanup as I went
- trailer file concatination update, but it's still not entirely correct

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)
Expand Down
95 changes: 76 additions & 19 deletions pkg/wfc3/calwf3/calwf3/calwf3.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ int CalWf3Run (char *input, int printtime, int save_tmp, int verbose, int debug,
void InitDthTrl (const char *, char *);

/*because DTH had this hard coded and it varies with UVIS for CTE*/
char suffix_flt[]="_flt.fits";
char suffix_flt[]="_flt.fits";
char suffix_flc[]="_flc.fits";


/* Post error handler */
push_hstioerr (errchk);

Expand Down Expand Up @@ -236,16 +238,62 @@ int CalWf3Run (char *input, int printtime, int save_tmp, int verbose, int debug,

if (asn.process == FULL) {
if (asn.verbose) {
trlmessage ("CALWF3: Building DTH products....");
trlmessage ("CALWF3: Building DTH products for non-CTE data....");
}

/* For each DTH product in UVIS without CTE... */
printf("\nProcessing DTH for non-CTE data ...\n");

wf3dth_input=NULL;

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

/* Skip this product if the input list is empty */
if (wf3dth_input == NULL) {
printf("\nProduct %i input list empty, continuing..\n",prod);
continue;
}

/* We always want to create a final concatenated trailer file
** for the entire association whether there is a product or
** not. So we set up the trailer file based on the association
** file name itself. */

if (strcmp(asn.product[prod].prodname,"") != 0){
InitDthTrl(wf3dth_input,asn.product[prod].prodname);
} else {
InitDthTrl (wf3dth_input, asn.rootname);
}

/* Check if we have a PROD-DTH specified */
if (strcmp(asn.product[prod].prodname,"") != 0) {

if ((asn.dthcorr == PERFORM || asn.dthcorr == DUMMY)) {
if (Wf3Dth (wf3dth_input,
asn.product[prod].prodname, asn.dthcorr,
printtime, asn.verbose) )
return (status);

/* Pass posid=0 to indicate a PRODUCT is to
** be updated */
updateAsnTable(&asn, prod, NOPOSID);

} else {

trlwarn
("No DTH product name specified. No product created.");
/* status = WF3_OK; */
}
}

}

/* For each DTH product in UVIS WITH CTE... */
if (asn.verbose) {
trlmessage ("CALWF3: Building DTH products for CTE data....");
}

for (prod = 0; prod < asn.numprod; prod++) {
wf3dth_input = BuildDthInput (&asn, prod, suffix_flc);

/* Skip this product if the input list is empty */
if (wf3dth_input == NULL) {
printf("\nProduct %i input list empty, continuing..\n",prod);
Expand All @@ -256,7 +304,12 @@ int CalWf3Run (char *input, int printtime, int save_tmp, int verbose, int debug,
** for the entire association whether there is a product or
** not. So we set up the trailer file based on the association
** file name itself. */
InitDthTrl (wf3dth_input, asn.rootname);

if (strcmp(asn.product[prod].prodname,"") != 0){
InitDthTrl(wf3dth_input,asn.product[prod].prodname);
} else {
InitDthTrl (wf3dth_input, asn.rootname);
}

/* Check if we have a PROD-DTH specified */

Expand All @@ -281,10 +334,9 @@ int CalWf3Run (char *input, int printtime, int save_tmp, int verbose, int debug,
}

}

} /* End DTHCORR UVIS Processing */

} else { /*process the IR data*/
} else { /*PROCESS THE IR DATA*/
/* Add DTH processing for IR here... */
if (asn.process == FULL) {

Expand All @@ -294,7 +346,6 @@ 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);

/* Skip this product if the input list is empty */
if (wf3dth_input == NULL) {
printf("\nProduct %i input list empty, continuing..\n",prod);
Expand Down Expand Up @@ -331,10 +382,9 @@ int CalWf3Run (char *input, int printtime, int save_tmp, int verbose, int debug,

}

} /* End DTHCORR IR Processing */
}


}
} /* End DTHCORR IR Processing */

if (asn.verbose) {
trlmessage ("CALWF3: Finished processing product ");
Expand Down Expand Up @@ -386,20 +436,27 @@ char* BuildDthInput (AsnInfo *asn, int prod, char *suffix_name) {
** list of names from the individual asn members */
for (j=1; j <= asn->spmems[i]; j++) {
char *t = asn->product[prod].subprod[i].exp[j].name;

/* REALLOC FOR THE NEW STRING LENGTH + SOME EXTRA TO AVOID COUNTING CAREFULLY */
wf3dth_input = realloc( wf3dth_input, (strlen(wf3dth_input) + strlen(t) + strlen(suffix_name) + 10 ) );
strcat(wf3dth_input, t);
strcat(wf3dth_input, suffix_name);
strcat(wf3dth_input, suffix_name);
if (j < asn->spmems[i])
strcat(wf3dth_input, ",");
}

} else {
/* Otherwise just use the sub-product name */
char *t = asn->product[prod].subprod[i].spname;
wf3dth_input = realloc( wf3dth_input, (strlen(wf3dth_input) + strlen(t) + 10 ) );
strcat(wf3dth_input, t);

if (strcmp(suffix_name,"_flc.fits")){
char *t = asn->product[prod].subprod[i].spname;
wf3dth_input = realloc( wf3dth_input, (strlen(wf3dth_input) + strlen(t) + 10 ) );
strcat(wf3dth_input, t);
} else {
char *t = asn->product[prod].subprod[i].spname_cte;
wf3dth_input = realloc( wf3dth_input, (strlen(wf3dth_input) + strlen(t) + 10 ) );
strcat(wf3dth_input, t);
}

}

if (i < (asn->numsp)) {
Expand Down
11 changes: 7 additions & 4 deletions pkg/wfc3/calwf3/calwf3/procccd.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int




/* IF WE ARE NOT PERFORMING CRCORR OR RPTCORR, THEN
FINISH PROCESSING INDIVIDUAL FILES WITH WF32D. */

Expand Down Expand Up @@ -408,8 +407,8 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int

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

/*** DO CRCORR/RPTCORR PROCESSING ***/
if (wf3hdr->sci_crcorr == PERFORM || wf3hdr->sci_rptcorr == PERFORM) {

Expand Down Expand Up @@ -492,6 +491,8 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
** OTHERWISE. HAB 20-JUN-2004 */

wf3rej_msgtext = (char *) calloc(strlen(wf3rej_cte_input)+25,sizeof(char));
sprintf (wf3rej_msgtext, "%s", wf3rej_input);
trlmessage (wf3rej_msgtext);
free(wf3rej_msgtext);
}

Expand Down Expand Up @@ -530,6 +531,8 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
&wf32d_sci_sw, &sciref, printtime, asn->verbose))
return (status);

printf("\n**** wf3hdr->sci_basic_cte is %i *****\n\n",wf3hdr->sci_basic_cte);

if (wf3hdr->sci_basic_cte == PERFORM){
/* Flatfield the summed, cosmic ray rejected CTE image. */
if (WF32d (wf3hdr->crc_tmp, wf3hdr->crcfile,
Expand Down Expand Up @@ -579,7 +582,7 @@ int ProcessCCD (AsnInfo *asn, WF3Info *wf3hdr, int *save_tmp, int printtime, int
return (status);

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

/* RESET SWITCHES*/
ResetCCDSw (&wf3ccd_sci_sw, &wf32d_sci_sw);
Expand Down
4 changes: 3 additions & 1 deletion pkg/wfc3/calwf3/calwf3/wf3asn.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct {
Bool prsnt;
int asnrow; /* row from ASN table */
char expname[SZ_FNAME+1]; /* Full filenames for member EXP images */
char blv_tmp[SZ_FNAME+1]; /* BLV_TMP files to be deleted */
char blv_tmp[SZ_FNAME+1]; /* BLV_TMP files to be deleted */
char blc_tmp[SZ_FNAME+1]; /*BLC_TMP file to be deleted*/
char rac_tmp[SZ_FNAME+1]; /*RAC file to be deleted*/
float dx, dy;
Expand All @@ -60,6 +60,7 @@ typedef struct {
int numexp; /* # of EXP making this sub-product */
int posid; /* Numbering starts at 1 */
char spname[SZ_FNAME+1]; /* Full filename for sub-product */
char spname_cte[SZ_FNAME+1]; /* Full filename for sub-product */
char crj_tmp[SZ_FNAME+1]; /* CRJ_TMP file(s) to be deleted */
char crc_tmp[SZ_FNAME+1]; /*CRC_TMP file to be deleted*/
ExpInfo *exp; /* List of member EXP information */
Expand All @@ -73,6 +74,7 @@ typedef struct {
int numsp; /* # of sub-products making this product */
int prodid; /* Numbering starts at 0 */
char prodname[SZ_FNAME+1]; /* Full filename for final product */
char prodname_cte[SZ_FNAME+1]; /*Full filename for final product with CTE corrected data*/
SubProdInfo *subprod; /* List of member sub-product information */
} ProdInfo;

Expand Down
13 changes: 2 additions & 11 deletions pkg/wfc3/calwf3/calwf3/wf3member.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,8 @@ WF3Info *wf3 o: exposure specific flags and info
asn->product[prodid].subprod[posid].exp[expid].name);

strcpy (wf3->crj_root, asn->product[prodid].subprod[posid].spname);

if (wf3->sci_basic_cte == PERFORM){
/*replace spname which already has crj in it with crc*/
strcpy (wf3->crc_root, asn->product[prodid].subprod[posid].spname);
if (strstr(wf3->crc_root,"_crj")){
if (MkName (wf3->crc_root, "_crj", "_crc", "", wf3->crc_root, SZ_LINE)){
return (status);
}
}
}

strcpy (wf3->crc_root, asn->product[prodid].subprod[posid].spname_cte);


/* Make sure we are only passing a rootname, and not a full filename.*/
FindAsnRoot (wf3->rootname, rootname);
Expand Down
Loading

0 comments on commit b49c5a7

Please sign in to comment.