Ejemplo n.º 1
0
static int ReadSDistArray (TblInfo *tabinfo, int row, CoordInfo **coords) {

	int status;

	CoordInfo *newrec;
	int NewCoord6 (CoordInfo **, CoordInfo *);

	if ((newrec = malloc (sizeof (CoordInfo))) == NULL) {
	    printf ("ERROR    (GetSDC) can't allocate memory.\n");
	    return (OUT_OF_MEMORY);
	}
	newrec->next = NULL;

	/* Get size info and coordinate parameters. */
	c_tbegti (tabinfo->tp, tabinfo->cp_sporder, row, &newrec->sporder);
	c_tbegtd (tabinfo->tp, tabinfo->cp_a2center, row, &newrec->a2center);
	c_tbegtd (tabinfo->tp, tabinfo->cp_cdelt2, row, &newrec->cdelt2);
	c_tbegti (tabinfo->tp, tabinfo->cp_npix, row, &newrec->npix);
	if (c_iraferr())
	    return (TABLE_ERROR);

	/* Insert in the coords list. */
	if ((status = NewCoord6 (coords, newrec)))
	    return (status);

	free (newrec);

	return (0);
}
Ejemplo n.º 2
0
static int ReadProfileArray (TblInfo *tabinfo, int row, ProfileArray **profa,
                             double *subscale) {
	int status;

	int npts1, npts2;
	ProfileArray *newp;
	int NewProfile (ProfileArray **, ProfileArray *);

	if ((newp = (ProfileArray *) malloc (sizeof (ProfileArray))) == NULL) {
	    printf ("ERROR    Can't allocate memory.\n");
	    return (OUT_OF_MEMORY);
	}
	newp->next = NULL;

	/* Get profile scalar data. */
	c_tbegti (tabinfo->tp, tabinfo->cp_npts,     row, &newp->npts);
	c_tbegti (tabinfo->tp, tabinfo->cp_nptsoff,  row, &newp->nptsoff);
	c_tbegtd (tabinfo->tp, tabinfo->cp_subscale, row, subscale);
	c_tbegtd (tabinfo->tp, tabinfo->cp_minw,     row, &newp->minw);
	c_tbegtd (tabinfo->tp, tabinfo->cp_maxw,     row, &newp->maxw);
	c_tbegti (tabinfo->tp, tabinfo->cp_minp,     row, &newp->minp);
	c_tbegti (tabinfo->tp, tabinfo->cp_maxp,     row, &newp->maxp);
	c_tbegtr (tabinfo->tp, tabinfo->cp_sn,       row, &newp->sn);

	/* Alloc array memory. */
	newp->profoff = (double *) malloc (newp->nptsoff * sizeof (double));
	newp->prof    = (double *) malloc (newp->npts * sizeof (double));
	if (newp->profoff == NULL || newp->prof == NULL) {
	    printf ("ERROR    Can't allocate memory.\n");
	    return (OUT_OF_MEMORY);
	}

	/* Get profile array data. */
	npts1 = c_tbagtd (tabinfo->tp, tabinfo->cp_profoff, row,
			 newp->profoff, 1, newp->nptsoff);
	if (c_iraferr())
	    return (TABLE_ERROR);
	npts2 = c_tbagtd (tabinfo->tp, tabinfo->cp_prof, row,
			 newp->prof, 1, newp->npts);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (npts1 != newp->nptsoff) {
	    c_tbtclo (tabinfo->tp);
	    printf ("ERROR    Inconsistent array info in OPROFTAB\n");
	    return (TABLE_ERROR);
	}

	/* Insert newp into the profile list. */
	if ((status = NewProfile (profa, newp)))
	    return (status);

	free (newp->profoff);
	free (newp->prof);
	free (newp);

	return (0);
}
Ejemplo n.º 3
0
static int ReadDSPArray (TblInfo *tabinfo, int row,
		DispRelation *disp, char *ref_aper) {

	int ncoeff;		/* number of coefficients read from table */
	int i;

	for (i = 0;  i < MAX_DISP_COEFF;  i++)
	    disp->coeff[i] = 0.;

	/* Get name of aperture used to measure dispersion relation. */
	c_tbegtt (tabinfo->tp, tabinfo->cp_ref_aper, row, ref_aper, STIS_CBUF);

	/* Number of coefficients in dispersion relation. */
	c_tbegti (tabinfo->tp, tabinfo->cp_ncoeff, row, &disp->ncoeff);
	if (disp->ncoeff > MAX_DISP_COEFF) {
	    printf ("Too many dispersion coefficients %d in DISPTAB.\n",
		disp->ncoeff);
	    return (TABLE_ERROR);
	}

	/* Get the coefficients themselves. */
	ncoeff = c_tbagtd (tabinfo->tp, tabinfo->cp_coeff, row,
			disp->coeff, 1, disp->ncoeff);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (ncoeff < disp->ncoeff) {
	    c_tbtclo (tabinfo->tp);
	    printf ("Not all coefficients were read from DISPTAB.\n");
	    return (TABLE_ERROR);
	}

	/* Get the a4corr info. */
	if (tabinfo->cp_a4corr == 0) {
	    disp->mref = 0;
	    disp->yref = 0.;
	    disp->a4corr = 0.;
	} else {
	    double yref;

	    c_tbegti (tabinfo->tp, tabinfo->cp_mref, row, &disp->mref);
	    if (c_iraferr())
		return (TABLE_ERROR);

	    c_tbegtd (tabinfo->tp, tabinfo->cp_yref, row, &yref);
	    if (c_iraferr())
		return (TABLE_ERROR);
	    /* convert to zero-indexing */
	    disp->yref = yref - 1.;

	    c_tbegtd (tabinfo->tp, tabinfo->cp_a4corr, row, &disp->a4corr);
	    if (c_iraferr())
		return (TABLE_ERROR);
	}

	return (0);
}
Ejemplo n.º 4
0
static int ReadCCDTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	c_tbegtt (tabinfo->tp, tabinfo->cp_amp, row,
			tabrow->ccdamp, STIS_CBUF);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_ccdgain, row, &tabrow->ccdgain);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_ccdoffset, row, &tabrow->ccdoffset);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_bin1, row, &tabrow->bin[0]);
	if (c_iraferr())
	    return (TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_bin2, row, &tabrow->bin[1]);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegtr (tabinfo->tp, tabinfo->cp_atodgain, row, &tabrow->atodgain);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegtr (tabinfo->tp, tabinfo->cp_bias, row, &tabrow->ccdbias);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegtr (tabinfo->tp, tabinfo->cp_readnoise, row, &tabrow->readnoise);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegtr (tabinfo->tp, tabinfo->cp_saturate, row, &tabrow->saturate);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (tabinfo->cp_blev_clip == 0) {
	    tabrow->blev_clip = DEFAULT_BLEV_CLIP;
	} else {
	    c_tbegtr (tabinfo->tp, tabinfo->cp_blev_clip, row,
			&tabrow->blev_clip);
	    if (c_iraferr())
		return (TABLE_ERROR);
	}

	return (0);
}
Ejemplo n.º 5
0
static int ReadAtoDArray (TblInfo *tabinfo, int row, TblArray *tabarray) {

	extern int status;
	int nret;		/* number of elements actually read */

	/* Find out how many elements there are in the ATOD array,
	   and allocate space for the array to be read from the table.
	*/
	c_tbegti (tabinfo->tp, tabinfo->cp_nelem, row, &tabarray->nelem);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	tabarray->atod = (float *) malloc (tabarray->nelem * sizeof(float));
	if (tabarray->atod == NULL)
	    return (status = OUT_OF_MEMORY);

	nret = c_tbagtr (tabinfo->tp, tabinfo->cp_atod, row,
			tabarray->atod, 1, tabarray->nelem);
	if ( (status = c_iraferr()) )
	    return (status = TABLE_ERROR);

	if (nret < tabarray->nelem) {
	    sprintf (MsgText,
		     "CORRECTION array in row %d of ATODTAB is too short.",
		     row);
	    trlerror (MsgText);
	    free (tabarray->atod);
	    return (status = TABLE_ERROR);
	}

	return (status);
}
Ejemplo n.º 6
0
static int ReadIACTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	c_tbegtt (tabinfo->tp, tabinfo->cp_opt_elem, row,
			tabrow->opt_elem, STIS_CBUF-1);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_sporder, row, &tabrow->sporder);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_cenwave, row, &tabrow->cenwave);
	if (c_iraferr())
	    return (TABLE_ERROR);

	return (0);
}
Ejemplo n.º 7
0
static int ReadBpixTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	/* OPT_ELEM is an optional column. */
	if (tabinfo->cp_opt_elem == 0) {
	    strcpy (tabrow->opt_elem, "ANY");
	} else {
	    c_tbegtt (tabinfo->tp, tabinfo->cp_opt_elem, row,
			tabrow->opt_elem, STIS_CBUF);
	    if (c_iraferr())
		return (TABLE_ERROR);
	}

	c_tbegti (tabinfo->tp, tabinfo->cp_xstart, row, &tabrow->xstart);
	if (c_iraferr())
	    return (TABLE_ERROR);
	tabrow->xstart--;
	c_tbegti (tabinfo->tp, tabinfo->cp_ystart, row, &tabrow->ystart);
	if (c_iraferr())
	    return (TABLE_ERROR);
	tabrow->ystart--;
	c_tbegti (tabinfo->tp, tabinfo->cp_length, row, &tabrow->length);
	if (c_iraferr())
	    return (TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_axis, row, &tabrow->axis);
	if (c_iraferr())
	    return (TABLE_ERROR);
	c_tbegts (tabinfo->tp, tabinfo->cp_flag, row, &tabrow->flag);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (tabrow->axis !=1 && tabrow->axis != 2) {
	    printf ("ERROR    Axis = %d in BPIXTAB, but it must be 1 or 2.\n",
			tabrow->axis);
	    c_tbtclo (tabinfo->tp);
	    return (TABLE_ERROR);
	}
	if (tabrow->length <= 0) {
	    printf (
	"ERROR    Length = %d in BPIXTAB, but it must be positive.\n",
		    tabrow->length);
	    c_tbtclo (tabinfo->tp);
	    return (TABLE_ERROR);
	}

	return (0);
}
Ejemplo n.º 8
0
static int ReadProfileTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	c_tbegti (tabinfo->tp, tabinfo->cp_sporder, row, &tabrow->sporder);
	if (c_iraferr())
	    return (TABLE_ERROR);

	return (0);
}
Ejemplo n.º 9
0
void c_tbegtd (const IRAFPointer tp, const IRAFPointer cp, int row, double *buffer) {

/* Read a value of type double from a table column.
arguments:
IRAFPointer tp          i: table descriptor
IRAFPointer cp          i: column descriptor
int row                 i: row number (one indexed)
double *buffer          o: value read from table
*/

        TableDescr *tbl_descr;
        ColumnDescr *col_descr;
        int anynul=0;
        long firstelem=1, nelem=1;
        double nulval=IRAF_INDEFD;
        int status = 0;

        tbl_descr = (TableDescr *)tp;
        col_descr = (ColumnDescr *)cp;

        if (col_descr->datatype < 0) {
            char *value;
            int maxch;
            maxch = col_descr->width + 5;
            value = (char *)calloc (maxch, sizeof(char));
            c_tbegtt (tp, cp, row, value, maxch);
            if (strcmp (value, "INDEF") == 0)
                *buffer = IRAF_INDEFD;
            else
                *buffer = atof (value);
            free (value);

        } else if (col_descr->datatype == IRAF_INT) {
            int i_value;
            c_tbegti (tp, cp, row, &i_value);
            if (i_value == IRAF_INDEFI)
                *buffer = IRAF_INDEFD;
            else
                *buffer = i_value;

        } else if (col_descr->datatype == IRAF_SHORT) {
            short si_value;
            c_tbegts (tp, cp, row, &si_value);
            if (si_value == IRAF_INDEFS)
                *buffer = IRAF_INDEFD;
            else
                *buffer = si_value;

        } else {

            /* fits_read_col_dbl = ffgcvd */
            fits_read_col_dbl (tbl_descr->fptr, col_descr->colnum,
                (long)row, firstelem, nelem, nulval,
                buffer, &anynul, &status);
            if (status != 0)
                setError (status, "c_tbegtd:  error reading element");
        }
}
Ejemplo n.º 10
0
void c_tbegts (const IRAFPointer tp, const IRAFPointer cp, int row, short *buffer) {

/* Read a short integer value from a table column.
arguments:
IRAFPointer tp          i: table descriptor
IRAFPointer cp          i: column descriptor
int row                 i: row number (one indexed)
short *buffer           o: value read from table
*/

        TableDescr *tbl_descr;
        ColumnDescr *col_descr;
        int anynul=0;
        long firstelem=1, nelem=1;
        short nulval=IRAF_INDEFS;
        int status = 0;

        tbl_descr = (TableDescr *)tp;
        col_descr = (ColumnDescr *)cp;

        if (col_descr->datatype < 0) {
            char *value;
            int maxch;
            maxch = col_descr->width + 5;
            value = (char *)calloc (maxch, sizeof(char));
            c_tbegtt (tp, cp, row, value, maxch);
            if (strcmp (value, "INDEF") == 0)
                *buffer = IRAF_INDEFS;
            else
                *buffer = atoi (value);
            free (value);

        } else if (col_descr->datatype == IRAF_BOOL) {
            Bool b_value;
            c_tbegtb (tp, cp, row, &b_value);
            if (b_value)
                *buffer = 1;
            else
                *buffer = 0;

        } else if (col_descr->datatype == IRAF_INT) {
            int i_value;
            c_tbegti (tp, cp, row, &i_value);
            if (i_value == IRAF_INDEFI)
                *buffer = IRAF_INDEFS;
            else
                *buffer = (short)i_value;

        } else {

            /* fits_read_col_sht = ffgcvi */
            fits_read_col_sht (tbl_descr->fptr, col_descr->colnum,
                (long)row, firstelem, nelem, nulval,
                buffer, &anynul, &status);
            if (status != 0)
                setError (status, "c_tbegts:  error reading element");
        }
}
Ejemplo n.º 11
0
static int ReadIACArray (TblInfo *tabinfo, int row, InangInfo *iac) {

	int ncoeff1, ncoeff2;	/* number of coefficients read from table */
	char *tname;		/* for possible error message */

	c_tbegti (tabinfo->tp, tabinfo->cp_ncoeff1, row, &ncoeff1);
	c_tbegti (tabinfo->tp, tabinfo->cp_ncoeff2, row, &ncoeff2);
	iac->ncoeff1 = ncoeff1;
	iac->ncoeff2 = ncoeff2;

	if (ncoeff1 > 0) {
	    if ((iac->coeff1 = (double *) malloc (iac->ncoeff1 *
                                                  sizeof(double))) == NULL)
		return (OUT_OF_MEMORY);
	    /* replace ncoeff1 with actual number of elements read */
	    ncoeff1 = c_tbagtd (tabinfo->tp, tabinfo->cp_coeff1, row,
			iac->coeff1, 1, iac->ncoeff1);
	    if (c_iraferr())
		return (TABLE_ERROR);
	}
	if (ncoeff2 > 0) {
	    if ((iac->coeff2 = (double *) malloc (iac->ncoeff2 *
                                                  sizeof(double))) == NULL)
		return (OUT_OF_MEMORY);
	    ncoeff2 = c_tbagtd (tabinfo->tp, tabinfo->cp_coeff2, row,
			iac->coeff2, 1, iac->ncoeff2);
	    if (c_iraferr())
		return (TABLE_ERROR);
	}
	iac->allocated = 1;

	if (ncoeff1 < iac->ncoeff1 || ncoeff2 < iac->ncoeff2) {
	    if ((tname = (char *) calloc (STIS_LINE+1, sizeof (char))) == NULL)
		return (OUT_OF_MEMORY);
	    c_tbtnam (tabinfo->tp, tname, STIS_LINE);
	    c_tbtclo (tabinfo->tp);
	    printf (
	"ERROR    Not all coefficients were read from %s\n", tname);
	    free (tname);
	    return (TABLE_ERROR);
	}

	return (0);
}
Ejemplo n.º 12
0
static int ReadTraceArray (TblInfo *tabinfo, int row, StisInfo6* sts, SpTrace **trace) {

	int status;

	int nelem;		/* number of elements read from table */
	double mjd;             /* MJD */
	double degperyr;        /* rate of trace rotation */

	SpTrace *newd;
	int NewTrace6 (SpTrace **, SpTrace *);

	if ((newd = (SpTrace *) malloc (sizeof (SpTrace))) == NULL) {
	    printf ("ERROR    Can't allocate memory.\n");
	    return (OUT_OF_MEMORY);
	}
	newd->next = NULL;

	/* Get spectrum trace and other info. */
	c_tbegtd (tabinfo->tp, tabinfo->cp_a1center, row, &newd->a1center);
	c_tbegtd (tabinfo->tp, tabinfo->cp_a2center, row, &newd->a2center);

	c_tbegti (tabinfo->tp, tabinfo->cp_nelem, row, &newd->nelem);
	if (newd->nelem > MAX_SP_TRACE) {
	    printf ("ERROR    Spectrum trace in SPTRCTAB is too large.\n");
	    return (TABLE_ERROR);
	}
	nelem = c_tbagtd (tabinfo->tp, tabinfo->cp_a2displ, row,
			newd->a2displ, 1, newd->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (tabinfo->cp_mjd != 0) {
	    c_tbegtd (tabinfo->tp, tabinfo->cp_mjd, row, &mjd);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_degperyr, row, &degperyr);
	    sts->trace_rotation = rotatetrace(sts->expstart, mjd, degperyr, newd->a2displ, nelem);
	}

	/* Convert a1center and a2center to zero-indexed. */
	newd->a1center--;
	newd->a2center--;

	if (nelem < newd->nelem) {
	    c_tbtclo (tabinfo->tp);
	    printf ("ERROR    Not all elements were read from SPTRCTAB\n");
	    return (TABLE_ERROR);
	}

	/* Insert newd into the SpTrace list. */
	if ((status = NewTrace6 (trace, newd)))
	    return (status);

	free (newd);

	return (0);
}
Ejemplo n.º 13
0
static int ReadPhotTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	c_tbegtt (tabinfo->tp, tabinfo->cp_opt_elem, row,
			tabrow->opt_elem, STIS_CBUF);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (tabinfo->cp_cenwave != 0) {
	    c_tbegti (tabinfo->tp, tabinfo->cp_cenwave, row, &tabrow->cenwave);
	    if (c_iraferr())
		return (TABLE_ERROR);
	    c_tbegti (tabinfo->tp, tabinfo->cp_sporder, row, &tabrow->sporder);
	    if (c_iraferr())
		return (TABLE_ERROR);
	} else {
	    tabrow->cenwave = 0;
	    tabrow->sporder = 0;
	}

	return (0);
}
Ejemplo n.º 14
0
static int ReadIntensArray (StisInfo6 *sts, TblInfo *tabinfo, int row,
                            IntensArray *inta, int sporder) {

	int status;
	int nwave, nintens;	/* number of elements actually read */

	/* Find out how many elements there are in the intensity arrays,
	   and allocate space for the arrays to be read from the table.
	*/
	c_tbegti (tabinfo->tp, tabinfo->cp_nelem, row, &inta->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	/* Allocate memory. */
	inta->wave   = (double *) calloc (inta->nelem, sizeof(double));
	inta->intens = (double *) calloc (inta->nelem, sizeof(double));
	if (inta->wave == NULL || inta->intens == NULL) {
	    CloseIntensTab (tabinfo);
	    return (OUT_OF_MEMORY);
	}
	inta->allocated = 1;

	nwave = c_tbagtd (tabinfo->tp, tabinfo->cp_wave, row,
                          inta->wave, 1, inta->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	nintens = c_tbagtd (tabinfo->tp, tabinfo->cp_intens, row,
                            inta->intens, 1, inta->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	/* Go get data to transform flux into net counts. */
	if (sts->fflux) {
	    status = FluxToNet (sts, inta, sporder);
	    if (status != STIS_OK)
	        return (status);
	}

	if (nwave < inta->nelem || nintens < inta->nelem) {
	    c_tbtclo (tabinfo->tp);
	    free (inta->wave);
	    free (inta->intens);
	    printf ("ERROR    Not all coefficients were read from OSPECTAB\n");
	    return (TABLE_ERROR);
	}

	return (0);
}
Ejemplo n.º 15
0
static int ReadDSPArray (TblInfo *tabinfo, int row, DispRelation **disp) {

	int status;

	int ncoeff;		/* number of coefficients read from table */
	DispRelation *newrec;
	int NewDisp (DispRelation **, DispRelation *);

	if ((newrec = malloc (sizeof (DispRelation))) == NULL) {
	    printf ("ERROR    (GetDisp) can't allocate memory.\n");
	    return (OUT_OF_MEMORY);
	}
	newrec->next = NULL;

	/* Get dispersion coefficients and other info. */
	c_tbegtd (tabinfo->tp, tabinfo->cp_a2center, row, &newrec->a2center);
	c_tbegtt (tabinfo->tp, tabinfo->cp_ref_aper, row, newrec->ref_aper,
		STIS_CBUF);
	c_tbegti (tabinfo->tp, tabinfo->cp_ncoeff, row, &newrec->ncoeff);
	if (newrec->ncoeff > MAX_DISP_COEFF) {
	    printf (
	"ERROR    Too many dispersion coefficients %d in DISPTAB.\n",
		newrec->ncoeff);
	    return (TABLE_ERROR);
	}
	ncoeff = c_tbagtd (tabinfo->tp, tabinfo->cp_coeff, row,
			newrec->coeff, 1, newrec->ncoeff);
	if (c_iraferr())
	    return (TABLE_ERROR);

	/* Convert a2center to zero-indexed. */
	newrec->a2center--;

	if (ncoeff < newrec->ncoeff) {
	    c_tbtclo (tabinfo->tp);
	    printf ("ERROR    Not all coefficients were read from DISPTAB.\n");
	    return (TABLE_ERROR);
	}

	/* Insert newrec into the disp list. */
	if ((status = NewDisp (disp, newrec)))
	    return (status);

	free (newrec);

	return (0);
}
Ejemplo n.º 16
0
static int GetXDisp (char *name, ScatterFunctions *scf) {

/* arguments
char *name;             i: name of CDSTAB reference file
ScatterFunctions *scf;  o: data structure with scattering functions
*/
        IRAFPointer tp;
        IRAFPointer cp_optelem, cp_nelem, cp_cdscat;
        char opt_elem[STIS_CBUF];
        int row, nrows, i;

        tp = c_tbtopn (name, IRAF_READ_ONLY, 0);
        if (c_iraferr()) {
            printf ("ERROR    CDSTAB `%s' not found\n", name);
            return (OPEN_FAILED);
        }
        nrows = c_tbpsta (tp, TBL_NROWS);
        c_tbcfnd1 (tp, "OPT_ELEM", &cp_optelem);
        c_tbcfnd1 (tp, "NELEM",    &cp_nelem);
        c_tbcfnd1 (tp, "CDSCAT",   &cp_cdscat);
        if (cp_optelem == 0 || cp_nelem == 0 || cp_cdscat == 0) {
            printf( "ERROR    Column not found in CDSTAB\n");
            c_tbtclo (tp);
            return (COLUMN_NOT_FOUND);
        }

        for (row = 1; row <= nrows ; row++) {
            c_tbegtt (tp, cp_optelem, row, opt_elem, STIS_CBUF-1);
            if (streq_ic (opt_elem, scf->opt_elem)) {
                c_tbegti (tp, cp_nelem, row, &(scf->nxdisp));
                scf->xdisp = (float *) calloc (scf->nxdisp, sizeof (float));
                if (scf->xdisp == NULL )
                    return (OUT_OF_MEMORY);
                i = c_tbagtr (tp, cp_cdscat, row, scf->xdisp, 1, scf->nxdisp);
                if (c_iraferr())
                    return (TABLE_ERROR);
                c_tbtclo (tp);
                return (STIS_OK);
            }
        }

        printf( "ERROR    Row with %s optical element not found in CDSTAB\n",
                 opt_elem);
        c_tbtclo (tp);
        return (ROW_NOT_FOUND);
}
Ejemplo n.º 17
0
static int ReadAtoDTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	c_tbegtt (tabinfo->tp, tabinfo->cp_amp, row,
			tabrow->ccdamp, STIS_CBUF);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_gain, row, &tabrow->ccdgain);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegtt (tabinfo->tp, tabinfo->cp_key, row,
			tabrow->ref_key, STIS_CBUF);
	if (c_iraferr())
	    return (TABLE_ERROR);

	c_tbegtd (tabinfo->tp, tabinfo->cp_keyval, row, &tabrow->ref_key_value);
	if (c_iraferr())
	    return (TABLE_ERROR);

	return (0);
}
Ejemplo n.º 18
0
void c_tbegtb (const IRAFPointer tp, const IRAFPointer cp, int row, Bool *buffer) {

/* Read a boolean value from a table column.
arguments:
IRAFPointer tp          i: table descriptor
IRAFPointer cp          i: column descriptor
int row                 i: row number (one indexed)
Bool *buffer            o: value (True or False) read from table
*/

        TableDescr *tbl_descr;
        ColumnDescr *col_descr;
        int anynul=0;
        long firstelem=1, nelem=1;
        int nulval=0;
        char s_value[11]={'\0'};
        int status = 0;

        tbl_descr = (TableDescr *)tp;
        col_descr = (ColumnDescr *)cp;

        if (col_descr->datatype < 0) {
            char *value;
            int maxch;
            maxch = col_descr->width + 5;
            value = (char *)calloc (maxch, sizeof(char));
            c_tbegtt (tp, cp, row, value, maxch);
            str_lower (value, value);
            if (strcmp (value, "1") == 0) {
                *buffer = True;
            } else if (strcmp (value, "0") == 0) {
                *buffer = False;
            } else if (strncmp (value, "yes", 3) == 0 ||
                       strncmp (value, "true", 4) == 0) {
                *buffer = True;
            } else {
                *buffer = False;
            }
            free (value);

        } else if (col_descr->datatype == IRAF_INT) {
            int i_value;
            c_tbegti (tp, cp, row, &i_value);
            if (i_value == IRAF_INDEFI)
                *buffer = False;
            else if (i_value)
                *buffer = True;
            else
                *buffer = False;

        } else if (col_descr->datatype == IRAF_SHORT) {
            short si_value;
            c_tbegts (tp, cp, row, &si_value);
            if (si_value == IRAF_INDEFS)
                *buffer = False;
            else if (si_value)
                *buffer = True;
            else
                *buffer = False;

        } else {

            /* fits_read_col_log = ffgcvl */
            fits_read_col_log (tbl_descr->fptr, col_descr->colnum,
                (long)row, firstelem, nelem, nulval,
                s_value, &anynul, &status);
            if (status != 0)
                setError (status, "c_tbegtb:  error reading element");
            if (s_value[0])
                *buffer = True;
            else
                *buffer = False;
        }
}
Ejemplo n.º 19
0
static int ReadPhotData (TblInfo *tabinfo, int row, PhotInfo *phot) {

	int nwl, nthru;		/* number of elements actually read */

	/* Find out how many elements there are in the throughput arrays,
	   and allocate space for the arrays to be read from the table.
	*/
	c_tbegti (tabinfo->tp, tabinfo->cp_nelem, row, &phot->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	phot->wl = (double *) malloc (phot->nelem * sizeof(double));
	phot->thru = (double *) malloc (phot->nelem * sizeof(double));
	if (phot->wl == NULL || phot->thru == NULL)
	    return (OUT_OF_MEMORY);

	nwl = c_tbagtd (tabinfo->tp, tabinfo->cp_wl, row,
			phot->wl, 1, phot->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	nthru = c_tbagtd (tabinfo->tp, tabinfo->cp_thru, row,
			phot->thru, 1, phot->nelem);
	if (c_iraferr())
	    return (TABLE_ERROR);

	if (nwl < phot->nelem || nthru < phot->nelem) {
	    c_tbtclo (tabinfo->tp);
	    free (phot->wl);
	    free (phot->thru);
	    printf ("ERROR    Not all elements were read from PHOTTAB.\n");
	    return (TABLE_ERROR);
	}

	phot->allocated = 1;			/* set flag */

	if (phot->blazecorr == PERFORM) {

	    c_tbegti (tabinfo->tp, tabinfo->cp_mref, row, &phot->mref);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_wref, row, &phot->wref);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_yref, row, &phot->yref);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_mjd,  row, &phot->mjd);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_mx,   row, &phot->mx);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_my,   row, &phot->my);
	    c_tbegtd (tabinfo->tp, tabinfo->cp_mt,   row, &phot->mt);
	    if (tabinfo->cp_m0 == 0)
		phot->m0 = 0.;
	    else
		c_tbegtd (tabinfo->tp, tabinfo->cp_m0, row, &phot->m0);

	    if (c_iraferr()) {
	        free (phot->wl);
	        free (phot->thru);
	        free (phot->error);
	        return (TABLE_ERROR);
	    }

	    /* Reference data is 1-indexed ! */
	    phot->yref -= 1.0;
	}

	return (0);
}
Ejemplo n.º 20
0
void c_tbegtt (const IRAFPointer tp, const IRAFPointer cp, int row, char *buffer,
                int maxch) {

/* Read a string value from a table column.
arguments:
IRAFPointer tp          i: table descriptor
IRAFPointer cp          i: column descriptor
int row                 i: row number (one indexed)
char *buffer            o: value read from table
int maxch               i: maximum length of the string (not incl NULL)
*/

        TableDescr *tbl_descr;
        ColumnDescr *col_descr;
        int anynul=0;
        long firstelem=1, nelem=1;
        char *value;
        int len;
        int status = 0;

        tbl_descr = (TableDescr *)tp;
        col_descr = (ColumnDescr *)cp;

        if (col_descr->datatype < 0) {
            if (col_descr->width >= maxch)
                len = col_descr->width;
            else
                len = maxch;
        } else {
            len = SZ_FITS_STR;
        }
        value = (char *)calloc (len+1, sizeof(char));

        if (col_descr->datatype == IRAF_BOOL) {
            Bool b_value;
            c_tbegtb (tp, cp, row, &b_value);
            if (b_value == True)
                strcpy (value, "yes");
            else
                strcpy (value, "no");

        } else if (col_descr->datatype == IRAF_DOUBLE) {
            double d_value;
            c_tbegtd (tp, cp, row, &d_value);
            if (d_value == IRAF_INDEFD)
                strcpy (value, "INDEF");
            else
                sprintf (value, "%.16g", d_value);

        } else if (col_descr->datatype == IRAF_REAL) {
            float r_value;
            c_tbegtr (tp, cp, row, &r_value);
            if (r_value >= 0.99999 * IRAF_INDEFR &&
                r_value <= 1.00001 * IRAF_INDEFR) {
                strcpy (value, "INDEF");
            } else {
                sprintf (value, "%.7g", r_value);
            }

        } else if (col_descr->datatype == IRAF_INT) {
            int i_value;
            c_tbegti (tp, cp, row, &i_value);
            if (i_value == IRAF_INDEFI)
                strcpy (value, "INDEF");
            else
                sprintf (value, "%d", i_value);

        } else if (col_descr->datatype == IRAF_SHORT) {
            short si_value;
            c_tbegts (tp, cp, row, &si_value);
            if (si_value == IRAF_INDEFS)
                strcpy (value, "INDEF");
            else
                sprintf (value, "%hd", si_value);

        } else {

            /* fits_read_col_str = ffgcvs */
            fits_read_col_str (tbl_descr->fptr, col_descr->colnum,
                (long)row, firstelem, nelem, "INDEF",
                &value, &anynul, &status);
            if (status != 0)
                setError (status, "c_tbegtt:  error reading element");
        }

        copyString (buffer, value, maxch);

        free (value);
}
Ejemplo n.º 21
0
static int GetRefWave (Hdr *phdr, char *name, ScatterFunctions *scf) {

/* arguments
Hdr *phdr               i: primary header
char *name;             i: name of SRWTAB reference file
ScatterFunctions *scf;  o: data structure with reference wavelengths
*/
        IRAFPointer tp;
        IRAFPointer cp_optelem, cp_cenwave, cp_nrw, cp_hrwlist, cp_prwlist;
        char opt_elem[STIS_CBUF];
        int row, nrows, i, cenwave, status;
        double holdh[10], holdp[10];   /* holds a maximum of 10 wavelengths */

        /* This is necessary to avoid rui warnings from the debugger. */
        for (i = 0; i < 10; i++) {
            holdh[i] = 0.0;
            holdp[i] = 0.0;
        }
        for (i = 0; i <= NREFWAVE; i++) {
            scf->kernw[i] = 0.0;
            scf->psfw[i] = 0.0;
        }

        /* get reference CENWAVE. */

        if ((status = Get_KeyI (phdr, "CENWAVE", 0, 0, &cenwave)))
            return (status);

        tp = c_tbtopn (name, IRAF_READ_ONLY, 0);
        if (c_iraferr()) {
            printf ("ERROR    SRWTAB `%s' not found\n", name);
            return (OPEN_FAILED);
        }
        nrows = c_tbpsta (tp, TBL_NROWS);
        c_tbcfnd1 (tp, "OPT_ELEM",  &cp_optelem);
        c_tbcfnd1 (tp, "CENWAVE",   &cp_cenwave);
        c_tbcfnd1 (tp, "NRW",       &cp_nrw);
        c_tbcfnd1 (tp, "HALOWAVES", &cp_hrwlist);
        c_tbcfnd1 (tp, "PSFWAVES",  &cp_prwlist);
        if (cp_optelem == 0 || cp_cenwave == 0 ||
            cp_nrw     == 0 || cp_hrwlist == 0 || cp_prwlist == 0) {
            printf( "ERROR    Column not found in SRWTAB\n");
            c_tbtclo (tp);
            return (COLUMN_NOT_FOUND);
        }

        scf->nwave = 0;
        for (row = 1; row <= nrows ; row++) {

            c_tbegti (tp, cp_cenwave, row, &i);
            c_tbegtt (tp, cp_optelem, row, opt_elem, STIS_CBUF-1);
            if (c_iraferr())
                return (TABLE_ERROR);
            if ((i == cenwave) && (streq_ic (opt_elem, scf->opt_elem))) {

                c_tbegti (tp, cp_nrw, row, &(scf->nwave));
                if (c_iraferr())
                    return (TABLE_ERROR);
                i = c_tbagtd (tp, cp_hrwlist, row, holdh, 1, scf->nwave);
                if (c_iraferr())
                    return (TABLE_ERROR);
                i = c_tbagtd (tp, cp_prwlist, row, holdp, 1, scf->nwave);
                if (c_iraferr())
                    return (TABLE_ERROR);
                c_tbtclo (tp);

                scf->kernw[0] = holdh[0];
                scf->psfw[0]  = holdp[0];
                if (scf->nwave > 1) {
                    scf->kernw[1] = holdh[1];
                    scf->psfw[1]  = holdp[1];
                }
                if (scf->nwave > 2) {
                    scf->kernw[2] = holdh[2];
                    scf->psfw[2]  = holdp[2];
                }

                return (STIS_OK);
            }
        }

        printf( "ERROR    Row not found in SRWTAB\n");
        c_tbtclo (tp);
        return (ROW_NOT_FOUND);
}
Ejemplo n.º 22
0
static int GetScatter (char *name, ScatterFunctions *scf) {

/* arguments
char *name;             i: name of ECHSCTAB reference file
ScatterFunctions *scf;  o: data structure with scattering functions
*/
        IRAFPointer tp;
        IRAFPointer cp_optelem, cp_sporder, cp_nelem, cp_scat;
        char opt_elem[STIS_CBUF];
        int row, nrows, i;

        tp = c_tbtopn (name, IRAF_READ_ONLY, 0);
        if (c_iraferr()) {
            printf ("ERROR    ECHSCTAB `%s' not found\n", name);
            return (OPEN_FAILED);
        }
        nrows = c_tbpsta (tp, TBL_NROWS);
        c_tbcfnd1 (tp, "OPT_ELEM", &cp_optelem);
        c_tbcfnd1 (tp, "NELEM",    &cp_nelem);
        c_tbcfnd1 (tp, "SPORDER",  &cp_sporder);
        c_tbcfnd1 (tp, "ECHSCAT",  &cp_scat);
        if (cp_optelem == 0 || cp_nelem == 0 ||
            cp_sporder == 0 || cp_scat  == 0) {
            printf( "ERROR    Column not found in ECHSCTAB\n");
            c_tbtclo (tp);
            return (COLUMN_NOT_FOUND);
        }

        /* This creates some small amount of unused memory but the
           cost is negligible.
        */
        scf->scfunc = (ScFunc *) calloc (nrows , sizeof (ScFunc));
        scf->nsc = 0;

        for (row = 1; row <= nrows ; row++) {

            c_tbegtt (tp, cp_optelem, row, opt_elem, STIS_CBUF-1);

            if (streq_ic (opt_elem, scf->opt_elem)) {

                c_tbegti (tp, cp_sporder, row,
                          &(scf->scfunc[(scf->nsc)].sporder));
                if (c_iraferr())
                    return (TABLE_ERROR);
                c_tbegti (tp, cp_nelem, row, &(scf->scfunc[(scf->nsc)].nelem));
                if (c_iraferr())
                    return (TABLE_ERROR);
                scf->scfunc[(scf->nsc)].values = (double *) calloc (
                                                 scf->scfunc[(scf->nsc)].nelem,
                                                 sizeof (double));
                i = c_tbagtd (tp, cp_scat, row,
                                           scf->scfunc[(scf->nsc)].values, 1,
                                           scf->scfunc[(scf->nsc)].nelem);
                if (c_iraferr())
                    return (TABLE_ERROR);

                (scf->nsc)++;
            }
        }

        c_tbtclo (tp);

        if (scf->nsc == 0) {
            printf( "ERROR    Row not found in ECHSCTAB\n");
            return (ROW_NOT_FOUND);
        }

        return (STIS_OK);
}
Ejemplo n.º 23
0
static int GetRipple (Hdr *phdr, char *name, ScatterFunctions *scf) {

/* arguments
Hdr *phdr               i: primary header
char *name;             i: name of RIPTAB  reference file
ScatterFunctions *scf;  o: data structure with ripple functions
*/
        IRAFPointer tp;
        IRAFPointer cp_optelem, cp_cenwave, cp_sporder, cp_wave,
                    cp_nelem, cp_ripple;
        char opt_elem[STIS_CBUF];
        int row, nrows, i, k, cenwave, status;

        /* get reference CENWAVE. */

        if ((status = Get_KeyI (phdr, "CENWAVE", 0, 0, &cenwave)))
            return (status);

        /* Open table and get column pointers. */

        tp = c_tbtopn (name, IRAF_READ_ONLY, 0);
        if (c_iraferr()) {
            printf ("ERROR    RIPTAB `%s' not found\n", name);
            return (OPEN_FAILED);
        }
        c_tbcfnd1 (tp, "OPT_ELEM",   &cp_optelem);
        c_tbcfnd1 (tp, "CENWAVE",    &cp_cenwave);
        c_tbcfnd1 (tp, "SPORDER",    &cp_sporder);
        c_tbcfnd1 (tp, "NELEM",      &cp_nelem);
        c_tbcfnd1 (tp, "WAVELENGTH", &cp_wave);
        c_tbcfnd1 (tp, "RIPPLE",     &cp_ripple);
        if (cp_cenwave == 0 || cp_sporder == 0 ||
            cp_wave    == 0 || cp_ripple  == 0 ||
            cp_nelem   == 0 || cp_optelem == 0) {
            printf( "ERROR    Column not found in RIPTAB\n");
            c_tbtclo (tp);
            return (COLUMN_NOT_FOUND);
        }

        /* Get # of matching rows. */

        nrows = c_tbpsta (tp, TBL_NROWS);
        scf->nrp = 0;
        for (row = 1; row <= nrows; row++) {
            c_tbegti (tp, cp_cenwave, row, &i);
            c_tbegtt (tp, cp_optelem, row, opt_elem, STIS_CBUF-1);
            if (c_iraferr())
                return (TABLE_ERROR);

            if ((i == cenwave) && (streq_ic (opt_elem, scf->opt_elem)))
                (scf->nrp)++;
        }
        if (scf->nrp == 0) {
            printf ("ERROR    No matching rows in RIPTAB `%s'\n", name);
            return (TABLE_ERROR);
        }

        /* Alloc memory. */

        scf->rpfunc = (RippleFunc *) calloc (scf->nrp, sizeof (RippleFunc));
        if (scf->rpfunc == NULL)
            return (OUT_OF_MEMORY);

        /* Ingest data from matching rows. */

        k = 0;
        for (row = 1; row <= nrows ; row++) {

            c_tbegti (tp, cp_cenwave, row, &i);
            c_tbegtt (tp, cp_optelem, row, opt_elem, STIS_CBUF-1);
            if (c_iraferr())
                return (TABLE_ERROR);

            if ((i == cenwave) && (streq_ic (opt_elem, scf->opt_elem))) {

                c_tbegti (tp, cp_sporder, row, &(scf->rpfunc[k].sporder));
                if (c_iraferr())
                    return (TABLE_ERROR);
                scf->rpfunc[k].nelem = c_tbcigi (cp_ripple,
                                                 TBL_COL_LENDATA);
                scf->rpfunc[k].wavelengths = (double *) calloc (
                                             scf->rpfunc[k].nelem,
                                             sizeof (double));
                if (scf->rpfunc[k].wavelengths == NULL)
                    return (OUT_OF_MEMORY);
                scf->rpfunc[k].values = (double *) calloc (
                                         scf->rpfunc[k].nelem,
                                         sizeof (double));
                if (scf->rpfunc[k].values == NULL)
                    return (OUT_OF_MEMORY);
                i = c_tbagtd (tp, cp_wave, row, scf->rpfunc[k].wavelengths,
                              1, scf->rpfunc[k].nelem);
                if (c_iraferr())
                    return (TABLE_ERROR);
                i = c_tbagtd (tp, cp_ripple, row, scf->rpfunc[k].values,
                              1, scf->rpfunc[k].nelem);
                if (c_iraferr())
                    return (TABLE_ERROR);

                k++;
            }
        }

        c_tbtclo (tp);

        return (STIS_OK);
}
Ejemplo n.º 24
0
static int ReadCCDTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	extern int status;

	c_tbegtt (tabinfo->tp, tabinfo->cp_amp, row,
			tabrow->ccdamp, ACS_CBUF-1);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_ccdchip, row, &tabrow->ccdchip);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
        
    if (tabinfo->intgain == 1){
	    c_tbegti (tabinfo->tp, tabinfo->cp_ccdgain, row, &tabrow->ccdgaini);
    } else {
	    c_tbegtr (tabinfo->tp, tabinfo->cp_ccdgain, row, &tabrow->ccdgainf);
	}        
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_bin1, row, &tabrow->bin[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_bin2, row, &tabrow->bin[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_ccdoffset[0], row, &tabrow->ccdoffset[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);		
	c_tbegti (tabinfo->tp, tabinfo->cp_ccdoffset[1], row, &tabrow->ccdoffset[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_ccdoffset[2], row, &tabrow->ccdoffset[2]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);		
	c_tbegti (tabinfo->tp, tabinfo->cp_ccdoffset[3], row, &tabrow->ccdoffset[3]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegtr (tabinfo->tp, tabinfo->cp_bias[0], row, &tabrow->bias[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_bias[1], row, &tabrow->bias[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_bias[2], row, &tabrow->bias[2]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_bias[3], row, &tabrow->bias[3]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
		
	c_tbegtr (tabinfo->tp, tabinfo->cp_atodgain[0], row, &tabrow->atodgain[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_atodgain[1], row, &tabrow->atodgain[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_atodgain[2], row, &tabrow->atodgain[2]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_atodgain[3], row, &tabrow->atodgain[3]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegtr (tabinfo->tp, tabinfo->cp_readnoise[0], row, &tabrow->readnoise[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_readnoise[1], row, &tabrow->readnoise[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_readnoise[2], row, &tabrow->readnoise[2]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegtr (tabinfo->tp, tabinfo->cp_readnoise[3], row, &tabrow->readnoise[3]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_ampx, row, &tabrow->ampx);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_ampy, row, &tabrow->ampy);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
		
	c_tbegtr (tabinfo->tp, tabinfo->cp_saturate, row, &tabrow->saturate);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	return (status);
}
Ejemplo n.º 25
0
static int GetHalo (char *name, ScatterFunctions *scf,
                    Image *halo1, Image *halo2, Image *halo3) {

/*
char *name;             i: name of HALOTAB reference file
ScatterFunctions *scf;  o: data structure with scattering functions
Image *halo1,2,3;       o: halo images, previously initialized
*/

        IRAFPointer tp;
        IRAFPointer cp_optelem, cp_refwave, cp_haldim, cp_halo;
        char opt_elem[STIS_CBUF];
        int row, nrows, i, status, k, haldim;
        double rw;

        int Alloc2DImage (Image *, int, int);

        tp = c_tbtopn (name, IRAF_READ_ONLY, 0);
        if (c_iraferr()) {
            printf ("ERROR    HALOTAB `%s' not found\n", name);
            return (OPEN_FAILED);
        }
        nrows = c_tbpsta (tp, TBL_NROWS);
        c_tbcfnd1 (tp, "OPT_ELEM", &cp_optelem);
        c_tbcfnd1 (tp, "HALOWAVE", &cp_refwave);
        c_tbcfnd1 (tp, "HALDIM",   &cp_haldim);
        c_tbcfnd1 (tp, "HALO",     &cp_halo);
        if (cp_optelem == 0 || cp_refwave == 0 ||
            cp_haldim  == 0 || cp_halo    == 0) {
            printf( "ERROR    Column not found in HALOTAB\n");
            c_tbtclo (tp);
            return (COLUMN_NOT_FOUND);
        }

        k = 0;
        for (row = 1; row <= nrows ; row++) {

            c_tbegtt (tp, cp_optelem, row, opt_elem, STIS_CBUF-1);
            c_tbegtd (tp, cp_refwave, row, &rw);
            if (c_iraferr())
                return (TABLE_ERROR);

            if ((rw == scf->kernw[k]) &&
                (streq_ic (opt_elem, scf->opt_elem))) {

                c_tbegti (tp, cp_haldim, row, &haldim);

                /* This awful code is a consequence of the
                   change in reference file format that took place
                   after the original code was completed.
                */
                switch (k) {
                case 0:
                    if ((status = Alloc2DImage (halo1, haldim, haldim)))
                        return (status);
                    i = c_tbagtr (tp, cp_halo, row, halo1->pix, 1, halo1->npix);
                    if (c_iraferr())
                        return (TABLE_ERROR);
                    break;
                case 1:
                    if ((status = Alloc2DImage (halo2, haldim, haldim)))
                        return (status);
                    i = c_tbagtr (tp, cp_halo, row, halo2->pix, 1, halo2->npix);
                    if (c_iraferr())
                        return (TABLE_ERROR);
                    break;
                case 2:
                    if ((status = Alloc2DImage (halo3, haldim, haldim)))
                        return (status);
                    i = c_tbagtr (tp, cp_halo, row, halo3->pix, 1, halo3->npix);
                    if (c_iraferr())
                        return (TABLE_ERROR);
                    break;
                default:
                    break;
                }

                k++;
            }
        }

        if (k == 0) {
            printf ("ERROR    No matching rows in HALOTAB `%s'\n", name);
            return (TABLE_ERROR);
        }

        c_tbtclo (tp);
        return (STIS_OK);
}
Ejemplo n.º 26
0
static int GetPSF (char *name, Hdr *phdr, double xsize, double ysize,
                   ScatterFunctions *scf,
                   Image *psf1, Image *psf2, Image *psf3) {

/*
char *name;             i: name of TELTAB reference file
Hdr *phdr               i: primary header
double xsize, ysize;    i: aperture size in arcsec
ScatterFunctions *scf;  o: data structure with scattering functions
Image *psf1,2,3;        o: PSF images, previously initialized
*/
        IRAFPointer tp;
        IRAFPointer cp_refwave, cp_pscale, cp_psfdim, cp_telepsf;
        int row, nrows, psfdim;
        double rw, psfscale;
        Image ospsf;
        Image imtemp, psf;
        char keyword[STIS_CBUF];
        double xplate, yplate;
        double sbox, lbox;
        double rstart, rstop;
        double frac1, frac2;
        float fhold;
        double sum;
        int i, j, k, kk, ms, ml, ns, nl, s, l;
        int ns2, nl2, s1, s2, l1, l2;
        int istart, istop;
        int status;

        int Alloc1DImage (Image *, int);
        int Alloc2DImage (Image *, int, int);
        void InitImage (Image *);
        void FreeImage (Image *);

        /* Define plate scale. */

        if (streq_ic (scf->opt_elem, "E140M"))
            xplate = 0.036;
        else if (streq_ic (scf->opt_elem, "E140H"))
            xplate = 0.0466;
        else if (streq_ic (scf->opt_elem, "E230M"))
            xplate = 0.033;
        else if (streq_ic (scf->opt_elem, "E230H"))
            xplate = 0.0466;
        else {
            printf ("Non supported grating.\n");
            return (ERROR_RETURN);
        }
        yplate = 0.029;

        /* Truncate the aperture size if it extends beyond the borders
           of an image.
        */

        /* See if uniformly illuminated aperture was used. */

        if ((status = Get_KeyS (phdr, "SCLAMP", 0, "", keyword, STIS_CBUF)))
            return (status);
        if (!streq_ic (keyword, "NONE")) {
            ml = (int)floor (ysize / yplate);
            if (ml % 2) {
                status  = Alloc1DImage (psf1, ml+1);
                status |= Alloc1DImage (psf2, ml+1);
                status |= Alloc1DImage (psf3, ml+1);
                if (status)
                    return (status);
                for (i = 1; i < ml; i++) {
                    psf1->pix[i] = 1.0 / ml;
                    psf2->pix[i] = 1.0 / ml;
                    psf3->pix[i] = 1.0 / ml;
                }
                psf1->pix[0]  = 0.5 / ml;
                psf1->pix[ml] = 0.5 / ml;
                psf2->pix[0]  = 0.5 / ml;
                psf2->pix[ml] = 0.5 / ml;
                psf3->pix[0]  = 0.5 / ml;
                psf3->pix[ml] = 0.5 / ml;
            } else {
                status  = Alloc1DImage (psf1, ml);
                status |= Alloc1DImage (psf2, ml);
                status |= Alloc1DImage (psf3, ml);
                if (status)
                    return (status);
                for (i = 0; i < ml; i++) {
                    psf1->pix[i] = 1.0 / ml;
                    psf2->pix[i] = 1.0 / ml;
                    psf3->pix[i] = 1.0 / ml;
                }
            }
            return (STIS_OK);
        }

        /* Scan reference file and process each PSF. */

        tp = c_tbtopn (name, IRAF_READ_ONLY, 0);
        if (c_iraferr()) {
            printf ("ERROR    TELTAB `%s' not found\n", name);
            return (OPEN_FAILED);
        }
        nrows = c_tbpsta (tp, TBL_NROWS);
        c_tbcfnd1 (tp, "PSFWAVE", &cp_refwave);
        c_tbcfnd1 (tp, "PSCALE",  &cp_pscale);
        c_tbcfnd1 (tp, "PSFDIM",  &cp_psfdim);
        c_tbcfnd1 (tp, "TELEPSF", &cp_telepsf);
        if (cp_refwave == 0 || cp_psfdim  == 0 ||
            cp_pscale  == 0 || cp_telepsf == 0) {
            printf( "ERROR    Column not found in TELTAB\n");
            c_tbtclo (tp);
            return (COLUMN_NOT_FOUND);
        }

        kk = 0;
        for (row = 1; row <= nrows ; row++) {

            c_tbegtd (tp, cp_refwave, row, &rw);
            if (c_iraferr())
                return (TABLE_ERROR);

            /* Matching reference wavelenghts. */

            if (rw == scf->psfw[kk]) {

                /* Read PSF image and associated data. */

                c_tbegtd (tp, cp_pscale, row, &psfscale);
                c_tbegti (tp, cp_psfdim, row, &psfdim);

                InitImage (&imtemp);
                if ((status = Alloc2DImage (&imtemp, psfdim, psfdim)))
                    return (status);
                i = c_tbagtr (tp, cp_telepsf, row, imtemp.pix, 1,
                              imtemp.npix);
                if (c_iraferr())
                    return (TABLE_ERROR);

                /* Find peak. */

                ns = imtemp.nx;
                nl = imtemp.ny;
                fhold = -FLT_MAX;
                for (i = 0; i < ns; i++) {
                    for (j = 0; j < nl; j++) {
                        if (PIX (imtemp, i, j) > fhold) {
                            s = i;
                            l = j;
                            fhold = PIX (imtemp, i, j);
                        }
                    }
                }

                /* Determine portion of PSF that made it through aperture. */

                ns2 = ((int)NINT (xsize / psfscale)) / 2;
                nl2 = ((int)NINT (ysize / psfscale)) / 2;
                s1  = ((s - ns2) >= 0) ? (s - ns2) : 0;
                s2  = ((s + ns2) <= (ns - 1)) ? (s + ns2) : (ns - 1);
                l1  = ((l - nl2) >= 0) ? (l - nl2) : 0;
                l2  = ((l + nl2) <= (nl - 1)) ? (l + nl2) : (nl - 1);

                /* Extract sub-image. */

                InitImage (&ospsf);
                if ((status = Alloc2DImage (&ospsf, s2 - s1 + 1, l2 - l1 + 1)))
                    return (status);
                k = 0;
                /* location of braces looks like a typo, but harmless */
                for (j = l1; j <= l2; j++)
                    for (i = s1; i <= s2; i++) {
                        ospsf.pix[k++] = PIX (imtemp, i, j);
                }
                FreeImage (&imtemp);
                ns = ospsf.nx;
                nl = ospsf.ny;

                /* # of STIS pixels (ms*ml) illuminated by aperture. */

                /* modified on 2013 Nov 13 by PEH
                   xplate / psfscale and yplate / psfscale are the factors
                   by which the PSF in the _tel.fits file are oversampled.
                */
                ms = (NINT (ns / (xplate / psfscale))) / 2;
                ml = (NINT (nl / (yplate / psfscale))) / 2;
                ms = 2 * ms + 1;
                ml = 2 * ml + 1;

                /* Bin oversampled PSF to STIS pixel scale. */

                /* Bin columns. */

                if ((status = Alloc2DImage (&imtemp, ms, nl)))
                    return (status);
                sbox = ns / (double)ms;
                for (i = 0; i < ms; i++) {
                    rstart = i     * sbox;
                    rstop  = (i+1) * sbox;
                    istart = (int) floor (rstart);
                    istop  = (int) floor (rstop);
                    istop = (istop < ns) ? istop : ns-1;
                    frac1 = rstart - istart;
                    frac2 = 1.0 - (rstop - istop);
                    for (j = 0; j < nl; j++) {
                        for (k = istart+1; k < istop;
                            PIX (imtemp, i, j) += PIX (ospsf, k++, j));
                        PIX (imtemp, i, j) += PIX (ospsf, istart, j) *
                                              (1.0 - frac1);
                        PIX (imtemp, i, j) += PIX (ospsf, istop,  j) *
                                              (1.0 - frac2);
                    }
                }
                FreeImage (&ospsf);

                /* Bin rows. */

                InitImage (&psf);
                if ((status = Alloc2DImage (&psf, ms, ml)))
                    return (status);
                lbox = nl / (double)ml;
                for (j = 0; j < ml; j++) {
                    rstart = j     * lbox;
                    rstop  = (j+1) * lbox;
                    istart = (int) floor (rstart);
                    istop  = (int) floor (rstop);
                    istop = (istop < nl) ? istop : nl-1;
                    frac1 = rstart - istart;
                    frac2 = 1.0 - (rstop - istop);
                    for (i = 0; i < ms; i++) {
                        for (k = istart+1; k < istop;
                             PIX (psf, i, j) += PIX (imtemp, i, k++));
                        PIX (psf, i, j) += PIX (imtemp, i, istart) *
                                            (1.0 - frac1);
                        PIX (psf, i, j) += PIX (imtemp, i, istop) *
                                            (1.0 - frac2);
                    }
                }
                FreeImage (&imtemp);

                /* Normalize PSF to unit area. */

                sum = 0.0;
                for (i = 0; i < psf.npix; sum += psf.pix[i++]);
                for (i = 0; i < psf.npix; psf.pix[i++] /= sum);

                /* This awful code is a consequence of the
                   change in reference file format that took place
                   after the original code was completed.
                */
                switch (kk) {
                case 0:
                    if ((status = Alloc2DImage (psf1, psf.nx, psf.ny)))
                        return (status);
                    for (i= 0 ; i < psf1->npix; i++)
                        psf1->pix[i] = psf.pix[i];
                    break;
                case 1:
                    if ((status = Alloc2DImage (psf2, psf.nx, psf.ny)))
                        return (status);
                    for (i= 0 ; i < psf2->npix; i++)
                        psf2->pix[i] = psf.pix[i];
                    break;
                case 2:
                    if ((status = Alloc2DImage (psf3, psf.nx, psf.ny)))
                        return (status);
                    for (i= 0 ; i < psf3->npix; i++)
                        psf3->pix[i] = psf.pix[i];
                    break;
                default:
                    break;
                }

                FreeImage (&psf);
                kk++;
            }
        }

        if (kk == 0) {
            printf ("ERROR    No matching rows in TELTAB `%s'\n", name);
            return (TABLE_ERROR);
        }

        c_tbtclo (tp);
        return (STIS_OK);
}
Ejemplo n.º 27
0
static int ReadOverTab (TblInfo *tabinfo, int row, TblRow *tabrow) {

	extern int status;

	c_tbegtt (tabinfo->tp, tabinfo->cp_amp, row,
			tabrow->ccdamp, ACS_CBUF-1);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_chip, row, &tabrow->chip);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
		
	c_tbegti (tabinfo->tp, tabinfo->cp_binx, row, &tabrow->bin[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);		
	c_tbegti (tabinfo->tp, tabinfo->cp_biny, row, &tabrow->bin[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
		
	c_tbegti (tabinfo->tp, tabinfo->cp_nx, row, &tabrow->nx);
	if (c_iraferr())
	    return (status = TABLE_ERROR);	
	c_tbegti (tabinfo->tp, tabinfo->cp_ny, row, &tabrow->ny);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_trimx1, row, &tabrow->trimx[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_trimx2, row, &tabrow->trimx[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_trimy1, row, &tabrow->trimy[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_trimy2, row, &tabrow->trimy[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_vx1, row, &tabrow->vx[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_vx2, row, &tabrow->vx[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_vy1, row, &tabrow->vy[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);
	c_tbegti (tabinfo->tp, tabinfo->cp_vy2, row, &tabrow->vy[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_biassecta1, row, &tabrow->biassecta[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_biassecta2, row, &tabrow->biassecta[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_biassectb1, row, &tabrow->biassectb[0]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);

	c_tbegti (tabinfo->tp, tabinfo->cp_biassectb2, row, &tabrow->biassectb[1]);
	if (c_iraferr())
	    return (status = TABLE_ERROR);


	return (status);
}
Ejemplo n.º 28
0
/*  rejpar_in -- Read parameters either from user input or table.

  Description:
  ------------
  Reads CL parameters and does necessary checkings
  
  Input parameters from crrej reference table:
  -------------------------------------------
  Col. Name     Parameter
  "skysub"      sky         Sky levels subtraction scheme
  "crsigmas"    sigmas      Rejection thresholds
  "crradius"    radius      Radius (in pixels) to propagate the cosmic ray
  "crthresh"    thresh      Propagation factor
  "initgues"    initgues    Scheme of computing initial-guess image
  "scalense"    scalense    multiplicative noise in percents
  "badinpdq"    badinpdq    Data quality pset
  "crmask"      mask        flag CR-rejected pixels in input files?

  Input parameters from input image primary header:
  ------------------------------------------------


  Date          Author          Description
  ----          ------          -----------
  24-Sep-1998   W.J. Hack       Initial ACS Version	
*/
int rejpar_in (clpar *par, int newpar[], int nimgs, float exptot, int *niter, float sigma[])
{
    extern int status;

    IRAFPointer     tp;
    IRAFPointer     colptr, colptr1;
    int             i, nrows, nmatch, row;
    int             crsplit_in, crsplit, maxcrsplit;
    float           exp_in, meanexp, mindiff, diff;
    char            maskstr[ACS_CBUF+1];

    void    PrRefInfo (char *, char *, char *, char *, char *);
    void    WhichError (int);

/* -------------------------------- begin ---------------------------------- */

    crsplit_in = nimgs;

    exp_in = exptot / (float) crsplit_in;
    par->meanexp = exp_in;

    /* if all parameters are specified by the user, no need to open the 
	    reference CRREJ table */
    if (newpar[0] < MAX_PAR) {

        tp = c_tbtopn (par->tbname, IRAF_READ_ONLY, 0);
            if (c_iraferr() != 0) {
                sprintf (MsgText,"CRREJTAB table '%s' does not exist", par->tbname);
                trlerror (MsgText);
                return (status = TABLE_ERROR);
            }
        nrows = c_tbpsta (tp, TBL_NROWS);

        /* read the columns CRSPLIT and MEANEXP */
        c_tbcfnd1 (tp, "crsplit", &colptr);
        if (colptr == 0) {
            trlerror ("column CRSPLIT does not exist in CRREJTAB");
            return (status = COLUMN_NOT_FOUND);
        }
        c_tbcfnd1 (tp, "meanexp", &colptr1);
        if (colptr1 == 0) {
            trlerror ("column MEANEXP does not exist in CRREJTAB\n");
            return (status = COLUMN_NOT_FOUND);
        }
        nmatch = 0;

        /* find the largest value in the CRSPLIT column */
        for (i = 1; i <= nrows; i++) {
            c_tbegti (tp, colptr, i, &crsplit);
            if (i == 1) maxcrsplit = crsplit;
            if (crsplit > maxcrsplit)
            maxcrsplit = crsplit;
        }
        if (crsplit_in >= maxcrsplit) crsplit_in = maxcrsplit;

        /* find the matching row in CRREJTAB to use */
        for (i = 1; i <= nrows; i++) {
            c_tbegti (tp, colptr, i, &crsplit);
            c_tbegtr (tp, colptr1, i, &meanexp);
            diff = meanexp - exp_in;
            if (crsplit_in == crsplit && diff >= 0.) {
                nmatch++;
                if (nmatch == 1) mindiff = diff;
                if (diff <= mindiff) {
                    row = i;
                    mindiff = diff;
                }
            }
        }
        if (nmatch == 0) {
            trlerror (" No matching CRSPLIT and MEANEXP in CRREJTAB");
            return (status = ROW_NOT_FOUND);
        }

        /* read the sigmas parameter */ 
        if (newpar[CRSIGMAS] == 0) {
            c_tbcfnd1 (tp, "crsigmas", &colptr);
            if (colptr == 0) {
                trlerror ("column CRSIGMAS does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegtt (tp, colptr, row, par->sigmas, ACS_LINE);
        }

        /* read other parameters */
        if (newpar[SKYSUB] == 0) {
            c_tbcfnd1 (tp, "skysub", &colptr);
            if (colptr == 0) {
                trlerror ("column SKYSUB does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegtt (tp, colptr, row, par->sky, ACS_FITS_REC);
        }

        /* CR propagation parameters */
        if (newpar[CRRADIUS] == 0) {
            c_tbcfnd1 (tp, "crradius", &colptr);
            if (colptr == 0) {
                trlerror ("column CRRADIUS does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegtr (tp, colptr, row, &par->radius);
        }
        if (newpar[CRTHRESH] == 0) {
            c_tbcfnd1 (tp, "crthresh", &colptr);
            if (colptr == 0) {
                trlerror ("column CRTHRESH does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegtr (tp, colptr, row, &par->thresh);
        }

            /* figure out how to do initial comparison image */
        if (newpar[INITGUES] == 0) {
            c_tbcfnd1 (tp, "initgues", &colptr);
            if (colptr == 0) {
                trlerror ("column INITGUES does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegtt (tp, colptr, row, par->initgues, ACS_FITS_REC);
        }

        /* read the noise model */
        if (newpar[SCALENSE] == 0) {
            c_tbcfnd1 (tp, "scalense", &colptr);
            if (colptr == 0) {
                trlerror ("column SCALENSE does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegtr (tp, colptr, row, &par->scalense);
        }

        if (newpar[BADINPDQ] == 0) {
            c_tbcfnd1 (tp, "badinpdq", &colptr);
            if (colptr == 0) {
                trlerror ("column BADINPDQ does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegts (tp, colptr, row, &par->badinpdq);
        }

        if (newpar[CRMASK] == 0) {
            c_tbcfnd1 (tp, "crmask", &colptr);
            if (colptr == 0) {
                trlerror ("column CRMASK does not exist in CRREJTAB");
                return (status = COLUMN_NOT_FOUND);
            }
            c_tbegti (tp, colptr, row, &par->mask);
        }

        c_tbtclo (tp);
    }

    PrRefInfo ("crrejtab", par->tbname, "", "", "");
    
    /* parse the sigmas string into numbers */
    *niter = strtor (par->sigmas, sigma);
    if (status != ACS_OK) {
        WhichError (status);
        return (status);
    }
    
    if (*niter > MAX_ITER) {
        sprintf (MsgText,"No more than %d iterations permitted.", MAX_ITER);
        trlerror (MsgText);
        return (status = ERROR_RETURN);
    }
    if (*niter <= 0) {
        trlerror ("Number of iterations is ZERO.");
        return (status = ERROR_RETURN);
    }

    /* other fixed (for now) parameters */
    par->crval = (short) DATAREJECT;
    par->fillval = 0.;
    
    /* print out which parameter are used */
    if (par->verbose) {
        sprintf (MsgText,"\n number of images = %d", nimgs);
        trlmessage (MsgText);
        sprintf (MsgText," CRREJ ref table used: %s", par->tbname);
        trlmessage (MsgText);
        sprintf (MsgText," initial guess method: %s", par->initgues);
        trlmessage (MsgText);
        sprintf (MsgText," total exposure time = %0.1f", exptot);
        trlmessage (MsgText);
        sprintf (MsgText," sigmas used: %s", par->sigmas);
        trlmessage (MsgText);
        sprintf (MsgText," sky subtraction used: %s", par->sky);
        trlmessage (MsgText);
        sprintf (MsgText," rejection radius = %0.1f", par->radius);
        trlmessage (MsgText);
        sprintf (MsgText," propagation threshold = %0.1f", par->thresh);
        trlmessage (MsgText);
        sprintf (MsgText," scale noise = %0.1f%%", par->scalense);
        trlmessage (MsgText);
        sprintf (MsgText," input bad bits value = %d", par->badinpdq);
        trlmessage (MsgText);
        
        if (par->mask == 1) {
            strcpy (maskstr,"YES");
        } else {
            strcpy (maskstr, "NO");
        }
        sprintf (MsgText," reset crmask = %s\n", maskstr);
        trlmessage (MsgText);
    }
    return (status);
}
Ejemplo n.º 29
0
int c_tbeGetInt (const IRAFPointer tp, const IRAFPointer cp, int row)
{
	int ret = 0;
	c_tbegti(tp, cp, row, &ret);
	return ret;
}