SUBROUTINE CDMAP ( * * inputs * : NPTS, DIMMAX, DATA, MASK, OKVAL, HITVAL, : H0, V0, HPT, VPT, HSTPT, VSTPT, INTPT, * * output * : COUNT, DCOUNT, FLAG, X, Y, STATUS) * * Module number: * * Module name: * * Keyphrase: * ---------- * Take the input data/mask address and other parameters to calculate the * coordinates and observed count at each area scan point. * * Description: * ------------ * * FORTRAN name: CDMAP.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * None * * Subroutines Called: * ------------------- * CDBS: * None * SDAS: * UMSPUT * Others: * None * * History: * -------- * Version Date Author Description * 1 01-20-87 J.-C. HSU design and coding * 2 10-20-87 J.-C. HSU F77 SDAS *------------------------------------------------------------------------------- * *== input: * --x and y deflection of the starting point INTEGER H0, V0, * --number of columns and rows of the * --area scan : HPT, VPT, * --horizontal and vertical steps per * --point of the are scan : HSTPT, VSTPT, * --number of integration per point : INTPT, * --total number of data points of the * --input time series : NPTS, * --dimension of COUNT, FLAG, X, and Y * --as declared in the calling routine : DIMMAX * --input data and mask array REAL DATA(1), MASK(1), * --mask value of good data points : OKVAL, * --mask value of particle events : HITVAL * *== output * --observed (average) number of counts, * --its standard error, its flag and its * --coordinates of each point of the scan REAL COUNT(DIMMAX, DIMMAX), DCOUNT(DIMMAX, DIMMAX), : FLAG(DIMMAX, DIMMAX), : X(DIMMAX, DIMMAX), Y(DIMMAX, DIMMAX) * --error status INTEGER STATUS * *== local: * --status and loop indices INTEGER STATOK, I, J, K, * --data point index : INDX, IPT, NP * --summation of data REAL SUM, SUMSQ * --error message context CHARACTER*130 CONTXT, MESS *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) 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/ * --message destination and priority DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== *------------------------------------------------------------------------------ * * check if number of data points input from the FITS header agrees with those * input from the UDL * IF (NPTS .NE. HPT * VPT * INTPT) THEN STATUS = ERRNUM(1) CONTXT = 'numbers of input data points from data file ' : // 'header is different from that from UDL' GO TO 999 END IF * * process each row * DO 30 J = 1, VPT * * process each column * DO 20 K = 1, HPT INDX = (J-1) * HPT + K NP = 0 SUM = 0. SUMSQ = 0. * * average measumements of the same point * DO 10 I = 1, INTPT IPT = INTPT * (INDX - 1) + I IF (MASK(IPT) .NE. HITVAL) THEN SUM = DATA(IPT) + SUM SUMSQ = DATA(IPT) ** 2 + SUMSQ NP = NP + 1 END IF 10 CONTINUE * * at least one measurement of this pixel is good * IF (NP .GT. 0) THEN COUNT(J, K) = SUM / REAL(NP) FLAG(J, K) = OKVAL IF (NP .EQ. 1) THEN DCOUNT(J, K) = SQRT(SUM) ELSE DCOUNT(J, K) = SQRT((SUMSQ / REAL(NP) - : COUNT(J, K) ** 2) / REAL(NP - 1)) END IF * * all measurements of this pixel are bad * ELSE COUNT(J, K) = -1.E-30 DCOUNT(J, K) = 1.E+30 FLAG(J, K) = HITVAL NPTS = NPTS - 1 END IF * X(J, K) = H0 + (K - 1) * VSTPT Y(J, K) = V0 + (J - 1) * HSTPT 20 CONTINUE 30 CONTINUE * * if too few point are usable * IF (NPTS .LT. 9) THEN STATUS = ERRNUM(2) CONTXT = 'total number of usable points is less than 9' GO TO 999 END IF * STATUS = OK GO TO 1000 * 999 MESS = 'CDMAP: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END