; POLSN
;---------------------------------------------------------------
;! Make a SN table from cross polarized fringe fit
;# Task Calibration VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 2009
;;  Associated Universities, Inc. Washington DC, USA.
;;
;;  This program is free software; you can redistribute it and/or
;;  modify it under the terms of the GNU General Public License as
;;  published by the Free Software Foundation; either version 2 of
;;  the License, or (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU General Public License for more details.
;;
;;  You should have received a copy of the GNU General Public
;;  License along with this program; if not, write to the Free
;;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
;;  MA 02139, USA.
;;
;;  Correspondence concerning AIPS should be addressed as follows:
;;         Internet email: aipsmail@nrao.edu.
;;         Postal address: AIPS Project Office
;;                         National Radio Astronomy Observatory
;;                         520 Edgemont Road
;;                         Charlottesville, VA 22903-2475 USA
;-----------------------------------------------------------------------
POLSN     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
POLSN:    Make a SN table from cross polarized fringe fit
INNAME                             Main input file (name).
INCLASS                            Main input file (class).
INSEQ             0.0    9999.0    Main input file (seq. #).
                                      0 => high
INDISK            0.0       9.0    Disk unit #.       0 => any
INVERS                             Input  file version no.
OUTVERS                            Output file version.
OPCODE                             'AVIF' = avg SB delays in IF
----------------------------------------------------------------
POLSN
Type:  Task
Use:   POLSN creates an SN table suitable for the calibration of
       cross polarized delays from an SN table obtained from a
       run of FRING on cross polarized data for 2 antennas.
       See EXPLAIN POLSN for details.
Adverbs:
  INNAME......Main file name (name).       Standard defaults.
  INCLASS.....Main file name (class).      Standard defaults.
  INSEQ.......Main file name (seq. #).     0 => highest
  INDISK......Disk drive # of image.       0 => any
  INVERS......Input extension file version #.
  OUTVERS.....Output extension file version #. 0=>make new
  OPCODE......'AVIF' means average single band delays
              corrections in IF, else do each IF independently.
----------------------------------------------------------------
POLSN:  Make a SN table from cross polarized fringe fit
Documentor: W. D. Cotton
Related Programs: SWPOL, FRING, CLCAL.

      Calibration of cross polarized delays

   This task will process an SN table produced from a run of
FRING on cross polarized data into an SN table suitable for
applying to an input table to correct for cross polarized delay
errors.  Cross polarized rate errors are assumed to be zero.

  Before running POLSN the following steps should be taken:

1) Run UVCOP to select a short section of data for one antenna
and the reference antenna.  This time/source/baseline
combination should have a reasonable SNR for the RL and LR
correlations.  In the following more than one antenna other
than the reference antenna may be used but if so then the
numbers of the non reference antenna must all be either above or
below the reference antenna number.

2) Run FRING on this segment of data to obtain corrections for
the parallel fringes.  Use APARM=2,0; DOCAL=1; GAINUSE=0;
SNVER=0; ANTENNA = ref. ant., other, REFANT=refant.

3) Use CLCAL to apply this SN table to the CL table used to
calibrate the input to FRING.

4) Use SWPOL to swap the polarizations of the reference antenna.
Set ANTENNAS = ref. anttenna, other antenna; DOCALIB = 1

5) Run FRING as before but on the output of SWPOL.

6) Run POLSN on the SN table produced by FRING.

7) Use TACOP to copy the SN table produced by POLSN to the
original data set and then use CLCAL to apply it to the
calibration table.
