; HORUS
;---------------------------------------------------------------
;! makes images from unsorted UV data, applying any calibration
;# Task Imaging AP
;-----------------------------------------------------------------------
;;  Copyright (C) 1995-1997, 1999-2000, 2004, 2006, 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
;-----------------------------------------------------------------------
HORUS     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
HORUS     Task to calibrate and image data
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 #
SOURCES                            Source list
QUAL            -10.0              Calibrator qualifier -1=>all
TIMERANG                           Time range to use
UVRANGE         0.                 Min & max baseline (klambda)
STOKES                             Stokes type to image
OPTYPE                             'SUM ' or 'LINE'
SELBAND                            Bandwidth to select (kHz)
SELFREQ                            Frequency to select (MHz)
FREQID                             Freq. ID to select.
BIF               0.0      100.0   Lowest IF number 0=>all
EIF               0.0      100.0   Highest IF number 0=>all
BCHAN             0.0     2048.0   Lowest channel number 0=>all
ECHAN             0.0     2048.0   Highest channel number
CHINC                              Channel incr. between maps.
SUBARRAY          0.0     1000.0   Subarray, 0=>all
DOCALIB          -1.0      101.0   > 0 calibrate data & weights
                                   > 99 do NOT calibrate weights
GAINUSE                            CL (or SN) table to apply
DOPOL            -1.0       10.0   If >0 correct polarization.
BLVER                              BL table to apply.
FLAGVER                            Flag table version
DOBAND           -1.0       10.0   If >0 apply bandpass cal.
                                   Method used depends on value
                                   of DOBAND (see HELP file).
BPVER                              Bandpass table version
SMOOTH                             Smoothing function. See
                                   HELP SMOOTH for details.
OUTNAME                            Output image name 1st 4
                                   char. used.
OUTSEQ           -1.0     9999.0   Output image seq. #
OUTDISK           0.0        9.0   Output image disk unit #.
IMSIZE         32.       4096.     Image size (X,Y) is pixels
CELLSIZE      1.E-12               (X,Y) size of grid in asec
SHIFT                              (X,Y) image shift in asec
UVTAPER         0.                 (U,V) gaussian taper
                                     units are kilolambda
UVWTFN                             UV dist. weight function
                                     blank => uniform
UVBOX           0.        128.     Additional rows and columns
                                   used in weighting. Use 0.
ZEROSP                             0-spacing fluxes and weights
XTYPE           0.         10.     Conv. function type in x
                                     default spheroidal
YTYPE           0.         10.     Conv. function type in y
                                     default spheroidal
XPARM                              Conv. function parms for x
YPARM                              Conv. function parms for y
GUARD          -1.0         0.9    x,y guard band fractional
                                   radius
