# include # include # include "../stisvoltages.h" /* Value to assign if keyword is not found. */ # define DEFAULT_VOLTAGE (-9999.) /* This routine gets voltages from the primary header and compares with minimum values. If any voltage is too low, a warning message will be printed. Phil Hodge, 1998 May 1: Function created. */ int CheckVolt (Hdr *phdr) { /* argument: Hdr *phdr i: primary header */ int status; int use_default = 1; /* use default if keyword is missing */ double abav, cdav; /* amplifier bias voltages */ double lgcdv; /* last gate C & D voltage */ double swalv; /* summing wells */ double rcdlv; /* reset gate C & D low voltage */ int low_voltage = 0; /* was any voltage low? */ int Get_KeyD (Hdr *, char *, int, double, double *); /* Get the voltages. */ if (status = Get_KeyD (phdr, "OCBABAV", use_default, DEFAULT_VOLTAGE, &abav)) return (status); if (status = Get_KeyD (phdr, "OCBCDAV", use_default, DEFAULT_VOLTAGE, &cdav)) return (status); if (status = Get_KeyD (phdr, "OCBLGCDV", use_default, DEFAULT_VOLTAGE, &lgcdv)) return (status); if (status = Get_KeyD (phdr, "OCBSWALV", use_default, DEFAULT_VOLTAGE, &swalv)) return (status); if (status = Get_KeyD (phdr, "OCBRCDLV", use_default, DEFAULT_VOLTAGE, &rcdlv)) return (status); /* Check the voltages against the minimum allowed values. */ if (abav != DEFAULT_VOLTAGE && abav < MIN_OCBABAV) { low_voltage = 1; printf ("Warning OCBABAV = %.6g\n", abav); } if (cdav != DEFAULT_VOLTAGE && cdav < MIN_OCBCDAV) { low_voltage = 1; printf ("Warning OCBCDAV = %.6g\n", cdav); } if (lgcdv != DEFAULT_VOLTAGE && lgcdv < MIN_OCBLGCDV) { low_voltage = 1; printf ("Warning OCBLGCDV = %.6g\n", lgcdv); } if (swalv != DEFAULT_VOLTAGE && swalv < MIN_OCBSWALV) { low_voltage = 1; printf ("Warning OCBSWALV = %.6g\n", swalv); } if (rcdlv != DEFAULT_VOLTAGE && rcdlv < MIN_OCBRCDLV) { low_voltage = 1; printf ("Warning OCBRCDLV = %.6g\n", rcdlv); } if (low_voltage) { printf ( "Warning Data are likely to be corrupted; CCD settings indicate \\\n"); printf ( "Warning a cosmic ray induced CCD reset has occured, causing \\\n"); printf ( "Warning biases and clocking voltages to be incorrectly set.\n"); } return (0); }