As of Mon Jan 22 15:10:48 2018

OOCAL: Determines antenna complex gain w freq-dependent models


                                   Input uv data.
INNAME                                UV file name (name)
INCLASS                               UV file name (class)
INSEQ              0.0      9999.0    UV file name (seq. #)
INDISK             0.0         9.0    UV file disk drive #
OUTNAME                            Name to use for OOSUB output
                                   ' ' -> INNAME
DOKEEP            -1.0         1.0 > 0 -> keep divided us data
                                   Data selection (multisource):
ICHANSEL                           Array of start and stop chn
                                   numbers, plus a channel
                                   increment and IF to be used
                                   for channel selection in the
                                   averaging. See HELP ICHANSEL.
                                   Default = center 75 percent of band.
ANTENNAS                           Antennas to select. 0=all
DOFIT                              Subset of ANTENNAS list for
                                   which solns are desired.
ANTUSE                             Mean gain is calculated
                                   (CPARM(2)>0) using only the
                                   listed antennas. See explain.
UVRANGE                            Range of uv distance for full
WTUV                               Weight outside UVRANGE 0=0.
WEIGHTIT          0.0        3.0   Modify data weights function
                                   Cal. info for input:
                                   CLEAN map. See HELP.
IN2NAME                               Cleaned map name (name)
IN2CLASS                              Cleaned map name (class)
IN2SEQ            0.0     9999.0      Cleaned map name (seq. #)
IN2DISK           0.0        9.0      Cleaned map disk unit #
NMAPS             0.0     4096.0   No. Clean map files
ONEFREQ          -1.0        1.0   > 0 => CC model from only
                                   one frequency (group)
INVERS            0.0    46655.0   CC file version #. 0 -> 1
NCOMP                              # comps to use for model.
                                   1 value per field
FLUX                               Lowest CC component used.
CMETHOD                            Modeling method:
                                   'DFT','GRID','    '
CMODEL                             Model type: 'COMP','IMAG'
                                   'SUBI' (see HELP re images)
SMODEL                             Source model, 1=flux,2=x,3=y
                                   See HELP SMODEL for models.
                                   Solution control adverbs:
REFANT                             Reference antenna
SOLINT                             Solution interval (min)
SOLSUB                             Solution subinterval
SOLMIN                             Min solution interval
APARM                              General parameters
                                      1=min. no. antennas
                                      3 > 0 => avg. RR,LL
                                      5 > 0 => avg. IFs.
                                      6=print level, 1=good,
                                        2 closure, 3 SNR
                                      7=SNR cutoff (0=>5)
                                      8=max. ant. # (no AN)
                                      9 > 0 => pass failed soln
                                     10 < 99 cal output weights
                                   Phase-amplitude Parameters:
DOFLAG                             Flag on closure error?
SOLTYPE                            Soln type,'  ','L1','GCON',
                                      'R', 'L1R', 'GCOR'
SOLMODE                            Soln. mode: 'A&P','P','P!A',
SOLCON                             Gain constraint factor.
MINAMPER          0.0              Amplitude closure error
                                   regarded as excessive in  percent
MINPHSER          0.0              Phase closure error regarded
                                   as excessive in degrees
NORMALIZ         -1.0         4.0  >0 => normalize gain:
                                     1 globally, 2 by subarray,
                                     3 by subarray,IF
                                     4 by subarray,IF,pol
CPARM                              Phase-amp. parameters
                                      1 = Min el for gain
                                           normalization (deg)
                                      2 > 0 normalize w median
                                           else use mean
                                      3 avg. amp. closure err
                                      4 avg. ph. closure err
                                      5  = 1 vector average
                                        channels, scalar avg
                                        between times
                                        >= 2 scalar average
                                      6 limit clipping in robust
                                      7 limit display of closure
ANTWT                              Ant. weights (0=>1.0)
GAINERR                            Std. Dev. of antenna gains.
BPARM                              Task enrichment parameters
                                   (1) Antenna diameter (m)
                                        0 -> no correction
                                   (2) Omit CC options
                                   (3) spectral index radius
                                        0 -> no correction
FQTOL                              Frequency tolerance in kHz
                                   (primary beam & spec index)
IN3NAME                            Spectral index image name
IN3CLASS                           Spectral index image class
IN3SEQ                             Spectral index image sequence
IN3DISK                            Spectral index image disk
IN4NAME                            Spectral curvature name
IN4CLASS                           Spectral curvature class
IN4SEQ                             Spectral curvature sequence
IN4DISK                            Spectral curvature disk
BADDISK                            Disk no. not to use for
                                      scratch files.


Task:  OOCAL is a procedure that combines OOSUB, CALIB, and finally
       TACOP.  OOSUB divides the data for a calibration source by a
       model that includes options to permit frequency-dependent
       primary beam and spectral index corrections.  CALIB then
       determines an IF-dependent, spectral-channel independent
       antenna gain and phase, using the divided data.  A solution
       (SN) table is written and copied to the INPUT uv file by TACOP.
       Finally the temporary, divided data set is optionally deleted.

       This procedure does not apply data selection and calibration
       adverbs to the input data set.  You must apply these with SPLIT
       or SPLAT (or other tasks) to make a data set consisting solely
       of the edited/calibrated data that you wish to self-cal.  Model
       images made with both values of IMAGR's DO3DIMAG option are
       handled correctly, as are multi-scale images.  Set

       OOCAL now uses the "V polarization" flux when calibrating RR
       (= I + V) and LL (= I - V) correlators.  This may be used for
       instruments with circular polarization if the calibrator is
       circularly polarized (not usually significant).  It may also be
       used with equatorially mounted instruments having linearly
       polarized feeds.  Such feeds do not rotate with parallactic
       angle and so have XX = I-Q and YY = I+Q.  To calibrate these
       instruments, relabel the Stokes from (-5 to -8) to (-1 to -4)
       and put minus the Q flux into the V position (ZEROSP(4) in
       SETJY).  See note in EXPLAIN.

       Models Of the basic flux calibrators 3C138, 3C147, 3C286, and
       3C48 are provided with AIPS.  These model images may be listed
       with verb CALDIR and read in for use by OOCAL with task CALRD.
  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.
  OUTNAME....Name to use for OOSUB output with class 'OOCAL1'
             Can be used to avoid conflict between multiple uses of
             OOCAL.  ' ' -> INNAME.
  DOKEEP.....> 0 => keep the file produced by OOSUB containing the
                    input data divided by the model and the SN table
                    produced by CALIB
             <=0 => delete this temporary file after TACOP.

The following may be used for all data files (except as noted):

  ICHANSEL...Array of start and stop channels plus a channel increment
             and IF, used to select the channels to be averaged.  For
             instance, if you wished to exclude channels 1 - 10 and
             121 - 128 because of bandpass effects, and channels 56 -
             80 of IF 1 but not IF 2 because of interference, then you
             would set ICHANSEL = 11,55,1,1, 81,121,1,1, 11,121,1,2.
             If you only wished to use every other channel from the
             second IF then you would set ICHANSEL = 11,55,1,1,
             81,121,1,1, 11,121,2,2.  Up to 20 groups of start, stop
             and increment channel numbers plus IF numbers can be
             specified. The default (ICHANSEL = 0) is to average the
             center 75 percent of the band, i.e.
             ICHANSEL(1,1) = (# channels)/8 + 1
                       For example: # channels=16 => ICHANSEL(1,1)=3
             ICHANSEL(2,1) = (# channels + 1)*7/8
                       For example: # channels=16 => ICHANSEL(2,1)=14
             ICHANSEL(3,1) = 1
             ICHANSEL(4,1) = 0 (meaning all IFs).
             If ICHANSEL describes averaging explicitly for some IFs,
             but skips other IFs, then the center 75 percent of the band is
             averaged for the skipped IFs.  For example:
             ICHANSEL=2,6,1,2 => The channels 2-6 will be averaged for
             IF=2 and the center 75 percent of the band will be averaged for
             the rest of the IFs.
  ANTENNAS...A list of the antennas to  have solutions
             determined. If any number is negative then all
             antennas listed  are NOT to be used to determine
             solutions and all others are. All 0 => use all.
  DOFIT......A list of the antennas for which solutions should be
             determined. Only those antennas listed in DOFIT will be
             solved for; all data selected via ANTENNAS will be used to
             form the solutions.  If any antenna number in DOFIT is
             <= -1, then DOFIT is taken as the list of antennas for
             which no solution is desired; a solution is found for all
             antennas not in DOFIT.  Note that the REFANT, if specified,
             will _not_ be solved for even if it appears in the DOFIT
             list.  Selection via DOFIT can be disabled by setting DOFIT
             = 0 which defaults to solving for all antennas.
             IT FULLY.  Basically, it should be used to solve for the
             gains of "poor" antennas after the "good" antennas have
             been fully calibrated.  Antennas included in ANTENNAS but
             not in DOFIT are assumed to have a complex gain of (1,0)
             and the gains produced will be very wrong if this is not
             the case.  See HELP DOFIT.
  ANTUSE.....A list of the antennas to be used in the calculation of
             the mean gain modulus (NORMALIZ>0). If any number is
             negative then all antennas listed are NOT to be used
             to determine the gain normalization and all others are.
             All 0 => use all.  It can be useful to limit the
             antennas used for the gain normalization to those with
             good a priori calibration, especially when using
             VLBI-style calibration based on system temperatures
             and gains.  This prevents the flux scale from being
             dragged up or down by poorly calibrated antennas
             including antennas subjected to bad weather.  The
             normalization factor determined using the ANTUSE
             antennas is applied to all antennas.
  UVRANGE....The range of uv distance from the origin in
             kilowavelengths over  which the data will have
             full weight; outside of this annulus in the uv
             plane the data will be down weighted by a factor
             of WTUV.
  WTUV.......The weighting factor for data outside of the uv
             range defined by UVRANGE.
  WEIGHTIT...If > 0, change the data weights by a function of the
             weights just before doing the solution.  Choices are:
             0 - no change   weighting by 1/sigma**2
             1 - sqrt (wt)   weighting by 1/sigma may be more stable
             2 - (wt)**0.25
             3 - change all weights to 1.0

The following specify a CLEAN model to be used if a single source was
specified in CALSOUR for multi-source files, or if the data is a
single-source file.  Note that standard calibrator models are listed
by verb CALDIR and read in by task CALRD.
  IN2NAME....Cleaned map name (name).  ' ' => not Clean model.
             For a single-source file the model determined by SMODEL
             is used instead of the CLEAN components if IN2NAME = ' '
             or IN2CLASS = ' '.  For a multi-source file a point
             source with flux given in the SU table is used instead of
             a CLEAN components if IN2NAME = ' ' or IN2CLASS = ' '.
             Note: a CLEAN image for only a single source may be given
             although it may be in a multi-source file.  One and only
             one CALSOUR must be specified as well to apply a
             Clean-component model to a source in a multi-source file
             (even if the file actually contains only one source).
             For a multi-source file, the flux of the clean components
             selected for the model are summed and scaled to the source
             flux found in the SU table.  If that flux is zero, no
             scaling is done.
  IN2CLASS...Cleaned map name (class).     ' ' => not Clean model.
  IN2SEQ.....Cleaned map name (seq. #).    0 -> highest.
  IN2DISK....Disk drive # of cleaned map.  0 => any.
  NMAPS......Number of image files to use for model.  For multi-scale
             models, set NMAPS = NFIELD * NGAUSS to include the Clean
             components of the extended resolutions.  If more than one
             file is to be used, the NAME, CLASS, DISK and SEQ of the
             subsequent image files will be the same as the first file
             except that the LAST 3 or 4 characters of the CLASS will
             be an increasing sequence above that in IN2CLASS.  Thus,
             if INCLASS='ICL005', classes 'ICL005' through 'ICLnnn'
             or 'ICnnnn', where nnn = 5 + NMAPS - 1 will be used.  Old
             names (in which the 4'th character is not a number) are
             also supported: the last two characters are '01' through
             'E7' for fields 2 through 512.  In old names, the highest
             field number allowed is 512; in new names it is 4096.
  ONEFREQ....In IMAGR, a CC file is made from the "average" of all
             channels included in the bandwidth synthesis.  But it is
             also possible to make the model image(s) from a single
             frequency (or from frequencies within FQTOL anyway).
             Set ONEFREQ = 1 if the model was made this way, leave it
             zero if all frequencies were included in the model.
  INVERS.....CC file version #.  You should specify this.  0 -> 1
  NCOMP......Number of Clean components to use for the model, one
             value per field.  If all values are zero, then all
             components in all fields are used.  If any value is not
             zero, then abs(NCOMP(i)) (or fewer depending on FLUX and
             negativity) components are used for field i, even if
             NCOMP(i) is zero.  If any of the NCOMP is less than 0,
             then components are only used in each field i up to
             abs(NCOMP(i)), FLUX, or the first negative whichever
             comes first.  If abs(NCOMP(i)) is greater than the number
             of components in field i, the actual number is used.  For
                   NCOMP = -1,0
             says to use one component from field one unless it is
             negative or < FLUX and no components from any other
             field.  This would usually not be desirable.
                   NCOMP = -1000000
             says to use all components from each field up to the
             first negative in that field.
                   NCOMP = -200 100 23 0 300 5
             says to use no more than 200 components from field 1, 100
             from field 2, 23 from field 3, 300 from field 5, 5 from
             field 6 and none from any other field.  Fewer are used if
             a negative is encountered or the components go below
  FLUX.......Only components > FLUX in absolute value are used in the
  CMETHOD....This determines the method used to compute the
             model visibility values.
             'DFT' uses the direct Fourier transform, this
             method is the most accurate.
             'GRID' does a gridded-FFT interpolation model
             '    ' allows the program to use the fastest
             NOTE: when using a model derived from data with
             difference uv sampling it is best to use 'DFT'
  CMODEL.....This indicates the type of input model; 'COMP' means that
             the input model consists of Clean components, 'IMAG'
             indicates that the input model consists of images.
             'SUBI' means that the model consists of a sub-image of
             the original IMAGR output.  If CMODEL is '   ' Clean
             components will be used if present and the image if not.
             SUBI should work for sub-images made with DO3DIM true and
             sub-images of the central facet made with DO3DIM false,
             but probably will not work well for shifted facets with
             DO3DIM false.  Use BLANK rather than SUBIM in such cases.
             OOCAL will set a scaling factor to correct image units
             from JY/BEAM to JY/PIXEL for image models.  If the source
             table contains a flux, then that flux will be used to
             scale the components model to obtain the stated total
             flux.  This is needed since initial Cleans may not obtain
             the full flux even though they represent all the
             essentials of the source structure.
  SMODEL.....For a single source file the model described by SMODEL is
             used instead of a CLEAN components model if IN2NAME = ' '
             and IN2CLASS = ' '.  For a multi-source file a point
             source with flux from the SU table is used instead of the
             CLEAN components if IN2NAME = ' ' and IN2CLASS = ' '.
             If IN2NAME and IN2CLASS are specified, then SMODEL is
             required to be <= 0.  If IN2NAME or IN2CLASS is blank,
             then, for single-source files, SMODEL(1) is required to
             be > 0.
                SMODEL(1) = flux density (Jy); 0 => no SMODEL.
                SMODEL(2) = X offset in sky (arcsec)
                SMODEL(3) = Y offset in sky (arcsec)
                SMODEL(4) = Model type:
                  0 => point model
                  1 => elliptical Gaussian and
                       SMODEL(5) = major axis size (arcsec)
                       SMODEL(6) = minor axis size (arcsec)
                       SMODEL(7) = P. A. of major axis (degrees)
                  2 => uniform sphere and
                       SMODEL(5) = radius (arcsec)
The following control how the solutions are done, if you don't
understand what a parameter means leave it 0 and you will
probably get what you want.
  REFANT.....The desired reference antenna for phases.
  SOLINT.....The solution interval (min.)
             0 => scan average for multi-source,
             0 => 10 s for single source amp-phase solns. (VLA)
             0 => 10 min for delay-rate solutions (VLBA).
             OOCAL tries hard to make equal integrations within each
             scan but that is a problem that lacks a general solution.
             You can help by careful choice of SOLINT: assume you have
             data every 10 seconds.  Then, to get 1 sample per
             solution, set SOLINT=9/60.  To get 2 per solution, set
             SOLINT=19/60, 3 per solution SOLINT=29/60.  Each averaged
             interval will start with an actual data sample and will
             end just before the first sample at a time greater than
             the start + SOLINT + 0.1s.  At the end of the scan, the
             end time can be increased by up to 0.6 * SOLINT to
             prevent short final integrations.  For calibration that
             is not self-calibration, note that the 2-point
             interpolation will use ONLY the last integration of a
             calibrator scan with the first integration of the next
             calibrator sacn.  That is why the initial calibration
             normally uses scan averages for the calibrator sources.
             If the times in your data set are not at regular
             intervals due to flagging and averaging, you must be
             careful with SOLINT.  To get all data in 10 seconds (from
             0 through 9.999) set SOLINT to 9.999/60.  Use of 1 sec
             will do odd things with the records at odd times.
  SOLSUB.....The begin time for the next interval in advanced from the
             current one by SOLINT / SOLSUB where 1 <= SOLSUB <= 10.
             0 -> 1.  This is to produce solutions at sub-intervals of
             SOLINT based on SOLINT length of averaging.
  SOLMIN.....Minimum number of subintervals to be used in a solution.
             0 -> SOLSUB.
  APARM......General control parameters.
  APARM(1)...Minimum number of antennas allowed for a solution.
             0 => max (3, min (6, Numant/2))
  APARM(2)...If > 0 then the input data has already been
             divided by a model; only solutions will be
  APARM(3)...If > 0 then average RR, LL
  APARM(5)...If > 0 then make a combined solution for the IFs;
             if <= 0 then make separate solutions.
  APARM(6)...Print flag, 0=none, 1=time, closure error statistics,
             2=individual closure failures (exceeding both CPARM(7)
             sigma and either MINAMPER or MINPHSER), 3=some additional
             info including the antenna signal to noise ratio,
             4=solutions, 5=data too.
  APARM(7)...The minimum allowed signal-to-noise ratio.   0 => 5
  APARM(8)...If there is no antenna (AN) table with the input file
             then the maximum antenna number in the file should be
             entered in APARM(8).
  APARM(9)...When solutions fail or there is insufficient data and
             APARM(9) > 0 then (1,0) is written to the SN table.  This
             will preserve the previous calibration but this option
             should be used with extreme care.
  APARM(10)..When writing a single-source output file, calibrate the
             output weights except when either DOCAL > 99 or
             APARM(10) > 99 or both.
  Phase-amplitude parameters:
  DOFLAG.....If DOFLAG > 0, those baselines with excessive closure
             error will be added to a new flag table along with all
             flags previously in FLAGVER.  If DOFLAG <= 0, no new data
             flags are generated and no flag table is written.  In
             either case, all SOLTYPEs below check the data for
             closure error and will report the fractions for which the
             closure error exceeds abs(DOFLAG) times the rms closure
             error.  Defaults for the reporting level are:
                  0.0 < DOFLAG <  2.0   ->   2.5
                 -1.0 < DOFLAG <= 0.0   ->  -2.5 if APARM(6) = 0
                                           -99.0 if APARM(6) >= 1
             Note that this checking of closure error is in addition
             to the checking done under control of MINAMPER, MINPHSER,
             and APARM(6) which do not flag the data.  Note that data
             marked as "bad" by the DOFLAG test will not be checked
             with the APARM(6) controlled tests.  The default on
             DOFLAG=0 is then meant to enable better printing of
             closure errors when not doing any actual flagging.
  SOLTYPE....Solution type:
               '    ' => normal least squares,
               'R   ' => as ' ' with robust iteration
               'L1  ' => L1 solution; a weighted sum of the moduli
                         of the residuals is minimized.
			 The computed gain solutions are less
			 influenced by wild data points, but there
			 is some loss of statistical efficiency.
	      		 See [F.R. Schwab, VLA scientific Memo #136]
			 for further details.
               'L1R ' => as 'L1' with robust iteration
               'GCON' => least squares which may include gain
               'GCOR' => as 'GCON' with robust iteration
             SOLTYPE (other than the R) is ignored when the DOFIT
             option is used.  The robust versions iterate the
             solution, discarding data that does not fit the current
             solution well enough.  They should be less disturbed by
             bad data, but will be slower.
  SOLMODE....Solution mode:
              'A&P ' => amplitude and phase.
              'P   ' => phase only
              'P!A ' => phase only (no amplitude information)
              'GCON' => amplitude and phase with constraints on
                        amplitude.  This mode requires setting
                        SOLTYPE='GCON', uses GAINERR and
                        SOLCON may be used.
              '    ' => 'A&P ' for multisource (raw) data,
                     => 'P   ' for single source data.
  SOLCON.....Gain constraint factor; a value larger than 0 will
             increase the strength of the amplitude constraint
             in gain constrained solution with SOLMODE='GCON'
  MINAMPER...Amplitude closure error regarded as excessive in per cent.
             If APARM(6) > 0, summaries of the number of excessive
             errors by antenna are printed and, if APARM(6) > 1, up to
             1000 of the individual failures are printed.  0 => do not
             check or report "excessive" closure errors of any sort.
             Note that amplitude closure errors are accumulated using
             logarithms so that gains of 0.5 and 2.0 are both errors of
             100 percent.
  MINPHSER...Phase closure error regarded as excessive in degrees.
             If APARM(6) > 0, summaries of the number of excessive
             errors by antenna are printed and, if APARM(6) > 1, up to
             1000 of the individual failures are printed.  0 => do not
             check or report "excessive" closure errors of any sort.
  NORMALIZ...If > 0, constrain the mean gain modulus of the calibration
             applied to be unity.  This is mostly used in self
             calibration.  If NORMALIZ = 1, the mean is over all IFs,
             antennas, polarizations and subarrays.  If NORMALIZ =2,
             it is the same except separated by subarray.  If NORMALIZ
             = 3, it is averaged over all antennas and polarizations
             but separated by IF and subarray.  NORMALIZ=4 also
             separates by polarization.  If you select NORMALIZ= 1,
             the global scaling factor is written to the header of the
             SN table.  For options 2 - 4, the SN table is re-written
             with the final scaling applied.  If = 0, substitute
             CPARM(2) which was previously used for this information.
  CPARM......Phase-amplitude parameters.
  CPARM(1)...Minimum elevation in degrees for the solutions used to
             constrain the mean gain modulus.  0 or >80 => no
             constraint (actually -100 is used).
  CPARM(2)...If NORMALIZ > 0, CPARM(2) controls whether a mean value
             (CPARM(2) <= 0) or a median value (CPARM(2) > 0) is used.
  CPARM(3)...If > 0, the values of any amplitude closure errors whose
             average absolute percentage value exceeds CPARM(3) will be
             printed if APARM(6) > 0.
  CPARM(4)...If > 0, the values of any phase closure errors whose
             average absolute value exceeds CPARM(4) degrees will be
             printed if APARM(6) > 0..
  CPARM(5)...If > 0 then the amplitudes will be scalar averaged when
             averaging across times before determining the solutions.
             The averaging of spectral channels will be a vector
             average unless CPARM(5) > 1.5.  Vector averaging is
             preferred to avoid the Ricean bias in amplitudes, but not
             when phase instability will make the signal incoherent.If
             the atmospheric phase is very unstable, then it should be
             fine at any one time but may require the scalar averaging
             between times.
  CPARM(6)...The robust solution method discards data more than
                    f(iter) * rms(iter)
             from the current solution to find the iter+1 solution
             f(iter) = max (g(iter), CPARM(6)) and
             g = 7.0, 5.0, 4.0, 3.5, 3.0, 2.8, 2.6, 2.4, 2.2, 2.5.
             Thus CPARM(6) can be used to limit the discarding to less
             restrictive values.
  CPARM(7)...The printing of individual closure errors occurs only if
             APARM(6) >= 2 and the errors exceed MINAMPER percent in
             amplitude and/or MINPHSER degrees in phase.  That
             printing is also limited to those errors that are more
             than CPARM(7) times the 1 sigma expected error (based on
             the data weights).  0 -> 2.5.  If you want no limit,
             set CPARM(7) to something like 0.001.
  ANTWT......Antenna weights.  These are additional weights
             to be applied to the data before doing the
             solutions, one per antenna.  Use PRTAN to
             determine which antenna corresponds to each
             antenna number.
             0 => 1.0
  GAINERR....Estimates of the standard deviation of the modulus of the
             gains for each antenna.  These are used ONLY if SOLMODE
             and SOLTYPE='GCON'.  The solution will attempt to make
             the standard deviation  of the modulus of the antenna
             gains match these values so accurate values are
  BPARM......Correction control parameters (SEE EXPLAIN IMAGR):
             (1) If > 0 then make frequency dependent primary beam
               corrections assuming an antenna diameter of IMAGRPRM(1)
               meters.  Note that VLA and ATCA arrays (TELESCOPE
               header parameter) use the default primary beam
               parameters defined elsewhere in AIPS, while other
               antennas actually use IMAGRPRM(1) as the diameter of a
               "standard" telescope.  See FQTOL below also.
             (2) If BPARM(1) > 0, you may omit selected CCs from the
               operation based on position:
                  BPARM(2) <= 0  : Include all CCs
                            = 1  : Omit CCs within the main beam at
                                   all frequencies
                            = 2  : Omit CCs within the main beam at
                                   some frequncies
                            = 3  : Omit Ccs outside the main beam at
                                   some frequencies
                            = 4  : Omit CCs outside the main beam at
                                   all frequencies
             (3) 1 => use a spectral-index image represented in
               IN3NAME, IN3CLASS, IN3SEQ, IN3DISK below to correct the
               Clean component model for each channel.  IN4NAME et al
               will also be used as a curvature image iff IN3NAME are
               BPARM(3)-0.5 is used as a radius in pixels over which
               the spectral index image is averaged.  When it is small
               (0 < BPARM(3) <~ 1), the spectral index is interpolated
               rather than averaged.  See FQTOL below as well.  When
               doing spectral index, the primary beam correction
               (BPARM(1)) costs very little extra.  This parameter is
               IMAGRPRM(17) in IMAGR.
  FQTOL......Frequency tolerance in kHz.  Spectral channels with FQTOL
             are handled together (use the same average CC model) when
             applying the primary beam and spectral index
             corrections.  Default is to do each channel separately
             which can take a long time.
  IN3NAME....Image name of spectral index image; no default.
  IN3CLASS...Image class of spectral index image; no default.
  IN3SEQ.....Image sequence of spectral index image; 0 -> highest.
  IN3DISK....Disk of spectral image image; 0 -> any.
  IN4NAME....Image name of spectral index curvature image; no default.
             Curvature images should be base 10 rather than base e -
             they differ by a factor of 2.3.  Also the reference
             frequency is 1.0 GHz.  These are changes done 2010-07-13.
  IN4CLASS...Image class of spectral index curvature image; no
  IN4SEQ.....Image sequence of spectral index curvature image;
             0 -> highest.
  IN4DISK....Disk of spectral curvature image image; 0 -> any.
  BADDISK....Disk numbers on which scratch files are not to
             be placed.


OOCAL:  Task to determine antenna gains from calibrator data
Documentor:  A.H.Bridle
Related Programs: CLCAL, LISTR, SPLIT, UVFLG

This task is the central AIPS routine for calibrating multi-
source uv data sets using observations of calibration sources
that can either be assumed to be point sources or have well
determined structures.

OOCAL determines antenna voltage gain solutions (amplitude
and/or phase) from data for calibrator sources with well known
flux densities, positions and structures. It is the equivalent
of the VLA Dec-10 ANTSOL (with additional options) and of a
combination of the AIPS routines ASCAL and VSCAL.  Solutions
determined by OOCAL under control of the APARM, CPARM and DPARM
parameters are written to the solution (SN) extension table of
the input uv data set.  Solution tables may be merged, smoothed
and interpolated into calibration (CL) tables for multi-source
uv data files using CLCAL.

OOCAL may also be run on files containing data for only one
source, for self calibration.

To run OOCAL, you should specify at least:

The input uv data file (INNAME, INCLASS, INSEQ, INDISK).

The CALSOURces to be used for determining antenna gains, or
leave CALSOUR blank and specify a CALCODE and/or qualifier.

REFANT, the reference antenna for the solution (choose an
antenna with good signal to noise that was present through
as much of the observing as possible).

The defaults are set so that running OOCAL on a multi-
source uv data file setting only these inputs will make
a solution file for all IFs in the data over the entire
time range using the highest-numbered flag file.  All
antennas will be calibrated for amplitude and phase, using
data from the entire uv range.  All antennas will be equally
weighted. Point source models will be assumed for the
calibration sources.  The solution will be written to an
SN table.

Other useful options

Use APARM(6)=3 to list the signal to noise ratio at each
antenna solution.  Solutions with signal to noise below
5:1 are probably not meaningful and will be discarded by
the default setting of APARM(7).  You may wish to apply
more stringent criteria with APARM(7).

Use SOLTYPE and SOLMODE='' to solve for both amplitude and
phase solutions simultaneously with no constraints on amplitude,
SOLTYPE and SOLMODE='GCON' for amplitude and phase with
constraints set by GAINERR and SOLCON.  Amplitude solutions
for point source models in multisource files will be based on
the flux densities entered for the sources in the source (SU)
table extension of the data set using task SETJY.

Use UVRANGE and WTUV to weight different uv ranges
differently (or to restrict the solution to some uv range
-- WTUV = 0 is read as zero weight).


OOCAL does not restrict you to the use of point source models
for your calibrators.  Use IN2DISK, IN2NAME, IN2SEQ, INVERS,
NCOMP and NMAPS to specify a CLEAN component model for the
field or fields around a calibrator  and specify that
calibrator in SOURCE. OOCAL will create an SN table for that
calibrator alone.  This SN table may then be merged with SN
tables for other calibrators produced by other runs of OOCAL,
when the SN tables are smoothed and interpolated into a CL file

This is actually a subsection of CLEAN COMPONENT MODELS above.
You are strongly encouraged to use the flux calibrator models
available for all the primary flux calibrators (3C138, 3C147,
3C286 and 3C48).  Using calibrator models removes the need set
UVRANGE and ANTENNAS.  To see what calibrator models are available
in AIPS type CALDIR, to read them in use the task CALRD.  CALRD
loads in the selected model as an image file.  Then specify this
image in IN2DISK, IN2NAME, IN2CLASS and IN2SEQ.  OOCAL will
recognize these images as standard calibrator models and scale
the clean components in the central part of the field with the
flux in the SU table.


The first version of the CL table attached to your uv data set
is protected from modification in CLCAL, so
that you can easily "undo" all calibration steps that have
taken place within AIPS.  To reset your calibration, delete all
CL tables with version numbers >1, and delete all SN tables.

POLARIZATION considerations (thanks to Robert Braun)

The VLA measures approximately (neglecting the leakage terms):

RR=I+V, LL=I-V, RL=Q+iU, LR=Q-iU

The WSRT uses linear polarization but the equatorial mounts mean that
the feed orientation remains constant relative to the sky (no
parallactic angle change at all).  Thus, the WSRT measures

XX=I-Q, YY=I+Q, XY=-U+iV and YX=-U-iV

If you compare these two sets of equations, you see that they have a
lot in common. If you simply pretend that you have measured
(RR,LL,RL,LR) by changing the Stokes value from -5 to -1 in the header
with PUTHD, you're almost in business, except you have -Q in the place
of V, -U in the place of Q, and V in the place of U.  This is fine for
most things, since you just have to request a slightly different
parameter from the one you really mean.

The biggest hassle comes from amplitude calibration of linearly
polarized sources, like:

3C286 (near 1.4 GHz) which has (I,Q,U,V)=(14.65,0.56,1.26,0.00) Jy

3C138 (near 1.4 GHz) which has (I,Q,U,V)=(8.30,0.63,-0.17,0.00) Jy

Since Q is non-zero, it means that the XX and YY correlations do not
correspond to the same real flux density (ie. XX=I-Q and YY=I+Q).

Now, since RR=I+V and LL=I-V, the idea is to have OOCAL use the
Stoke's V from the SU table.  The, for WSRT data, one can fudge the
right behavior, by putting the source's actual value of -Q in place
of V in the SU table.

This shouldn't harm any VLA users, since Stoke's V is near enough zero
for most sources anyway. And if it were non-negligible it should be
taken along in any case, since it really does affect the RR and LL
correlations, and therefore the derived gain of the R and the L IFs.