BADDISK           0.0     9999.0   Disks to avoid for scratch
----------------------------------------------------------------
HORUS
Task:  Image a data set with optional application of calibration
       and editing.  Multiple sources may be processed in a
       single run.  HORUS will process either "XY" or "TB"
       sorted data but the maximum size of the image which can
       be produced from TB ordered data is limited by the size
       of the "AP".  A 64kword AP can make a 128x128 image.
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.
  SOURCES....Source list.  One output file will be made per
             source.  '*' = all; a "-" before a source name
             means all except ANY source named.
  QUAL.......Only sources with a source qualifier number in the
             SU table matching QUAL will be used if QUAL is not
             -1.
  TIMERANG...Time range of the data to be imaged. In order:
             Start day, hour, min. sec,
             end day, hour, min. sec. Days relative to ref.
             date.
  UVRANGE....(Minimum,Maximum) baseline (kilolambda) in map.
  STOKES.....The desired Stokes type of the output data:
             'I','V','Q','U','R', or 'L'.
              Anything else => 'I'
  OPTYPE.....The type of image, 'SUM' = all channels in the
             same image, 'LINE' = each channel in a separate
             plane.  For 'LINE' only IF=BIF is processed.
             All others are set to 'LINE' if there is more than
             one frequency channel or 'SUM ' if not.
  SELBAND....Bandwidth of data to be selected. If more than
             one IF is present SELBAND is the width of the
             first IF required. Units = kHz. For data which
             contain multiple bandwidths/frequencies the task
             will insist that some form of selection be made
             by frequency or bandwidth.
  SELFREQ....Frequency of data to be selected. If more than
             one IF is present SELFREQ is the frequency of the
             first IF required. Units = MHz.
  FREQID.....Frequency identifier to select (you may determine
             which is applicable from the OPTYPE='SCAN' listing
             produced by LISTR). If either SELBAND or SELFREQ
             are set, their values overide that of FREQID.
             However, setting SELBAND and SELFREQ may result in
             an ambiguity.  In that case, the task will request
             that you use FREQID.
  BIF........First IF to image.   0 => 1.
  EIF........Highest IF to image. 0=>all higher than BIF in SUM
             mode.  EIF is forced to BIF in LINE mode (with a
             warning if EIF was changed).
  BCHAN......First channel to image.   0 => 1.
  ECHAN......Highest channel to image. 0 => all higher than
             BCHAN.
  CHINC......Number of input planes to skip between maps. (0=>1)
  SUBARRAY...Subarray number to image. 0=>all.
  DOCALIB....If true (>0), calibrate the data using information in the
             specified Cal (CL) table for multi-source or SN table for
             single-source data.  Also calibrate the weights unless
             DOCALIB > 99 (use this for old non-physical weights).
  GAINUSE....version number of the CL table to apply to
             multisource files or the SN table for single
             source files.  0 => highest.
  DOPOL......If > 0 then correct data for instrumental
             polarization as represented in the AN table.  This
             correction  is only useful if PCAL has been run or
             feed polarization parameters have been otherwise
             obtained. See HELP DOPOL for available correction
             modes.
  BLVER......Version number of the baseline based calibration
             (BL) table to appply. <0 => apply no BL table,
             0 => highest.
  FLAGVER....specifies the version of the flagging table to be
             applied. 0 => highest numbered table.
             <0 => no flagging to be applied.
  DOBAND.....If true (>0) then correct the data for the shape of the
             antenna bandpasses using the BP table specified by BPVER.
             The correction has five modes:
             (a) if DOBAND=1 all entries for an antenna in the table
             are averaged together before correcting the data.
             (b) if DOBAND=2 the entry nearest in time (including
             solution weights) is used to correct the data.
             (c) if DOBAND=3 the table entries are interpolated in
             time (using solution weights) and the data are then
             corrected.
             (d) if DOBAND=4 the entry nearest in time (ignoring
             solution weights) is used to correct the data.
             (e) if DOBAND=5 the table entries are interpolated in
             time (ignoring solution weights) and the data are then
             corrected.
  BPVER......Specifies the version of the BP table to be applied
             plotted (if APARM(8)=2) or applied (if DOBAND > 0
             and APARM(8) .NE. 2). 0 => highest numbered table.
             <0 => no bandpass correction to be applied.
  SMOOTH.....Specifies the type of spectral smoothing to be applied to
             a uv database . The default is not to apply any smoothing.
             The elements of SMOOTH are as follows:
             SMOOTH(1) = type of smoothing to apply: 0 => no smoothing
               To smooth before applying bandpass calibration
                 1 => Hanning, 2 => Gaussian, 3 => Boxcar, 4 => Sinc
               To smooth after applying bandpass calibration
                 5 => Hanning, 6 => Gaussian, 7 => Boxcar, 8 => Sinc
             SMOOTH(2) = the "diameter" of the function, i.e. width
               between first nulls of Hanning triangle and sinc
               function, FWHM of Gaussian, width of Boxcar. Defaults
               (if < 0.1) are 4, 2, 2 and 3 channels for SMOOTH(1) =
               1 - 4 and 5 - 8, resp.
             SMOOTH(3) = the diameter over which the convolving
               function has value - in channels.  Defaults: 1,3,1,4
               times SMOOTH(2) used when input SMOOTH(3) < net
               SMOOTH(2).
  OUTNAME....1st 4 characters of the output image name. The
             following 8 are the 1st 8 of the source name.
  OUTSEQ.....Output image name (seq. #).   0 => highest unique
  OUTDISK....Disk drive # of output image. 0 => highest with
             space for the file.
  IMSIZE.....(X,Y) image size in pixels.
             Must be a power of 2 on each side from 32X32
             to 4096X4096.  For TB ordered data the actual limit
             depends on the amount of "AP" memory available.
  CELLSIZE...(X,Y) pixel separation in asec.
  SHIFT......(X,Y) shift of map center from phase center in asec.  Map
             center = Phase center + shift. If X>0 & Y>0, source shifts
             to south-west (down & right).   See HELP SHIFT.  Shifts are
             in arc seconds at the initial reference position making
             RA = RA0 + SHIFT(1)/cos(DEC) and DEC = DEC0 + SHIFT(2).
  UVTAPER....(U,V) gaussian taper (kilolambda) at 30% level
  UVWTFN.....Weighting function of (u-v) place.
             blank=>Uniform; 'NA'=>Natural
  UVBOX......(U,V) box size for smoothing.  Only used if data
             XY sorted.
  ZEROSP.....Zero-spacing value of I,Q,U,V, Weight
  XTYPE......Convolution function type in X-direction
             1=Pillbox, 2=exponential, 3=Sinc, 4=Exp*Sinc,
             5=Spheroidal, 6=exp*BESSJ1(x)/x.
              <= 0 or > 5  -> 5.
  YTYPE.....Convolution function type in Y-direction
  XPARM.....Array containing parameters for XTYPE.
            See HELP UVnTYPE when n=convolution type.
  YPARM.....Array containing parameters for YTYPE.
  GUARD.....Fraction of the x and y radius for which uv samples
            are not allowed.  < 0 => just enough to avoid
            mathematical errors in the convolution.
            0 => 0.3 * SQRT(taper weight at 0.3 from edge).
  BADDISK....A list of disks on which scratch files are not to
             be placed.  This will not affect the output file.
----------------------------------------------------------------
HORUS: Task to make images from uv data with optional
       calibration and editing.
Documentor:  W. D. Cotton
Related Programs: All calibration routines

     Horus was the son of the Eqyptian god and goddess Osirus
and Isis.  Osirus was the first Egyptian king, a just and wise
ruler who invented civilization and agriculture.  His evil
brother Set was jealous of Osirus and wanted his throne and his
wife/sister.  Set killed Osirus and chopped his body into 17
pieces and threw them into the Nile.  Isis collected all of his
parts except his penis which had been eaten by crabs.  She made
a copy of his missing member and reassembled and embalmed his
body.  With the help of the mummy, she conceived Horus to avenge
his father's death and to assume his throne.  She then raised
him in a marsh to protect his from his uncle.
     After a long and undecisive war, Set took the matter to
court - a tribunal of the gods.  The gods were unable to decide
if the issue should be settled on the basis of might or right.
After the trial had lasted for 80 years, the gods started
bickering.  The minor god Baba taunted presiding god Ra-Harakhte
(who was becoming senile) that "Your shrine is empty!" and he
went into a snit and wouldn't come back until his daughter
Hathor exposed herself to him.
     Isis then tricked Set into making statments which were
damaging to his case and a decision was reached in Horus' favor.
Horus then married Hathor and assumed the throne of Osirus.
After his death was thus avenged, Osirus was resurrected and
became the king of the underworld (near present day Libya) and
the judge of the dead.  The pharoahs of Egypt thereafter claimed
to be the living incarnation of Horus.

(ref. V. Ions, 1982, "Egyptian Mythology", Peter Bedrick Books,
New York)
