; STACK
;---------------------------------------------------------------
;! Task to co-add a set of 2-dimensional images with weighting
;# TASK IMAGING
;-----------------------------------------------------------------------
;;  Copyright (C) 2015
;;  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
;-----------------------------------------------------------------------
STACK     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
STACK:  Task to co-add a set of 2-D images with weighting
INNAME                             Input name(name).
INCLASS                            Input name(class).
INSEQ           0.0      9999.0    Input name(seq. #). 0=>high
INDISK                             Input disk drive #. 0=>any
IN2SEQ          0.0                Upper limit sequence number
OUTNAME                            Output name(name).
OUTCLASS                           Output name(class).
OUTSEQ         -1.0      9999.0    Output name(seq. #).
                                     0 => highest unique
OUTDISK                            Output image disk drive #
                                     0 => highest with room
BLC             0.0      4096.0    Bottom left corner of image
                                     0=>entire image
TRC             0.0      4096.0    Top right corner of image
                                     0=>entire image
OPCODE                             '   ' average INSEQ-IN2SEQ
                                   'MEDI' median INSEQ-IN2SEQ
                                   'CUBE' average BLC(3)-TRC(3)
                                   'MEDC' median BLC(3)-TRC(3)
INFILE                             Text file with weights
----------------------------------------------------------------
STACK
Type: Task
Use:  STACK will do a weighted average of two-dimensional images,
      either from a sequence of image files having the same name and
      class and sequence numbers from INSEQ through IN2SEQ or from the
      planes of a cube from BLC(3) through TRC(3).  The weights may be
      read in from a text file, taken from the ACTNOISE keyword in
      each file, or found by robust rms means on a per-plane basis.
      Not all images in the sequence INSEQ through IN2SEQ need be
      present and magic blanked pixels are ignored.  The old task
      SUMIM requires all images in the sequence to be present, does no
      weighting, and blanks any pixel for which one of the input
      pixels was blank.
Adverbs:
  INNAME......Input name of image(name).     Standard defaults.
  INCLASS.....Input name of image(class).    Standard defaults.
  INSEQ.......Input name of image(seq. #).   0 => highest.
  INDISK......Disk drive # of image.         0 => any.
  IN2SEQ......Upper limit for the liip over image sequence number.
  OUTNAME.....Output name of image(name).    Standard defaults.
  OUTCLASS....Output name of image(class).   Standard defaults.
  OUTSEQ......Output name of image(seq. #).  0 => highest unique
  OUTDISK.....Disk drive # of Output image.  0 => highest with
              space.
  BLC.........The bottom left-hand pixel of the input image
              which becomes the bottom left corner of the
              subimage.  The value (0,0) means (1,1).
  TRC.........The top right-hand pixel of the input image
              which becomes the top right corner of the
              subimage.  The value (0,0) means take the top
              right hand corner of the image.  The same BLC and TRC
              are applied to each input image and TRC(3) is forced to
              BLC(3) except in CUBE mode.
  OPCODE......'    ' = do weighted sum of images INSEQ-IN2SEQ
              'CUBE' = do weighted sum of planes BLC(3)-TRC(3)
  INFILE......If not blank, weights are read from this text file.
              Each row of the file has one weight in free format and
              must contain lines for all sequence numbers from INSEQ
              through IN2SEQ or all planes from BLC(3) through TRC(3)
              even if some images are missing or planes all blanked.
----------------------------------------------------------------
