int GetAngle4 (StisInfo4 *sts, char *ref_aper, double *angle) { /* arguments: StisInfo4 *sts i: calibration switches and info char *ref_aper i: name of reference aperture for dispersion relation coeff double *angle o: incidence angle, in arcseconds */ int status; TblInfo tabinfo; /* pointer to table descriptor, etc */ TblRow tabrow; /* values read from a table row */ double ap_offset; /* offset of aperture used for observation */ double ref_offset; /* offset of reference aperture */ int row; /* number of rows, and loop index */ int ap_found; /* true if aperture found in table */ int ref_found; /* true if reference aperture found in table */ /* Open the aperture description table. */ if ((status = OpenApTab (sts->apdestab.name, &tabinfo))) return (status); /* Check each row for a match with aperture or ref_aper. */ ap_found = 0; ref_found = 0; for (row = 1; row <= tabinfo.nrows; row++) { if ((status = ReadApTab (&tabinfo, row, &tabrow))) return (status); if (SameString (tabrow.aperture, sts->aperture)) { ap_found = 1; ap_offset = tabrow.offset; /* Get pedigree & descrip from this row. */ if ((status = RowPedigree (&sts->apdestab, row, tabinfo.tp, tabinfo.cp_pedigree, tabinfo.cp_descrip))) return (status); if (sts->apdestab.goodPedigree == DUMMY_PEDIGREE) printf ("Warning APDESTAB has PEDIGREE = DUMMY.\n"); } if (SameString (tabrow.aperture, ref_aper)) { ref_found = 1; ref_offset = tabrow.offset; } if (ap_found && ref_found) break; } if ((status = CloseApTab (&tabinfo))) return (status); if (!ap_found || !ref_found) { if (!ap_found) printf ("APERTURE %s not found in APDESTAB.\n", sts->aperture); if (!ref_found) printf ("REF_APER %s not found in APDESTAB.\n", ref_aper); printf (" APDESTAB = %s\n", sts->apdestab.name); return (TABLE_ERROR); } *angle = ap_offset - ref_offset; return (0); }
int GetApOffset6 (StisInfo6 *sts, float *ap_offset, char *ref_aper, double *delta) { /* arguments: StisInfo6 *sts i: calibration switches and info float *ap_offset i: offset of aperture from position reference char *ref_aper i: name of reference aperture for dispersion relation coeff double *delta o: offset in dispersion direction, arcseconds */ int status; TblInfo tabinfo; /* pointer to table descriptor, etc */ TblRow tabrow; /* values read from a table row */ int row; /* number of rows, and loop index */ int pedigree; /* for selected row */ int foundit = 0; /* true if aperture found in table */ /* Open the aperture description table. */ if ((status = OpenApTab (sts->apdestab.name, &tabinfo))) return (status); /* Check each row for a match with ref_aper. */ for (row = 1; row <= tabinfo.nrows; row++) { if ((status = ReadApTab (&tabinfo, row, &tabrow))) return (status); if (SameString (tabrow.aperture, ref_aper)) { foundit = 1; if ((status = CheckPedigree (&tabinfo, row, &pedigree))) return (status); if (pedigree == DUMMY_PEDIGREE) { sts->x1d_o = DUMMY; *delta = 0.; CloseApTab (&tabinfo); return (0); } else { if (sts->dispaxis == 1) *delta = ap_offset[0] - tabrow.offset[0]; else if (sts->dispaxis == 2) *delta = ap_offset[1] - tabrow.offset[1]; else *delta = 0.; } break; } } if ((status = CloseApTab (&tabinfo))) return (status); if (!foundit) { printf ("ERROR APERTURE %s not found in APDESTAB %s\n", sts->aperture, sts->apdestab.name); return (ROW_NOT_FOUND); } return (0); }