; PHSRF
;---------------------------------------------------------------
;! Perform phase-referencing within a spectral line database.
;# Task UV
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 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
;-----------------------------------------------------------------------
PHSRF     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
PHSRF     Performs spectral phase-referencing
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 #
OUTNAME                            Output UV file name (name)
OUTCLASS                           Output UV file name (class)
OUTSEQ           -1.0     9999.0   Output UV file name (seq. #)
OUTDISK           0.0        9.0   Output UV file disk unit #.
OPCODE                             'PHSR' - will rotate phases
                                           of all channels by
                                           phases of reference
                                           channel(s).
                                   'A&P'  - same as PHSR but
                                           also divides by
                                           amplitude of ref
                                   'PHBL' - same as PHSR but
                                           write results into
                                           BL table.
                                   'APBL' - same as A&P but
                                           write results into
                                           BL table.
                                   ' ' => 'PHSR'
ICHANSEL                           Array of start and stop chan
                                   numbers, plus a channel
                                   increment and IF to define
                                   reference channels.
----------------------------------------------------------------
PHSRF
Task:  This task will phase-reference all channels to the phase
       of a single channel, or group of channels. Note that CL
       and SN tables are not copied to the output file if
       OPCODE = 'A&P', as in this case all prior calibration becomes
       irrelevant.
Adverbs:
  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....Output UV file name (name).     Standard defaults.
  OUTCLASS...Output UV file name (class).    Standard defaults.
  OUTSEQ.....Output UV file name (seq. #).   0 => highest unique
  OUTDISK....Disk drive # of output UV file. 0 => highest with
             space for the file.
  OPCODE.....Define the operation to be performed.
             'PHSR' => perform phase-referencing, rotate the
                 phases of all channels by the average phase of
                 the channel(s) defined by CHANSEL
             'A&P' => same as 'PHSR', but also divides
                 amplitude by that of the reference
             'PHBL' => same as 'PHSR', but write results into
                 BL table. Will always create a new table.
             'APBL' => same as 'A&P', but write results into
                 BL table. Will always create a new table.
  ICHANSEL.. Array of start, stop, and increment channel numbers plus
             an IF used for channel selection in the averaging to
             define the pahse reference feature  Up to 20 sets if
             channels/IF may be entered.  The first having
             ICHANSEL(2,i) <= 0 terminates the list.  ICHANSEL(4,i) is
             the IF number, with <= 0 meaning all IFs.  If an IF has
             no ICHANSEL set for it, the program quits with an error
             condition.  You must select channels.
----------------------------------------------------------------

