; VLBAFPOL
;---------------------------------------------------------------
;! checks polarization labels for VLBA data
;# PROCEDURE VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 2000
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
VLBAFPOL  LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
VLBAFPOL: Procedure to check polarization labels
INNAME                             Input file name
INCLASS                            Input file class
INSEQ                              Input file sequence number
INDISK                             Disk number for input file
OUTDISK                            Disk number for output file
                                   (this disk must have enough
                                   free space to hold a copy of
                                   the input file).

          VLBAFPOL is defined in the VLBAUTIL run file.
----------------------------------------------------------------
VLBAFPOL
Type: Procedure
Use:  VLBAFPOL is a procedure that checks the polarization labels for VLBA
      data and either creates a new file that is labeled correctly or
      recommends a course of action.

      Type RUN VLBAUTIL to make the VLBAFPOL procedure available.

  INNAME.....The name of the file to be checked. Wildcard characters are
             allowed.
  INCLASS....The class of the file to be checked. Wildcard characters are
             allowed.
  INSEQ......The sequence number of the file to be checked. Zero defaults
             to the highest sequence number of a file matching INNAME,
             INCLASS, and INDISK.
  INDISK.....The disk drive number of the file to be checked. Zero defaults
             to any disk.
  OUTDISK....The disk drive number of a disk to hold the corrected data.
             This disk must have sufficient free space to hold a copy of the
             input file. Zero defaults to any disk.
----------------------------------------------------------------
VLBAFPOL:           Procedure to check VLBA polarizations
Documentor:         Chris Flatters
Related Programs:   VLBAUTIL, FXPOL

WHEN TO USE VLBAFPOL

Use VLBAFPOL to check whether you need to relabel the polarizations in your
data after loading the data, looking for subarrays, and merging redundant
calibration data but before reading any calibration data from non-VLBA
stations.

VLBAFPOL assumes that all of your FREQIDs have similar polarization setups.
For this reason, you should normally run VLBAFPOL after copying each frequency
ID to a separate file. This may be done using VLBAFQS. This strategy also
reduces the amount of disk space needed for VLBAFPOL.

You should make sure that at least one disk has enough free space to hold a
copy of your data before running VLBAFPOL.

VLBAFPOL is intended for novice and experienced VLBA users.

WHAT VLBAFPOL WILL DO

VLBAFPOL will inspect your data to see if it appears to be a dual-polarization
data set labelled as having a single polarization. It does this by checking
the number of polarizations in the header and by checking the frequency (FQ)
table for IFs with the same frequency. There are a number of possible
outcomes.

* VLBAFPOL will do nothing because the header claims that the data already
  have more than one polarization.

* VLBAFPOL will do nothing because no two IFs have the same frequency and
  VLBAFPOL concludes that there is only one polarization present. This
  conclusion is incorrect if you have used an unusual set-up with different
  polarizations at different frequencies; if this is the case you may wish
  to run FXPOL manually to fix the labelling. You may also wish to run FXPOL
  manually to change the polarization labels from RR to LL or vice versa.

* VLBAFPOL will run FXPOL automatically because the IFs are all paired in
  frequency. There is a small chance that VLBAFPOL will determine the output
  polarizations incorrectly. If this happens then you will need to run FXPOL
  by hand.

* VLBAFPOL will no nothing because some but not all IFs are paired. This
  indicates that there is more than one polarization present but VLBAFPOL can
  not guess how the polarizations should be mapped to IFs. In this case you
  need to run FXPOL manually.
