; SDTUV
;---------------------------------------------------------------
;! Task to convert SD table files to UV like data.
;# TASK SINGLEDISH
;-----------------------------------------------------------------------
;;  Copyright (C) 1995
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
SDTUV     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SDTUV     Task to convert SD table files to UV like data.
INNAME                             Input  SD table file name.
INCLASS                            Input  SD table file class
INSEQ           -1.0     9999.0    Input  SD table file seq. #
INDISK           0.0        9.0    Input  SD table file disk #.
INEXT                              Input table extension type
INVERS                             Input table file version no.
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 #.
APARM                              Control info:
                                   1 = CS table interval 0=none
                                   2 .ge. 0 => SCAN rand. parm.
                                   3 .gt. 0 => spline fitting
                                   4  Spline smoothness parm.
                                   5 .gt. 0 => median win. width
                                   7 Max. dev. per receiver
                                   8 Max. no. rcx. exceeding (7)
BPARM                              Task enrichment parm.
                                   1 .gt. 0 => replace bad RA's
                                   2 .gt. 0 => beam for lat. foc
                                   3 .gt. 0 => patch 140 ft dec.
ARRAY2                             Baseline table (20,2)
                                   (i,1) = declination i
                                   (i,2) = baseline i
----------------------------------------------------------------
SDTUV
Task:  This task will create an AIPS uv data file and fill it by
       converting a single dish table to uvlike data.  If
       requested, CS (calibration) and NX (index) tables will
       be created and filled.
          Several filtering methods are available for removing
       a baseline from the data.
Adverbs:
  INNAME.....Input SD table file name (name).
  INCLASS....Input SD table file name (class).
  INSEQ......Input SD table file name (seq. #).
  INDISK.....Disk drive # of input table file.
  INEXT......Table extension type. '  '=>'SD'
  INVER......Table extension version. 0=> convert all.
  OUTNAME....Output UV file name (name).    Standard behavior
             with default 'UV DATA FILE'.
  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 disk
             with space for the file.
  APARM......Control info:
             1 = CS table interval in min.  If < 0 then no CS
               or NX tables are written.
             2 If the value is .ge. 0 then SCAN and SAMPLE
               random parameters are added if appropriate.
             3 If the value is greater than 0 then a cubic
               spline is fitted to the median value in blocks
               APARM(3) samples long.  The spline is then used
               to subtract the baseline.
             4 Smoothness factor, any positive number.  Larger
               values give better fit, smaller a smoother
               curve. 0 => 1.
             5 If the value is larger than 0 then the median
               value in a sliding window APARM(5) samples wide
               is used as an estimate of the baseline and
               removed.
             7,8 If the value of (7) is larger than 0 then an
               interference detector is invoked.  For each time
               sample and receiver the difference between the
               value and the mean of the preceeding and
               following time samples is computed.  If more than
               APARM(8) receivers have a difference exceeding
               APARM(7) then that time sample is flagged.
  BPARM......If BPARM(1) .gt. 0 then the 300 foot bad RA problem
             will be patched up.
             If BPARM(2) .gt. 0 then a gain correction will be
             made for the lateral (off axis) defocusing error.
             BPARM(2) is the beam offset (degrees) that gives
             3 dB loss in gain (field of view).
             If BPARM(3) .gt. 0 then the declination error in
             the 140 ft telescope pointing program will be
             patched. 
  ARRAY2.....This contains a table of baselines to subtract
             as a function of declination.  This is mostly
             useful for Meridian transit measurments.  Baseline
             temperatures to be removed can be specified at up
             to 20 arbitrary declinations.  The range of
             declinations in the table MUST enclose all
             declinations present in the data and at least 3
             points must be included.  The order is in
             ascending (north positive) declination.
             A cubic spline interpolation is used.
             ARRAY2(i,1) = declination i
             ARRAY2(i,2) = baseline temperature i.
----------------------------------------------------------------
