static int checkShad (Hdr *phdr, WF3Info *wf32d, int *missing, int *nsteps) { /* arguments: Hdr *phdr i: primary header WF3Info *wf32d i: switches, file names, etc int *missing io: incremented if the file is missing int *nsteps io: incremented if this step can be performed */ extern int status; int calswitch; int GetSwitch (Hdr *, char *, int *); int GetImageRef (RefFileInfo *, Hdr *, char *, RefImage *, int *); void MissingFile (char *, char *, int *); void CheckImgType (RefImage *, char *, char *, int *); int CheckDetector (char *, int, char *, int *); if (wf32d->shadcorr == PERFORM) { if (GetSwitch (phdr, "SHADCORR", &calswitch)) return (status); if (calswitch == COMPLETE) { wf32d->shadcorr = OMIT; return (status); } if (GetImageRef (wf32d->refnames, phdr, "SHADFILE", &wf32d->shad, &wf32d->shadcorr)) return (status); if (wf32d->shad.exists != EXISTS_YES) { MissingFile ("SHADFILE", wf32d->shad.name, missing); } else { /* Is the FILETYPE appropriate for a SHAD file? */ CheckImgType (&wf32d->shad, "SHUTTER SHADING", "SHADFILE", missing); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->shad.name, wf32d->detector, "DETECTOR", missing)) return (status); } if (wf32d->shadcorr == PERFORM) (*nsteps)++; } return (status); }
static int checkDQI (Hdr *phdr, WF3Info *wf32d, int *missing, int *nsteps) { /* arguments: Hdr *phdr i: primary header WF3Info *wf32d i: switches, file names, etc int *missing io: incremented if the table is missing int *nsteps io: incremented if this step can be performed */ extern int status; int GotFileName (char *); int GetTabRef (RefFileInfo *, Hdr *, char *, RefTab *, int *); void MissingFile (char *, char *, int *); void CheckTabType (RefTab *, char *, char *, int *); int CheckDetector (char *, int, char *, int *); if (wf32d->dqicorr == PERFORM) { if (GetTabRef (wf32d->refnames, phdr, "BPIXTAB", &wf32d->bpix, &wf32d->dqicorr)) return (status); if (wf32d->bpix.exists != EXISTS_YES) { if (wf32d->detector == IR_DETECTOR || GotFileName (wf32d->bpix.name)) { MissingFile ("BPIXTAB", wf32d->bpix.name, missing); } } else { /* Is the FILETYPE appropriate for a BPIX table? */ CheckTabType (&wf32d->bpix, "BAD PIXELS", "BPIXTAB", missing); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->bpix.name, wf32d->detector, "DETECTOR", missing)) return (status); } if (wf32d->dqicorr == PERFORM) (*nsteps)++; } return (status); }
static int checkCCD (Hdr *phdr, WF3Info *wf32d, int *missing) { /* arguments: Hdr *phdr i: primary header WF3Info *wf32d i: switches, file names, etc int *missing io: incremented if the table is missing */ extern int status; int calswitch; /* returned by GetTabRef and ignored */ int GetTabRef (RefFileInfo *, Hdr *, char *, RefTab *, int *); void MissingFile (char *, char *, int *); void CheckTabType (RefTab *, char *, char *, int *); int CheckDetector (char *, int, char *, int *); if (GetTabRef (wf32d->refnames, phdr, "CCDTAB", &wf32d->ccdpar, &calswitch)) return (status); if (wf32d->ccdpar.exists != EXISTS_YES) { MissingFile ("CCDTAB", wf32d->ccdpar.name, missing); } else if (wf32d->ccdpar.goodPedigree != GOOD_PEDIGREE) { (*missing)++; sprintf (MsgText, "CCDTAB `%s' is a dummy table.", wf32d->ccdpar.name); trlerror (MsgText); } else { /* Is the FILETYPE appropriate for a CCD table? */ CheckTabType (&wf32d->ccdpar, "CCD PARAMETERS", "CCDTAB", missing); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->ccdpar.name, wf32d->detector, "DETECTOR", missing)) return (status); } return (status); }
/* The main function */ int main( int argc, char *argv[] ) { static LALStatus status; int code; /* LALFrDetector testFrDetector = {"Test Site", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, LAL_PI_2 }; LALFrDetector lhoFrDetector = {"LIGO Hanford Observatory", -119.40765714, 46.4551467, 142.544, -6.195e-4, 2.199104, 1.25e-5, 3.769901 }; LALFrDetector lloFrDetector = {"LIGO Livingston Observatory", -90.77424039, 30.56289433, -6.574, -3.121e-4, 3.4508039, -6.107e-4, 5.021600 }; */ /* LALDetector testDetector = { { 4510094.634714941322397L, 4510094.634714941322397L, 0.0L }, { { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 } }, LALDETECTORTYPE_IFODIFF, { "Test Interferometer", 45.0L, 0.0L, 100.0, 0.0, 0.0, 0.0, 0.0 } }; = { { 4517590.8789357600195508L, 0.0L, 4487348.40860601410662157L }, { { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 } }, LALDETECTORTYPE_IFODIFF, { "Test Interferometer", 0.0L, 45.0L, 0.0, 0.0, 0.0, 0.0, 0.0 } }; */ LALDetector cachedDetector; ParseOptions( argc, argv ); printf("Checking LHO...\n"); cachedDetector = lalCachedDetectors[LALDetectorIndexLHODIFF]; if ( ( code = CheckDetector( &status, &cachedDetector ) ) ) { return code; } printf("Checking LLO...\n"); cachedDetector = lalCachedDetectors[LALDetectorIndexLLODIFF]; if ( ( code = CheckDetector( &status, &cachedDetector ) ) ) { return code; } printf("Checking VIRGO...\n"); cachedDetector = lalCachedDetectors[LALDetectorIndexVIRGODIFF]; if ( ( code = CheckDetector( &status, &cachedDetector ) ) ) { return code; } printf("Checking GEO600...\n"); cachedDetector = lalCachedDetectors[LALDetectorIndexGEO600DIFF]; if ( ( code = CheckDetector( &status, &cachedDetector ) ) ) { return code; } printf("Checking TAMA300...\n"); cachedDetector = lalCachedDetectors[LALDetectorIndexTAMA300DIFF]; if ( ( code = CheckDetector( &status, &cachedDetector ) ) ) { return code; } printf("Checking CIT40...\n"); cachedDetector = lalCachedDetectors[LALDetectorIndexCIT40DIFF]; if ( ( code = CheckDetector( &status, &cachedDetector ) ) ) { return code; } /* printf("Checking trivial detector...\n"); if ( code = CheckDetector( &status, &testDetector ) ) { return code; } */ /* PrintLALDetector(&lalCachedDetector[LALDetectorIndexLHODIFF]); PrintLALDetector(&lalCachedDetector[LALDetectorIndexLLODIFF]); LALCreateDetector( &status, &lalDetector, &testFrDetector, &type ); PrintLALDetector( &lalDetector ); LALCreateDetector( &status, &lalDetector, &lloFrDetector, &type ); PrintLALDetector( &lalDetector ); LALCreateDetector( &status, &lalDetector, &lhoFrDetector, &type ); PrintLALDetector( &lalDetector ); printf("%15g %15g %15g\n\n", lalDetector.location[0], lalDetector.location[1], lalDetector.location[2]); for (i=0; i<3; ++i) { printf("%15g %15g %15g\n", lalDetector.response[i][0], lalDetector.response[i][1], lalDetector.response[i][2]); } */ LALCheckMemoryLeaks(); printf("PASS: All tests\n"); return DETECTORSITETESTC_ENOM; }
static int checkFlat (Hdr *phdr, WF3Info *wf32d, int *missing, int *nsteps) { /* arguments: Hdr *phdr i: primary header WF3Info *wf32d i: switches, file names, etc int *missing io: incremented if a file is missing int *nsteps io: incremented if this step can be performed */ extern int status; int calswitch; int GetSwitch (Hdr *, char *, int *); int GotFileName (char *); int GetImageRef (RefFileInfo *, Hdr *, char *, RefImage *, int *); void MissingFile (char *, char *, int *); void CheckImgType (RefImage *, char *, char *, int *); int CheckFilter (char *, char *, char *, int *); int CheckDetector (char *, int, char *, int *); /* Are we supposed to do this step? */ if (wf32d->flatcorr == PERFORM) { if (GetSwitch (phdr, "FLATCORR", &calswitch)) return (status); if (calswitch == COMPLETE) { wf32d->flatcorr = OMIT; return (status); } /* Initial values; may be reset below. */ wf32d->pfltcorr = PERFORM; wf32d->dfltcorr = PERFORM; wf32d->lfltcorr = PERFORM; if (GetImageRef (wf32d->refnames, phdr, "PFLTFILE", &wf32d->pflt, &wf32d->pfltcorr)) return (status); if (wf32d->pflt.exists != EXISTS_YES) { if (GotFileName (wf32d->pflt.name)) { /* name specified? */ MissingFile ("PFLTFILE", wf32d->pflt.name, missing); } else { wf32d->pfltcorr = OMIT; /* name was blank or "N/A" */ } } else { /* Is the FILETYPE appropriate for a PFLT file? */ CheckImgType (&wf32d->pflt, "PIXEL-TO-PIXEL FLAT", "PFLTFILE", missing); /* Does it have the correct FILTER value? */ if (CheckFilter(wf32d->pflt.name, wf32d->filter, "FILTER", missing)) return (status); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->pflt.name, wf32d->detector, "DETECTOR", missing)) return (status); } if (GetImageRef (wf32d->refnames, phdr, "DFLTFILE", &wf32d->dflt, &wf32d->dfltcorr)) return (status); if (wf32d->dflt.exists != EXISTS_YES) { if (GotFileName (wf32d->dflt.name)) { MissingFile ("DFLTFILE", wf32d->dflt.name, missing); } else { wf32d->dfltcorr = OMIT; } } else { /* Is the FILETYPE appropriate for a DFLT file? */ CheckImgType (&wf32d->dflt, "DELTA FLAT", "DFLTFILE", missing); /* Does it have the correct FILTER value? */ if (CheckFilter(wf32d->dflt.name, wf32d->filter, "FILTER", missing)) return (status); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->dflt.name, wf32d->detector, "DETECTOR", missing)) return (status); } if (GetImageRef (wf32d->refnames, phdr, "LFLTFILE", &wf32d->lflt, &wf32d->lfltcorr)) return (status); if (wf32d->lflt.exists != EXISTS_YES) { if (GotFileName (wf32d->lflt.name)) { MissingFile ("LFLTFILE", wf32d->lflt.name, missing); } else { wf32d->lfltcorr = OMIT; } } else { /* Is the FILETYPE appropriate for a LFLT file? */ CheckImgType (&wf32d->lflt, "LARGE SCALE FLAT", "LFLTFILE", missing); /* Does it have the correct FILTER value? */ if (CheckFilter(wf32d->lflt.name, wf32d->filter, "FILTER", missing)) return (status); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->lflt.name, wf32d->detector, "DETECTOR", missing)) return (status); } /* If any of the three parts of flat fielding is set to PERFORM, then we can do this step. If not, and if any part is DUMMY because of the reference file, reset the flat field flag to DUMMY; this will mean that all the files that were specified have pedigree=dummy. */ if (wf32d->pfltcorr == PERFORM || wf32d->dfltcorr == PERFORM || wf32d->lfltcorr == PERFORM) { (*nsteps)++; } else if (wf32d->pfltcorr == OMIT && wf32d->dfltcorr == OMIT && wf32d->lfltcorr == OMIT) { (*missing)++; trlerror ("PFLTFILE, DFLTFILE, and LFLTFILE are all blank."); } else if (wf32d->pfltcorr == DUMMY || wf32d->dfltcorr == DUMMY || wf32d->lfltcorr == DUMMY) { wf32d->flatcorr = DUMMY; } } return (status); }
static int checkDark (Hdr *phdr, WF3Info *wf32d, int *missing, int *nsteps) { /* arguments: Hdr *phdr i: primary header WF3Info *wf32d i: switches, file names, etc int *missing io: incremented if the file is missing int *nsteps io: incremented if this step can be performed */ extern int status; int calswitch; int GetSwitch (Hdr *, char *, int *); int GetImageRef (RefFileInfo *, Hdr *, char *, RefImage *, int *); void MissingFile (char *, char *, int *); void CheckImgType (RefImage *, char *, char *, int *); int CheckDetector (char *, int, char *, int *); char *darktouse; char *darktype; if (wf32d->darkcorr == PERFORM) { if (GetSwitch (phdr, "DARKCORR", &calswitch)) return (status); if (calswitch == COMPLETE) { wf32d->darkcorr = OMIT; return (status); } else { if (GetSwitch (phdr, "PCTECORR", &calswitch)) return(status); if (calswitch == COMPLETE){ darktouse="DRKCFILE"; darktype="CTEDARK"; } else { darktouse="DARKFILE"; darktype="DARK"; } } if (GetImageRef (wf32d->refnames, phdr, darktouse, &wf32d->dark, &wf32d->darkcorr)) return (status); if (wf32d->dark.exists != EXISTS_YES) { MissingFile (darktouse, wf32d->dark.name, missing); } else { /* Is the FILETYPE appropriate for a DARK file? */ CheckImgType (&wf32d->dark, darktype, darktouse, missing); /* Does it have the correct DETECTOR value? */ if (CheckDetector(wf32d->dark.name, wf32d->detector, "DETECTOR", missing)) return (status); } if (wf32d->darkcorr == PERFORM) (*nsteps)++; } return (status); }