SUBROUTINE VFOCUS * * Module number: 15.2.1 * * Module name: focusv * * Keyphrase: * ---------- * determine the optimum electronic focus setting * * Description: * ------------ * Maximum number of input data points is 1000. * * FORTRAN name: VFOCUS.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * Subroutines Called: * ------------------- * CDBS: * VFCGT, VFCOPT, VFCPT * SDAS: * UMSPUT * Others: * None * * History: * -------- * Version Date Author Description * 1 06-01-87 J.-C. HSU design and coding * 2 11-20-87 J.-C. HSU F77 SDAS *------------------------------------------------------------------------------- * *== local: * --count rate and its standard deviation REAL COUNT(1000), DCOUNT(1000), * --focus setting, and temperature : FOCUS(1000), TEMP(1000), * --rejection level : REJECT, * --optimum focus settings : FOCUSF, FOCUSC, * --lower and upper limits of observed * --focus settings : LOWEND, HIEND, * --mean temperature : TMEAN * --epoch DOUBLE PRECISION EPOCH(1000), * --mean epoch : EPMEAN * --total number of valid input data points INTEGER NPTS, * --number of excluded points : NREJ, * --error status : STATUS, * --loop index : I, * --status : STATOK * --aperture name CHARACTER*10 APER(1000) * --target name, CHARACTER*20 TARGET(1000) * --output file name CHARACTER*128 OFILE * --error message context CHARACTER*130 CONTXT *=========================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=========================================== *------------------------------------------------------------------------------ * * input parameters from CL PAR file and input data from input table * CALL VFCGT (COUNT, DCOUNT, FOCUS, TEMP, EPOCH, APER, TARGET, : NPTS, REJECT, OFILE, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot read input parameters or data' GO TO 999 END IF * * find best focus settings * CALL VFCOPT (COUNT, DCOUNT, FOCUS, NPTS, REJECT, : FOCUSF, FOCUSC, NREJ, STATUS) * IF (STATUS .NE. OK) THEN CONTXT = 'unable to find best focus setting' GO TO 999 END IF * * find the range of observed focus settings * LOWEND = FOCUS(1) HIEND = FOCUS(1) * DO 10 I = 1, NPTS IF (FOCUS(I) .LT. LOWEND) THEN LOWEND = FOCUS(I) ELSE IF (FOCUS(I) .GT. HIEND) THEN HIEND = FOCUS(I) END IF 10 CONTINUE * * calculate mean temperature and epoch * TMEAN = 0. EPMEAN = 0.D0 * DO 20 I = 1, NPTS TMEAN = TMEAN + TEMP(I) EPMEAN = EPMEAN + EPOCH(I) 20 CONTINUE * TMEAN = TMEAN / FLOAT(NPTS) EPMEAN = EPMEAN / DBLE(NPTS) * * write results to output table * CALL VFCPT (OFILE, FOCUSF, FOCUSC, APER(1), TARGET(1), : LOWEND, HIEND, REJECT, TMEAN, EPMEAN, : NPTS, NREJ, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot write to output table' GO TO 999 END IF * STATUS = OK GO TO 1000 * * write error message * 999 CALL UMSPUT ('VFOCUS: ' // CONTXT, DEST, PRIO, STATOK) * 1000 RETURN END