As of Wed Jan 17 16:31:05 2018

BLAPP: Task which applies baseline corrections to CL tables.


INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK            0.0        9.0   Input UV file disk unit #
INVERS                             Input BS table version number
SOURCES                            Source list ' '=>all.
STOKES                             Stokes type to process
SELBAND                            Bandwidth to select (kHz)
SELFREQ                            Frequency to select (MHz)
FREQID                             Freq. ID to select.
TIMERANG                           Time range to use.
ANTENNAS                           Antennas to correct.
SUBARRAY          0.0     9999.0   Subarray; 0 => 1.
REFANT                             Reference antenna
ANTWT                              Antenna weights: 0.0 => 1.0
OPCODE                             Operation code:
                                    'SOLV' - produce solutions
                                    'CAL ' - update calibration
                                    'MK4 ' - MK4IN BS-table
GAINVER           0.0     9999.0   Input CL table: 0 => 1
GAINUSE           0.0     9999.0   Output CL table: 0 => 2
BADDISK                            List of disks not to be used
                                   for scratch


Task:  Reads baseline-based residual phases, group delays and rates
       from a BS table (generated by BLING or MK4IN), obtains
       least-squares solutions for antenna-based quantities as a
       function of time and optionally uses these to update the CL
  INNAME.....Input UV file name (name).      Standard defaults.
  INCLASS....Input UV file name (class).     Standard defaults.
  INSEQ......Input UV file name (seq. #).    0 => highest.
  INDISK.....Disk drive # of input UV file.  0 => any.
  INVERS.....Input BS table version number.  0 => highest
  SOURCES....list of sources to process.
             '*' = all; a "-" before a source name
             means all except ANY source named.
  STOKES.....The desired Stokes types:
             '  '=> 'RRLL' or ''XXYY' depending on whether
             polarizations in the UV data file are circular or linear.
  SELBAND....Bandwidth of the data to be calibrated in kHz.  If there
             is more than one IF present SELBAND matches the bandwidth
             of the first IF selected with BIF and EIF.
             Default: use FREQID parameter.
  SELFREQ....Frequency of the data to be selected in MHz.  If more
             than one IF is present SELFREQ is compared with the first
             requested IF.  Default: use FREQID parameter.
  FREQID.....Frequency group to calibrate.  May be used instead of
             SELBAND and SELFREQ.  If set to -1 SELFREQ and/or SELBAND
             will be used if set otherwise all frequency groups will
             be selected.       0 => 1
  TIMERANG...Time range of the data to be used. In order:
             Start day, hour, min. sec, end day, hour, min. sec. Days
             relative to reference date.
  ANTENNAS...A list of the antennas to be modified.  If any number is
             negative then all antennas listed are NOT to be modified.
             All 0 => use all.
  SUBARRAY...The subarray to modify. Do only one at a time.
  REFANT.....The reference antenna to be used.  0 => pick any.
  ANTWT......Antenna weights.  A default weight of 1.0 is used for any
             entries that are zero or negative.  The weights in the BS
             table are multiplied by the geometric mean of the antenna
             weights for that baseline so that baselines involving
             antennae with greater weights have more influence over
             the solution.
  OPCODE.....Operation code.  If this is 'SOLV' then the solutions
             will be determined and written to an SN table.  If this
             is 'CAL ' then the solutions will be automatically
             applied and no SN table will be kept.    Default: 'SOLV'
             Data from MK4IN must have OPCODE = 'MK4'.
  GAINVER....The version number of the input calibration (CL) table.
             0 => 1.  Times from this table are used to establish
             common times for the solutions from the BS table in case
             the solution times for different baselines are not
             aligned (as will be the case if different solution
             intervals are used for different baselines).
  GAINUSE....The version number of the output CL table.  0 => 2.
             Note that CL table 1 may not be used.
  BADDISK....A list of disks that are not to be used to store
             scratch files.


BLAPP:  Task to apply baseline-based fringe solutions
Documentor:  Chris Flatters, Walter Alef
Related programs:  BLING, MK4IN

BLAPP is used to apply the results of a baseline-based fringe-
search to a uv data set.  Baseline-based data is read from a
BS table for all requested baselines in each scan and fed
to a routine which calculates the least-squares solutions for
the antenna based parameters using singular value decomposition.
This method will work for one or more baselines.  The solutions
are written to an SN table.  After processing all requested scans
BLAPP updates the CL table from the SN table and deletes the SN
table if OPCODE is 'CAL '.

The acceleration term in the BS table is not transferred to the
output CL table or SN table but is used when extrapolating the
BS table solutions to times in the the input CL table.  If you
have a data set where the acceleration term is important the
recommended procedure is to make sure that the CL table records
are closely spaced in time (using INDXR if necessary) before
running BLAPP: the phase corrections in the output file should
then include corrections for the acceleration.

The least-squares solution is performed using the LAPACK routine