; OTFUV
;---------------------------------------------------------------
;! Translates on-the-fly single-dish SDD format to AIPS UV file
;# Task General Singledish
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1996, 2008
;;  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
;-----------------------------------------------------------------------
OTFUV     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
OTFUV:  Task to read 12-m OTF data to an AIPS UV file
DATAIN
                                   Input data file (sdd file)
DATA2IN
                                   Input gain file (gsdd file)
BCOUNT                             First included scan
ECOUNT                             Last included scan
BIF                                First IF number: 0 => lowest
EIF                                Last IF number: 0 => highest
DOUVCOMP         -1.0       1.0    >=0 => compressed data (FITS)
OUTNAME                            Output UV file name (name)
                                     blank => OBJECT
OUTCLASS                           Output UV file name (class)
                                     blank => OTFUV
OUTSEQ           -1.0    9999.0    Output UV file name (seq #)
                                      0 => high unique
OUTDISK           0.0       9.0    Output disk drive #
XINC              0.0    1000.0    Write an output record every
                                   XINC'th time
YINC              0.0    1000.0    Time smooth by averaging
                                   every YINC records
DOWEIGHT         -1.0       1.0    > 0 => interpolate Offs and
                                   Gains in time
DOCONCAT         -1.0       1.0    > concatenation allowed?
FQTOL                              Frequency tolerance needed to
                                   decide if OTFUV should
                                   concatanate files. (MHz)
                                   <=0 => 2 MHz
DETIME            0.0      100.0   Time (days) to add to data
                                   set being concatenated
BCHAN             0.0     8192.    First channel to include
ECHAN             0.0     8192.    Last channel to include
CHANSEL           0.0     8192.0   Channels to be flagged:
                                   n1(i) to n2(i) by n3(i)
                                   where n2(i) >= n1(i) > 0.
----------------------------------------------------------------
OTFUV
Type: Task
Use:  Convert a single 12m OTF map (in UniPOPS SDD format) to UV
      (single-dish) format within AIPS.
Adverbs:
  DATAIN......Input 12m sdd file (raw data file).
  DATA2IN.....Input 12m gsdd file (gains file).
  BCOUNT......First scan in OTF map which you want to process.
  ECOUNT......Last scan in OTF map which you want to process.
  BIF.........Lowest IF number to process.  The IF number is converted
              into the apparent antenna number for the "autocorrelation"
              data on output ("BEAM" = 257 * IF#, "BASELINE" = IF#-IF#).
              The antenna number can be used later for data selection.
              0 => lowest in data set.
  EIF.........Highest IF number to process.  OTFUV will attempt to write
              data for multiple IFs at once to the output file so that
              it will not be necessary to run OTFUV multiple times
              followed by a UVSRT on the concatenated output.  0 =>
              highest in data set.  IFs that do not match in center
              frequency or channel width to those of BIF will be
              omitted.
  DOUVCOMP....If true (DOUVCOMP >= 0) the output data is written in
              compressed format which can result in a substantial
              reduction in disk space needed but a few tasks still
              cannot read this format.
  OUTNAME.....Output (SD) UV file name (name).
  OUTCLASS....Output (SD) UV file name (class).  Standard behavior with
              default = 'OTFUV'.
  OUTSEQ......Output (SD) UV file name (seq #).  0 => highest unique.
  OUTDISK.....Output (SD) UV file disk drive #. 0 => highest w space for
              the initial file size.  Be careful to select a disk with
              plenty of space.  Unlike some AIPS tasks, OTFUV has to
              increase the size of the UV file after creation if there
              is more data than it guessed initially.
  XINC........Output data every XINC'th time: ignored if YINC <= 1; 0 =>
              YINC.
  YINC........Average every YINC times together in the output.  The
              combination of XINC and YINC allows you to, for example,
              averages of 5 samples every third sample time.
  DOWEIGHT....> 0 => the Off and Gain data are interpolated in time
              before being applied to the on-source data.  <= 0 => the
              Off and Gain scans assigned to the on-source scan are
              applied to the full scan.
  DOCONCAT....> 0 => that OTFUV will concatenate the current data to a
              pre-existing data set (OUTNAME, OUTCL, and especially
              OUTSEQ must be specified).
  FQTOL.......Frequency tolerance in MHz.  Data sets separated in
              frequency by > FQTOL will not be concatenated. 0 => 2 MHz.
  DETIME......Time in integer days to add to observed time when
              concatenating data.  This is to allow you to edit one data
              set wrt the other.  Note that, if the two data sets are
              from different times, you should read in the earlier one
              first and do not need to set DETIME.
  BCHAN.......First channel to include: 0 -> 1.  Including fewer
              channels speeds up the task and decreases the size of the
              output file.  However, it also removes channels to be used
              for fitting spectral baselines.
  ECHAN.......Last channel to include; <= BCHAN => max in data
  CHANSEL.....Channels to be flagged as they are read in. CHANSEL is an
              array of (3,N) and the channels to be flagged are
              CHANSEL(1,i) to CHANSEL(2,i) by CHANSEL(3,i).  Thus, to
              flag channels 31 and 34, for example, set CHANSEL = 31,
              34, 3, 0.  The first CHANSEL(2,i) < CHANSEL(1,i) or either
              of these = 0 terminates the list.  N <= 10.  Channel
              numbers are before correction for BCHAN.
----------------------------------------------------------------
OTFUV :  Task to read 12-m OTF data to AIPS UV file
DOCUMENTOR: J. G. Mangum (SMTO)
DATE OF DOCUMENTATION:
RELATED PROGRAMS:  PRTSD, SDGRD, OTFIN
VERSION:

                          PURPOSE

     OTFUV is an AIPS task which will take a 12m OTF (On-The-Fly) data
set (one map at one polarization) and convert it to AIPS pseudo-UV
single-dish format within AIPS.  For further information on the
reduction of 12m OTF data, see the 12m observers memo "How to Process
Spectral Line On The Fly Data" by Jeff Mangum.

                          COMMENTS

     Currently, OTFUV will only process spectral-line OTF data from the
12m.  In the future, OTFUV will be adapted to process continuum OTF data
obtained at the 12m.
