SURFLIB_PROCESS_BOLS

Calculate apparent RA/Dec of bolometers and some extra processing

Description:

This routine calculates the apparent RA and Dec of each bolometer for all measurements, integrations and exposures. Both JIGGLE and SCAN data are supported. In addition, if this is called from EXTINCTION (ie EXTINCTION=.TRUE.) the data is corrected for extinction using the calculated elevation of the bolometers. If EXTINCTION is .FALSE. all the bolometers positions are converted to apparent RA-Dec at the reference modified Julian date (given by MJD_STANDARD).

There is some complication for moving sources (use PL output coords):

For JIGGLE:

For SCAN:

This is all because the file stores RA start and end relative to the fixed centre at the start of the observation.

Invocation

CALL SURFLIB_PROCESS_BOLS(TSKNAME, N_BEAMS, N_BOL, N_POS, N_POS_BEAMS, N_SWITCHES, N_EXPOSURES, N_INTEGRATIONS, N_MEASUREMENTS,START_EXP, END_EXP, START_INT, END_INT, START_MEAS, END_MEAS,N_MAP, N_FITS, FITS, DEM_PNTR, LST_STRT, IN_ROTATION, SAMPLE_MODE, SAMPLE_COORDS, OUT_COORDS, JIGGLE_REPEAT, JIGGLE_COUNT, JIGGLE_X, JIGGLE_Y, JIGGLE_P_SWITCH, RA_CEN, DEC_CEN, RA1, RA2, DEC1, DEC2, MJD_STANDARD, IN_UT1, MJD1, LONG1, LAT1, MJD2, LONG2, LAT2, LOCAL_COORDS, MAP_X, MAP_Y, N_POINT, POINT_LST, POINT_DAZ, POINT_DEL, NUM_CHAN, NUM_ADC, BOL_ADC, BOL_CHAN, BOL_DU3, BOL_DU4, SCAN_REVERSAL, FIRST_LST, SECOND_LST, FIRST_TAU, SECOND_TAU, BOL_DEC, BOL_RA, NDATA, NVARIANCE, USE_LST, LST_DATA, WAVEPLATE_ANG, BOL_IP_DATA, STATUS)

Arguments

