; HFPRT
;---------------------------------------------------------------
;! write HF tables from CL2HF
;# TASK TABLE VLBI ASTROMETRY
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 1999, 2004
;;  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
;-----------------------------------------------------------------------
HFPRT     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
HFPRT:    Prints out selected HF table entries
USERID                             User number.
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            0.0    9999.0    Inversion of HF table
PRTLEV                             Print Level. 0-> inext
                                   1-> solutions, 2-> dump
DOCRT            -3.0     132.0    Output control
OUTPRINT                           Output file name
BPRINT            0.0    99999.0   Beginning row to print
EPRINT            0.0    99999.0   Last row to print: 0 => end
----------------------------------------------------------------
HFPRT
Type:  Task
Use:   This task reads the HF files associated with the FRING
       MBDLY and CL2HF programs.  It writes the data at
       several detail levels.
Adverbs:
  USERID......The user ID of the owner of the image.  0 =>
              current user, 32000 => any user.
  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 #.
  PRTLEV......The level of the print out.  0-> Index
              1-> Basic solutions
              2-> Dump of HF file
  DOCRT......False (< 0) use the line printer if OUTPRINT = ' '
                         else write named OUTPRINT file only.
                   When OUTPRINT is not blank, DOCRT=-2 suppresses the
                   page-feed character on page headers and DOCRT=-3
                   suppresses page headers and most other header
                   information.
             True  (> 0) means use the terminal interactively.
             The task will use the actual terminal width as a display
             limit unless 72 < DOCRT < width.  In that case, the display
             limit will be DOCRT characters.
             A wide terminal is recommended for this task.
  OUTPRINT...Disk file name in which to save the line printer output.
             ' ' => use scratch and print immediately for interactive
             jobs - batch jobs use OUTPRINT = 'PRTFIL:BATCHjjj.nnn'
             (jjj= job #, nnn = user #).  When OUTPRINT is not blank,
             multiple outputs are concatenated, and the file is not
             actually printed.
  BPRINT......Beginning row number to be included .
  EPRINT......Last row number included.  0 = highest.
----------------------------------------------------------------
PROGRAM:  HFPRT
DOCUMENTOR:  Ed Fomalont  95.03.11
RELATED PROGRAMS:  FRING, MBDLY, BLING, BLAPP, CL2HF, solve

                      PURPOSE

Program HFPRT writes out the HF file which is created by
CL2HF.  This file mimics the 'Format 52' fringe files which
are created by MK3IN and the Haystack correlator.  This is the
data which is converted by HF2SV into a format which can be
read into Calc/Solve.

The output of HFPRT with PRTLEV=1 contains the basic output from
the correlator and can be used for further analysis.

The format of the HF table (the following is copied from MK3IN)
is:

HF
COL Label    Type(dim)  Description
 1   XY          C*2       Baseline code, 1 char per antenna.
 2   UTC TAG     I(6)      UTC time tag (YMDHMS) EPOCH for delay
                  and rate .
 3   VLB2 UTC    I(6)      UTC of FRNGE processing (YMDHMS)
 4   ARCHIV      I(4)      ARCHIV
 5   SAMPRATE    I         Sample rate in kbits/sec
 6   FR/PP       I         no. frames per parameter period
 7   PASS NO.    I         Pass number
 8   NO. CHANELS I         #U/L sideband pairs included in this
                   processing (i.e. # of discrete LO
                   frequencies)
 9   NO. OF AP   I(28)     #Accumulation periods by sideband by
                   channel
10   RECTRACK    I(2,2,14) Track # table in order of:
                   Station #, Refer/partn Sideband, Channel #
11    COREL VERSION NO. I  COREL version #
12    UTCM TAG   I(6)      UTC time tag (YMDHMS)  EPOCH for
                   "central" EPOCH
13    LU OF PRINTOUT   I   LU of printout (for FRNGP)
14    REF. TAPE DRIVE NO. I Reference tape drive number
15    REM. TAPE DRIVE NO. I Remote tape drive number
16    SPECIAL OPTIONS  I    Special options NAME(211)
17    INTEGER PARM(250)  I  Integer value of PARAM(250) [=999
                   for special PCAL by AP]
18    CORELXTNT       I(2,14) COREL extent# from which each
                   track is taken.
19    CALBYFRQ        I(3,2,14) Phase-cal amp, phase and freq by
                   station and channel normalized as follows:
                      AMP 0 to 10000(in voltage) -1=manual cal
                      PHS -18000 to +18000
                      frq  kHz
20    PROCUTC         I(2,14) COREL processing UT (YDDD) by
                    sideband and channel.
21    ERRORATE        I(2,2,14) Tape error rate by station,
                    sideband and channel encoded as:
                    1000*LOGT(error rate) (=-32000 if no errors)
22    INDEX           I(2,14) COREL index #s by sideband and
                    FRNGE CH#
23    FRNGE ERROR CODE  I   FRNGE error code 0=OK NE.0 Don't use
24    SBDOFFST FLAG   I     flag 1=this run had sideband fixup.
25    STAR ID         C*8   Radio source name
26    BASELINE ANT1   C*8   First antenna name of baseline
27    BASELINE ANT2   C*8   Second antenna name of baseline
28    CORELFILE       C*6   COREL correlation output
                   file name
29    TAPEID ANT1     C*8   first raw-data tape ID label
30    TAPEID ANT2     C*8   second raw-data tape ID label
31    VLB2PRG         C*6   FRNGE program version YYMMDD
32    RUN CODE        C*8   Run code, e.g. "329-1300"
33    FRNGE QUALITY CODE C*1 FRNGE quality code 0=no good,
                   1=very poor, 9=very good, A=has FRNGE error
                   code=1,B=2 etc.
34    FREQ. GROUP CODE C*2  Frequency group code
35    ORIG. COREL FILE NAME C*6 Original COREL file name
36    TAPE Q CODE     C*6   Tape Q code
37    REF OCCUPATION CODE C*8 Ref station occupation code
38    REM OCCUPATION CODE C*8 Rem station occupation code
39    RFREQ           D(14) LO frequencies (MHz) by channel
40    REF FREQ        D     RF freq (MHz) to which phase is
                   referred
41    DEL OBSV        D     Observed group delay in
                   microseconds equals single band delay if only
                   one freq. processed.  DELOBSV=T2-T1, T1=time
                   of arrival at site 1 (reference site) as
                   measured by the site clock at site 1, T2=time
                   of signal arrival at site 2 as measured by
                   site clock at site 2.  The signal in question
                   is the one which arrives at site 1 at a UTC
                   time equal to that given as the UTC epoch.
42    RATOBSV        D     Observed delay rate (usec/sec)
                   corrected for the phase cal rate.
43    NB DELAY       D     Narrow-band group-delay (usec)
44    DGPD           D     group delay ambig. (usec)
45    BTE0           D     apriori clock (usec)
46    EPOCH0         D     ref. st. clock epoch (usec)
47    DEL OBSVM      D     observed delay at central epoch
48    RAT OBSVM      D     observed delay rate at central epoch
49    DLY2           D     phase delay at EPO+1 sec
50    DLY3           D     phase delay at EPO-1 sec.
51    AMBYFRQ        R(2,14) Amp and phase by channel 1=100%
                   phase=-180 to 180 deg. residual to COREL and
                   uncorrected for PCAL rate.
52    PHASECAL       R(2)  Phase cal rate by station (usec/sec)
53    DELRESID       R     Delay residual to COREL a priori.
54    DELSIGMA       R     Calculated delay error (usec)
55    RATRESID       R     Delay-rate residual to COREL a priori
                   (usec/sec) corrected for phase cal rates.
56    RATSIGMA       R     Calculate delay-rate error (usec/sec)
57    COHERCOR       R     Coherent multi-freq correlation
                   coefficient. (1=100% correlation)
58    TOTPHASE       R     Total observed fringe phase (deg)
59    UVF/ASEC       R(2)  Fringes per asec in N-S and E-W
60    STARELEV       R(2)  Calculated star elevations run reference
                   time by station (deg).
61    AAMP FRNGE     R     amplitude from incoherent addition of
                   frequency channels.
62    URVRSEC        R(2)  Rate derivatives mHz/sec arc
63    SRCHPAR        R(6)  Search parameters
64    DEPSBRES       R     Single band delay residual (usec)
65    SNR            R     Signal to noise ratio in sigma.
66    PROB           R     Probability of a false detection.
67    INCOH          R     Incoherent segmented fringe amp. in
                   units of 10,000.
68    EARP           R     total phase refered to an epoch at
                   time the signal reaches the center of the
                   earth.
69    REARP          R     Residual phase corrected to earth
                   centered epoch
70    START          R     Start time in seconds past hour
71    STOP           R     Stop time in seconds past hour
72    EPD            R     Epoch offset from center of run in
                   sec.
73    DUR            R     Effective run duration in seconds.
74    DELSS          R     Single-band delay error in microsec.
75    QB             R     Ratio of min to max data accepted in %
76    DISCD          R     % data discarded
77    TOTPM          R     Total phase at central epoch



