SUBROUTINE CALHSP * * Module Number: * * Module Name: CALHSP * * Keyphrase: * ---------- * read tables necessary for the pipeline processing * * Description: * ------------ * * FORTRAN Name: CALHSP.FOR * * Keywords of Accessed Files and Tables: * -------------------------------------- * Name I/O Description / Comments * * input parametres * * 'inroot' I input file root name * 'outroot' I output file root name * * Subroutines Called: * ------------------- * CDBS: * VGTCTB, VCALGT, VCALDO * SDAS: * UUCLGS, UUSLEN, UMSPUT, UERROR * OTHERS: * None * * History: * -------- * Version Date Author Description * 1 08-01-88 J.-C. Hsu Design and coding * 2 01-11-89 J.-C. Hsu no need to read time bias * 3 08-11-89 J.-C. Hsu new temperature dependent dead time * 1.1.2 06-18-91 J.-C. Hsu new icd-19 and synthetic photometry * 1.2.0 11-12-91 J.-C. Hsu fix bug for aperture vf750_f320 * 1.2.1 12-02-91 J.-C. Hsu fix bug for polarizer apertures * 1.2.2 06-12-92 J.-C. Hsu change the minmax calculation to * avoid "out of memory" for big files * 1.3.0 08-22-93 J.-C. Hsu add synphot path history to header *------------------------------------------------------------------------------- * *== local: * --file name of the dark signal table CHARACTER*128 DKTBL, * --file name of the pre-amp noise table : PATBL, * --file name of the high voltage factor table : HVTBL, * --file name of the relative sensitivity * --table : SNTBL, * --file name of the gain factor table : GNTBL, * --file name of the CVC offset table : CVTBL, * --file name of the deadtime table : DTTBL, * --file name of the dark aperture translation * --table : DKATBL, * --file name of the aperture size table : AARTBL, * --root name of the input and output file : ROOT, OROOT * --data source CHARACTER*9 SOURCE * --observation ID CHARACTER*10 OBSID * --maximum dimensions of arrays INTEGER DKDIM, PADIM, HVDIM, SNDIM, : GNDIM, CVDIM, DTDIM, DKADIM, AARDIM, * --string length of the root name : FLEN * --define maximum dimensions of arrays PARAMETER (DKDIM = 300) PARAMETER (PADIM = 40) PARAMETER (HVDIM = 120) PARAMETER (SNDIM = 300) PARAMETER (GNDIM = 100) PARAMETER (CVDIM = 100) PARAMETER (DTDIM = 60) PARAMETER (DKADIM = 200) PARAMETER (AARDIM = 200) * * --aperture names and dark aperture names * --in the dark aperture translation table CHARACTER*10 DKAP(DKADIM), DKNAME(DKADIM), * --aperture names in the aperture area * --table : AREAAP(AARDIM), * --aperture names in each calibration table : DKAPER(DKDIM), SNAPER(SNDIM), * --data types of each calibration table : DKTYPE(DKDIM), PATYPE(PADIM), : HVTYPE(HVDIM) * --detector ID in each calibration table * --(PA = pre-amp, HV = high voltage * --factor, CV = CVC offset, DT = dead * --time, DM = dummy, DK = dark signal, * --GN = gain factor, SN = relative * --sensitivity) INTEGER PADET(PADIM), HVDET(HVDIM), : GNDET(GNDIM), CVDET(CVDIM), : DTDET(DTDIM), DKDET(DKADIM), * --number of rows in dark aperture * --translation table : NDKAP, * --number of rows in aperture area table : NAREA, * --number of data entries in each * --calibration table : NDK, NHV, NPA, NSN, NGN, NCV, NDT * --high voltage settings in each * --calibration table REAL DKHV(DKDIM), HVHV(HVDIM), DTHV(DTDIM), * --gain settings in each calibration table : GNGAIN(GNDIM), CVGAIN(CVDIM), * --discriminator threshold settings in * --the dead time calibration table : DTDISC(DTDIM), * --aperture area in the aperture are table : AREA(AARDIM), * --base values of each calibration table : DKBASE(DKDIM), PABASE(PADIM), : HVBASE(HVDIM), * --relative sensitivity has two base * --values for each set of coefficients : SNBSPT(SNDIM), SNBSEX(SNDIM), : GNBASE(GNDIM), CVBASE(CVDIM), : DTBASE(DTDIM), * --polynominal coefficients of calibration : DKCOFF(16,DKDIM), PACOFF(16,PADIM), : HVCOFF(16,HVDIM), SNCOFF(16,SNDIM), : GNCOFF(16,GNDIM), CVCOFF(16,CVDIM), * --deadtime temperature dependent coeff : DTCOFF(DTDIM), * --zero points of temperature in each * --calibration table : DKTMP0(DKDIM), PATMP0(PADIM), : HVTMP0(HVDIM), SNTMP0(SNDIM), : GNTMP0(GNDIM), CVTMP0(CVDIM), : DTTMP0(DTDIM) * --zero points of epoch in each * --calibration table DOUBLE PRECISION DKEP0(DKDIM), PAEP0(PADIM), : HVEP0(HVDIM), SNEP0(SNDIM), : GNEP0(GNDIM), CVEP0(CVDIM) * --return status INTEGER STATUS, * --return status : STAT(30), STATOK, * --loop indices : I * --error message context CHARACTER*130 CONTXT, MESS *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) * --message destination and priority INTEGER DEST, PRIO DATA OK /0/ DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710, : 711, 712, 713, 714, 715, 716, 717, 718, 719, 720/ DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== *------------------------------------------------------------------------------- * ROOT = ' ' OBSID = ' ' * * announce the version number of this software * CONTXT = OBSID // ' *** CALHSP - Version 1.3.0 ***' CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) * * input parameters * CALL UUCLGS ('inroot', ROOT, STAT(1)) CALL UUCLGS ('outroot', OROOT, STAT(2)) * DO 10 I = 1, 2 IF (STAT(I) .NE. OK) THEN CONTXT = 'cannot get CL parameter(s)' GO TO 999 END IF 10 CONTINUE * * if the outroot is null, output root name is set equal to input root name * IF (OROOT .EQ. ' ') OROOT = ROOT * * determine string length of root name * CALL UUSLEN (ROOT, FLEN) * * get the calibration table names * CALL VGTCTB (ROOT, FLEN, OBSID, AARTBL,HVTBL, GNTBL, PATBL, : SNTBL, DKTBL, CVTBL, DTTBL, DKATBL, SOURCE, : STATUS) * IF (STATUS .NE. OK) THEN CONTXT = 'cannot get calibration table name(s) for root ' : // ROOT GO TO 999 END IF * * for area scans, omit the calibrations * IF (SOURCE(1:4) .EQ. 'AREA') THEN CONTXT = OBSID // ' No calibration is performed for ' : // 'area scan ' CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) GO TO 1000 END IF * * read calibration tables * CALL VCALGT ( : OBSID, DKTBL, PATBL, HVTBL, SNTBL, GNTBL, : CVTBL, DTTBL, DKATBL, AARTBL, : DKDIM, PADIM, HVDIM, SNDIM, GNDIM, : CVDIM, DTDIM, DKADIM, AARDIM, : NDK, NPA, NHV, NSN, NGN, NCV, NDT, NDKAP, NAREA, : PADET, HVDET, GNDET, CVDET, DTDET, : DKAPER, SNAPER, DKAP, DKDET, DKNAME, AREAAP, : DKHV, HVHV, DTHV, GNGAIN, CVGAIN, : DKTYPE, PATYPE, HVTYPE, DTDISC, : DKBASE, PABASE, HVBASE, SNBSPT, SNBSEX, GNBASE, : CVBASE, DTBASE, AREA, : DKCOFF, PACOFF, HVCOFF, SNCOFF, GNCOFF, CVCOFF, : DTCOFF, : DKTMP0, PATMP0, HVTMP0, SNTMP0, GNTMP0, CVTMP0, : DTTMP0, : DKEP0, PAEP0, HVEP0, SNEP0, GNEP0, CVEP0, : STATUS) * IF (STATUS .NE. OK) THEN CONTXT = 'cannot get calibration values ' GO TO 999 END IF * * perform the calibration corrections * CALL VCALDO ( : ROOT, OROOT, FLEN, OBSID, : NDK, NPA, NHV, NSN, NGN, NCV, NDT, NDKAP, NAREA, : PADET, HVDET, GNDET, CVDET, DTDET, : DKAPER, SNAPER, DKAP, DKDET, DKNAME, AREAAP, : DKHV, HVHV, DTHV, GNGAIN, CVGAIN, : DKTYPE, PATYPE, HVTYPE, DTDISC, : DKBASE, PABASE, HVBASE, SNBSPT, SNBSEX, GNBASE, : CVBASE, DTBASE, AREA, : DKCOFF, PACOFF, HVCOFF, SNCOFF, GNCOFF, CVCOFF, : DTCOFF, : DKTMP0, PATMP0, HVTMP0, SNTMP0, GNTMP0, CVTMP0, : DTTMP0, : DKEP0, PAEP0, HVEP0, SNEP0, GNEP0, CVEP0, : STATUS) * IF (STATUS .NE. OK) THEN CONTXT = 'cannot perform calibration' GO TO 999 ELSE CONTXT = OBSID // ' HSP calibration completed with no ' : // 'error' CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) END IF * STATUS = OK GO TO 1000 * * write error message * 999 MESS = OBSID // ' CALHSP: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) CALL UERROR (ROOT) * 1000 RETURN END