TSKNAME = _CHAR (Given)
Taskname that is used to determine whether certain parts of the code are executed. Special values are: SCUOVER - when using SCUOVER this prevents the EXP_START loop from running properly. Only a single set of bolometer positions are returned. EXTINCTION - corrects the input data for extinction REMIP - Corrects the input data for instrumental polarisation All other values for this parameter assume that the bolometer positions are to be calculated and returned (converted to a standard MJD)
N_BEAMS = _INTEGER (Given)
Number of beams in the input data. Only used if EXTINCTION=.TRUE.
N_BOL = _INTEGER (Given)
Number of bolometers in the input data
N_POS = _INTEGER (Given)
Number of ‘samples’ taken
N_POS_BEAMS = INTEGER (Given & Returned)
Number of beam positions to be returned per point. Can only be reduced. If equals 3 then order is M,L,R
N_SWITCHES = _INTEGER (Given)
Number of switches
N_EXPOSURES = _INTEGER (Given)
Number of exposures
N_INTEGRATIONS = _INTEGER (Given)
Number of integrations
N_MEASUREMENTS = _INTEGER (Given)
Number of measurements
START_EXP = INTEGER (Given)
First exposure to process
END_EXP = INTEGER (Given)
Last exposure to process
START_INT = INTEGER (Given)
First integration to process
END_INT = INTEGER (Given)
End integration to process
START_MEAS = INTEGER (Given)
First measurement to process
END_MEAS = INTEGER (Given)
End measurement to process
N_MAP = _INTEGER (Given)
Map number of input data (not used for EXTINCTION or REMIP)
N_FITS = _INTEGER (Given)
Number of FITS items
FITS() = _CHAR80 (Given)
FITS array
DEM_PNTR() = _INTEGER (Given)
DEM_PNTR array - position in file of each exposure
LST_STRT() = _DOUBLE (Given)
LST of each exposure
IN_ROTATION = _DOUBLE (Given)
Angle between apparent N and N of input coord system (radians)
SAMPLE_MODE = _CHAR (Given)
Sample mode of input file
SAMPLE_COORDS = _CHAR (Given)
Coordinate system of sample offsets
OUT_COORDS = _CHAR (Given)
Output coordinate system
JIGGLE_REPEAT = _INTEGER (Given)
Number of times jiggle pattern is repeated in a switch
JIGGLE_COUNT = _INTEGER (Given)
Number of jiggle in pattern
JIGGLE_X(JIGGLE_COUNT) = _REAL (Given)
X jiggle offsets (arcsec)
JIGGLE_Y(JIGGLE_COUNT) = _REAL (Given)
Y jiggle offsets (arcsec)
JIGGLE_P_SWITCH = _INTEGER
Number of jiggles per switch
RA_CEN = _DOUBLE (Given)
apparent RA of output map centre (radians). Used mainly for JIGGLE but also for scan/map data pre Dec 1997
DEC_CEN = _DOUBLE (Given)
apparent Dec of output map centre (radians) Used mainly for JIGGLE but also for scan/map data pre Dec 1997
RA1 = _REAL (Given)
RA (in RD, RJ or AZ) at start of scan for each exposure (SCAN only)
RA2 = _REAL (Given)
RA (in RD, RJ or AZ) at end of scan for each exposure (SCAN only)
DEC1 = _REAL (Given)
DEC (in RJ, RD or AZ) at start of scan for each exposure (SCAN only)
DEC2 = _REAL (Given)
DEC (in RD, RJ, AZ) at end of scan for each exposure (SCAN only)
MJD_STANDARD = _DOUBLE (Given)
Standard MJD to which each input map is referenced (EXTINCTION=FALSE)
IN_UT1 = _DOUBLE (Given)
MJD of input data.
MJD1 = DOUBLE (Given)
MJD of first planet position
LONG1 = DOUBLE (Given)
Longitude (apparent RA) at MJD1
LAT1 = DOUBLE (Given)
Latitude (apparent Dec) at MJD1
MJD2 = DOUBLE (Given)
MJD of second planet position
LONG2 = DOUBLE (Given)
Longitude (apparent RA) at MJD2
LAT2 = DOUBLE (Given)
Latitude (apparent Dec) at MJD2
LOCAL_COORDS = CHARACTER (Given)
Coordinate system of offsets
MAP_X = DOUBLE (Given)
X offset in LOCAL_COORDS (radians)
MAP_Y = DOUBLE (Given)
Y offset in LOCAL_COORDS (radians)
N_POINT = _INTEGER (Given)
Number of pointing corrections (should be zero if EXTINCTION)
POINT_DEL = _REAL (Given)
Elevation pointing corrections (radians) [only if EXTINCTION=FALSE]
POINT_DAZ = _REAL (Given)
Azimuth pointing corrections (radians) [only if EXTINCTION=FALSE]
POINT_LST = _DOUBLE (Given)
LST of pointing corrections (radians) [only if EXTINCTION=FALSE]
NUM_CHAN = _INTEGER (Given)
Number of channels in DAQ
NUM_ADC = _INTEGER (Given)
Number of AtoD cards.
BOL_ADC = _INTEGER (Given)
A/D numbers of bolometers measured in input file
BOL_CHAN = _INTEGER (Given)
channel numbers of bolometers measured in input file
BOL_DU3 = _REAL (Given)
dU3 Nasmyth coordinates of bolometers
BOL_DU4 = _REAL (Given)
dU4 Nasmyth coordinates of bolometers
SCAN_REVERSAL = LOGICAL (Given)
Multiply alternate exposures by -1 if SCANning
FIRST_LST = _DOUBLE (Given)
LST of first tau value (EXTINCTION only)
SECOND_LST = _DOUBLE (Given)
LST of second tau value (EXTINCTION only)
FIRST_TAU = _REAL (Given)
First tau value (EXTINCTION only)
SECOND_TAU = _REAL (Given)
Second tau value (EXTINCTION only)
BOL_DEC(N_BOL, N_POS, N_POS_BEAMS) = _DOUBLE (Returned)
Apparent DEC of bolometers for each measurement for MJD_STANDARD Depending on N_POS_BEAMS can contain M, L and R beam positions.
BOL_RA(N_BOL, N_POS, N_POS_BEAMS) = _DOUBLE (Returned)
Apparent RA of bolometers for each measurement for MJD_STANDARD Depending on N_POS_BEAMS can contain M, L and R beam positions.
NDATA(N_BOL, N_POS, N_BEAMS) = _REAL (Given & Returned)
corrected data (EXTINCTION and REMIP only)
NVARIANCE(N_BOL, N_POS, N_BEAMS) = _REAL (Given & Returned)
Extinction corrected variance (EXTINCTION only)
USE_LST = LOGICAL (Given)
Do we return the LST positions? (TRUE then we do)
LST_DATA(N_POS) = DOUBLE (Returned)
LST for each position.
WAVEPLATE_ANG = REAL (Given)
waveplate position angle (Nasmyth degrees) (Given & Returned) The supplied value is the nasmyth angle in degrees and the return value the sky rotation angle for each position. (ie parallactic angle - elevation) in degrees (REMIP only)
BOL_IP_DATA(8, NUM_CHAN, NUM_ADC) = REAL (Given)
The IP data. This array contains the ip data for each bolometer (specified by a combination of CHAN and ADC). The 4 slices represent: P0, Pslope, Theta0 and ThetaSlope (REMIP only) The next 4 slices are for the related variance (same order)
STATUS = _INTEGER (Given & Returned)
Global status

Notes:

MAP_X and MAP_Y are only used for JIGGLE modes. The SCAN/MAP offsets are wrapped into the RA1,DEC1,RA2,DEC2 numbers by the on-line system. The offsets are added to the map centre every time round the loop. This is because it is possible to have AZ offsets for RA,Dec centres.

This routine tries to deal with the different versions of SCUCD (only affects SCAN/MAP data). For version 0:

RA/Decs of the scan were incorrectly stored as RJ. They are converted to RD before further processing. The coordinate frame of RA1, RA2, DEC1 and DEC2 fro SCAN/MAP depends on the CENTRE_COORDS of the observation. For CENTRE=RD the scan positions are in RD; for CENTRE=RB,RJ,GA the scans are in RJ and for centre=AZ the scans are in AZ. (SCULIB_SCAN_2_RD)

For version 1.0:

A bug was introduced concerning the calculation of the ends of the scans. The bug is recreated and inverted in order to compensate. (SCULIB_FIX_SCAN_V10)

Also, LO chopping for jiggle maps was broken until 19980730 such that the initial chop pa was calculated in Az but never updated as the sky rotated. This fix is only important for SCUBA2MEM where the positions of the off-beams are returned.

Bugs:

Currently the IN_UT1 is assumed to be the MJD when the data taking begins. As of 24-NOV-1997 IN_UT1 is actually the MJD of the start of the observation (ie when the telescope begins to slew). This is a problem for data using a moving centre.