# include # include "../acs.h" # include "../acsinfo.h" # include "../acscorr.h" /* calibration switch names */ /* These functions initialize values for the ACSInfo structure. The values set here are NOT default values, just initialization... Warren Hack, 1998 June 10: Initial ACS version. 24-Sep-1998 WJH - Removed BIAS_REJ as a keyword 7-Oct-1998 WJH - Added routines for getting RefImage and RefTab info 11-Sep-2000 WJH - Added support for post-FLASH processing step */ void ACSInit (ACSInfo *acs) { void InitRefTab (RefTab *tab); void InitRefImg (RefImage *img); /* Assign default values. */ acs->input[0] = '\0'; acs->output[0] = '\0'; acs->rootname[0] = '\0'; acs->printtime = 0; acs->verbose = 0; acs->det[0] = '\0'; acs->aperture[0] = '\0'; acs->filter1[0] = '\0'; acs->filter2[0] = '\0'; /* acs->obsmode[0] = '\0'; */ acs->detector = UNKNOWN_DETECTOR; acs->chip = 1; acs->ncombine = 1; acs->nimsets = 1; acs->exptime = 1.; acs->members = 1; acs->mtype[0] = '\0'; acs->sdqflags = MAX_DQ; /* 16 bits set */ acs->subarray = 0; acs->bin[0] = 1; acs->bin[1] = 1; acs->offsetx = 0.; acs->offsety = 0.; /* MAMA-specific info */ acs->global_limit = 0.; acs->tau = 0.; acs->local_limit = 0.; acs->expand = 0.; acs->globrate = 0.; acs->expstart = 0.; /* CCD-specific info */ acs->ccdamp[0] = '\0'; acs->ccdgain = 1; acs->ccdoffset[0] = 0; acs->ccdoffset[1] = 0; acs->ccdoffset[2] = 0; acs->ccdoffset[3] = 0; acs->binaxis[0] = 1; acs->binaxis[1] = 1; acs->ccdbias = 0.; acs->atodgain[0] = 0.; acs->atodgain[1] = 0.; acs->atodgain[2] = 0.; acs->atodgain[3] = 0.; acs->readnoise[0] = 0.; acs->readnoise[1] = 0.; acs->readnoise[2] = 0.; acs->readnoise[3] = 0.; acs->ampx = 0; acs->ampy = 0; acs->saturate = 0.; acs->trimx[0] = 0; acs->trimx[1] = 0; acs->trimy[0] = 0; acs->trimy[1] = 0; acs->vx[0] = 0; acs->vx[1] = 0; acs->vy[0] = 0; acs->vy[1] = 0; acs->biassecta[0] = 0; acs->biassecta[1] = 0; acs->biassectb[0] = 0; acs->biassectb[1] = 0; acs->flashdur = 0; acs->flashstatus[0] = '\0'; /* Initialize Calibration switches */ acs->dqicorr = OMIT; acs->atodcorr = OMIT; acs->blevcorr = OMIT; acs->biascorr = OMIT; acs->noisecorr = OMIT; acs->glincorr = OMIT; acs->lflgcorr = OMIT; acs->darkcorr = OMIT; acs->flatcorr = OMIT; acs->flashcorr = OMIT; acs->pfltcorr = OMIT; acs->dfltcorr = OMIT; acs->lfltcorr = OMIT; acs->shadcorr = OMIT; acs->photcorr = OMIT; acs->filtcorr = OMIT; acs->statcorr = OMIT; /* Initialize reference images and tables for ACSCCD */ InitRefImg (&(acs->bias)); InitRefImg (&(acs->flash)); InitRefTab (&(acs->bpix)); InitRefTab (&(acs->ccdpar)); InitRefTab (&(acs->oscn)); InitRefTab (&(acs->atod)); /* Initialize reference images and tables for ACS2D */ InitRefImg (&(acs->dark)); InitRefImg (&(acs->pflt)); InitRefImg (&(acs->dflt)); InitRefImg (&(acs->lflt)); InitRefImg (&(acs->shad)); InitRefTab (&(acs->mlin)); InitRefTab (&(acs->phot)); InitRefTab (&(acs->apertab)); } void InitRefTab (RefTab *tab) { tab->name[0] = '\0'; tab->pedigree[0] = '\0'; tab->descrip[0] = '\0'; tab->descrip2[0] = '\0'; tab->exists = EXISTS_UNKNOWN; tab->goodPedigree = PEDIGREE_UNKNOWN; } void InitRefImg (RefImage *img) { img->name[0] = '\0'; img->pedigree[0] = '\0'; img->descrip[0] = '\0'; img->exists = EXISTS_UNKNOWN; img->goodPedigree = PEDIGREE_UNKNOWN; } /* This routine gets the name of a reference image, checks whether it exists, and gets pedigree and descrip if they are present. The image name will be null if the keyword is not present in the header; this is not an error. */ int GetImageRef (RefFileInfo *refnames, Hdr *phdr, char *keyword, RefImage *image, int *calswitch) { extern int status; int GetRefName (RefFileInfo *, Hdr *, char *, char *); int ImgPedigree (RefImage *); /* Get the reference image name. */ if (GetRefName (refnames, phdr, keyword, image->name)) return (status); /* ImgPedigree opens the image to verify that it exists, and if so, gets pedigree & descrip. */ if (ImgPedigree (image)) return (status); if (image->exists == EXISTS_YES) { if (image->goodPedigree != GOOD_PEDIGREE) *calswitch = DUMMY; } return (status); } /* This routine gets the name of a reference table, checks whether it exists, and gets pedigree and descrip if they are present. The table name will be null if the keyword is not present in the header; this is not an error. */ int GetTabRef (RefFileInfo *refnames, Hdr *phdr, char *keyword, RefTab *table, int *calswitch) { extern int status; int GetRefName (RefFileInfo *, Hdr *, char *, char *); int TabPedigree (RefTab *); /* Get the reference table name. */ if (GetRefName (refnames, phdr, keyword, table->name)) return (status); /* TabPedigree opens the table to verify that it exists, and if so, gets pedigree & descrip. */ if (TabPedigree (table)) return (status); if (table->exists == EXISTS_YES) { if (table->goodPedigree != GOOD_PEDIGREE) *calswitch = DUMMY; } return (status); } void MissingFile (char *keyword, char *filename, int *missing) { sprintf (MsgText, "%s `%s' not found or can't open.", keyword, filename); trlerror (MsgText); (*missing)++; } void initSwitch (CalSwitch *sw) { sw->atodcorr = OMIT; sw->biascorr = OMIT; sw->blevcorr = OMIT; sw->crcorr = OMIT; sw->darkcorr = OMIT; sw->dqicorr = OMIT; sw->flatcorr = OMIT; sw->flashcorr = OMIT; sw->glincorr = OMIT; sw->lflgcorr = OMIT; sw->photcorr = OMIT; sw->rptcorr = OMIT; sw->shadcorr = OMIT; sw->statcorr = OMIT; }