SUBROUTINE VSCATT * * Module number: 15.14 * * Module name: scatterv * * Keyphrase: * ---------- * exhibit scattered flux due to a point source as a function of angular * distance from it. * * Description: * ------------ * The observation ID of direct target observation has to be input from PAR * file ("reference obs ID"). * Maximum number of input data points is 1000. * * FORTRAN name: VSCATT.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * Subroutines Called: * ------------------- * CDBS: * VSCTGT, VSCTPT * SDAS: * UMSPUT * Others: * None * * History: * -------- * Version Date Author Description * 1 06-29-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), * --reference count rate and its standard * --deviation : REFCT, DREFCT, * --temperature : TEMP(1000), * --position angles and their sines and * --cosines : PA(1000), SINPA, COSPA, * --flux ratios and their standard * --deviations : RATIO(1000), DRATIO(1000) * --right ascension, declination, and epoch DOUBLE PRECISION RA(1000), DEC(1000), EPOCH(1000), * --reference right ascension and declination : REFRA, REFDEC, * --degrees per radian : RADN, * --angular distances : DIST, DISTD(1000) * --total number of valid input data points INTEGER NPTS, * --loop index : I, * --error status : STATUS, STATOK * --observation ID's and ref obs ID CHARACTER*10 OBSID(1000), REFID * --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 parameter file and input data from input table * CALL VSCTGT (REFID, OBSID, RA, DEC, COUNT, DCOUNT, TEMP, : EPOCH, APER, TARGET, NPTS, OFILE, STATUS) IF (STATUS .NE. OK) THEN CONTXT = 'cannot read input parameters or data' GO TO 999 END IF * * look for the reference observation * DO 10 I = 1, NPTS IF (OBSID(I) .EQ. REFID) THEN REFCT = COUNT(I) DREFCT = DCOUNT(I) REFRA = RA(I) REFDEC = DEC(I) GO TO 20 END IF 10 CONTINUE * * if there is no match for the reference ID, write error message * STATUS = ERRNUM(1) CONTXT = '"' // REFID // '" is not found in the input table' GO TO 999 20 CONTINUE * * calculate ratio between the scattered flux and that directly from the source * RADN = 57.29577951308232088D0 REFRA = REFRA / RADN REFDEC = REFDEC / RADN * DO 30 I = 1, NPTS RATIO(I) = COUNT(I) / REFCT DRATIO(I) = RATIO(I) * SQRT((DCOUNT(I)/COUNT(I))**2 + : (DREFCT/REFCT)**2) * * calculate angular distance (use cosine law) * RA(I) = RA(I) / RADN DEC(I) = DEC(I) / RADN * DIST = ACOS(COS(DEC(I)) * COS(REFDEC) * : COS(RA(I) - REFRA) + : SIN(DEC(I)) * SIN(REFDEC)) DISTD(I) = DIST * RADN * * calculate position angle * IF (DISTD(I) .GT. 1.D-8) THEN SINPA = COS(DEC(I)) * SIN(RA(I) - REFRA) / SIN(DIST) COSPA = (SIN(DEC(I)) - SIN(REFDEC) * COS(DIST)) / : (COS(REFDEC) * SIN(DIST)) PA(I) = ATAN2(SINPA, COSPA) * RADN * * restrict position angles to be in 0 to 360 degrees * IF (PA(I) .LT. 0.) THEN PA(I) = PA(I) + 360. END IF ELSE PA(I) = 0. END IF 30 CONTINUE * * write results to output table * CALL VSCTPT (OFILE, RATIO, DRATIO, DISTD, PA, APER, TARGET, : TEMP, EPOCH, NPTS, : 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 ('VSCATT: ' // CONTXT, DEST, PRIO, STATOK) * 1000 RETURN END