%-----------------------------------------------------------------------
%;  Copyright (C) 1995-1996, 1998, 2000-2021, 2022, 2024-2025
%;  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
%-----------------------------------------------------------------------
\chapts{Analyzing Images}{anal}

\renewcommand{\titlea}{31-December-2025 (revised 10-October-2025)}
\renewcommand{\Rheading}{\AIPS\ \cookbook:~\titlea\hfill}
\renewcommand{\Lheading}{\hfill \AIPS\ \cookbook:~\titlea}
\markboth{\Lheading}{\Rheading}

     In order to obtain useful astronomical information from the data,
software exists for the analysis of images, combining of images,
estimating of errors, etc.  Only a few of the programs are described
in any detail here; the others should be self-explanatory using the
{\tt HELP} and {\tt INPUTS} files for the tasks listed in
\Rchap{list}.  A complete list of software in \AIPS\ for the analysis
of images may also be obtained at your terminal by typing {\us ABOUT
ANALYSIS \hbox{\CR}}.

\Sects{Combining two images (\/{\tt COMB})}{comb}

     The task {\tt \tndx{COMB}} is a general purpose program for
combining two images, pixel by pixel, to obtain a third image.  Many
options are available and, as a first example, we illustrate inputs to
subtract a continuum image from a spectral line image cube.

\subsections{Subtracting a continuum image from an image cube}

A common method to obtain a spectral data cube containing only line
signal without any continuum emission is to create a line-free
continuum image {\it C\/}, and subtract it from the data cube
\hbox{{\it L}}.  For a more general discussion and alternative methods
see \Sec{linecsub}.  {\tt COMB} can be used to this purpose as follows:
\dispt{TASK\qs 'COMB' ; INP \CR}{to review the required inputs.}
\dispt{INDI\qs 0 ; MCAT \CR}{to help you find the catalog numbers of
            {\it C\/} and {\it L\/}.}
\dispt{INDI\qs{\it n1\/} ; GETN\qs {\it ctn1\/} \CR}{to select the
            {\it L\/} image cube from disk {\it n1\/} catalog slot
            {\it ctn1\/}.}
\dispt{IN2D\qs{\it n2\/} ; GET2N\qs {\it ctn2\/} \CR}{to  select the
            {\it C\/} image from disk {\it n2\/} catalog slot {\it
            ctn2\/}.}
\dispt{OUTN\qs '{\it xxxxx\/}' \CR}{to specify {\it xxxxx\/} for the
            name of the continuum-free image cube.}
\dispt{OUTC\qs '{\it ccc\/}' \CR}{to specify {\it ccc\/} for the class
            of the continuum-free image cube, \eg\ \hbox{{\us LCUBE}}.}
\dispt{OPCODE\qs 'SUM' \CR}{to select the addition algorithm.}
\dispt{APARM\qs 1, -1 \CR}{to specify that we want $+1\times L
            -1\times C$.}
\dispt{GO \CR}{to compute the continuum-free, line-only output cube.}
\dispe{Once {\tt COMB} task has terminated with the message {\tt COMB:
APPEARS TO END SUCCESSFULLY}, you should find the requested image in
your catalog:}
\dispt{MCAT \CR}{to list the images in your catalog.}
\pd

\Subsections{Polarized intensity and position angle images}{analpoli}

As a second example, we derive the \indx{polarization} intensity and
angle from the Q and U Stokes parameter images.  To compute a
polarized intensity image, enter:
\dispt{TASK\qs 'COMB' ; INP \CR}{to review the required inputs.}
\dispt{INDI\qs 0 ; MCAT \CR}{to find the catalog numbers of
               the Q and U images.}
\dispt{INDI\qs{\it n1\/} ; GETN\qs {\it ctn1\/} \CR}{to select the Q
               image from disk {\it n1\/} catalog slot {\it ctn1\/}.}
\dispt{IN2D\qs{\it n2\/} ; GET2N\qs {\it ctn2\/} \CR}{to select the U
               image from disk {\it n2\/} catalog slot {\it ctn2\/}.}
\dispt{OUTN\qs '{\it xxxxx\/}' \CR}{to specify {\it xxxxx\/} for the
               name of the polarized intensity image.}
\dispt{OUTC\qs '{\it ccc\/}' \CR}{to specify {\it ccc\/} for the class
               of the polarized intensity image, \eg\ \hbox{{\us
               PCLN}}.}
\dispt{OPCODE\qs 'POLC' \CR}{to select the $\sqrt{{\Qm}^2+{\Um}^2}$
               algorithm with correction for noise.}
\dispt{BPARM\qs {\it ns1\/} , {\it ns2\/} \CR}{to specify the noise
               levels of the 2 images.}
\dispt{GO \CR}{to compute the corrected, polarized intensity image.}
\dispe{\AIPS\ will write the message {\tt TASK COMB BEGINS} followed
by a listing of the {\tt POL. INTENSITY} algorithm.  While it is
running, you can prepare the inputs to make a \indx{polarization}
position angle image.  Type:}
\dispt{OUTN\qs '{\it yyyyy\/}' \CR}{to specify {\it yyyyy\/} for the
           name of the polarization angle image.}
\dispt{OUTC\qs '{\it ddd\/}' \CR}{to specify {\it ddd\/} for the class
           of the polarization angle image, \eg\ {\us PSIMAP},
           \hbox{{\us CHICLN}}.}
\dispt{OPCODE\qs 'POLA' \CR}{to select the ${1\over2}\tan^{-1} \left(
           \Um\over\Qm \right) $ algorithm.}
\dispe{Once {\tt COMB} has finished, enter:}
\dispt{GO \CR}{to compute the polarization angle image.}
\pd

\subsections{Other image combination options}

     {\tt \tndx{COMB}} may also be used to re-scale images, and to
compute spectral indices, optical depths, etc.  Type:
\dispt{HELP\qs COMB \CR}{to review the available options.}
\dispe{The {\tt OPCODE} options are:}
\par\vspace{5pt}
\centerline{\vbox{\halign{\lft{{\us #}}\qquad&\lft{#}\qquad
     &$\lft{#}$\cr
   'SUM '&Addition      &a_1\Times {\MAP}_1 + a_2\Times {\MAP}_2
                              + a_3\cr
 \noalign{\vskip 2pt}
   'SUMM'&Addition      &a_1\Times {\MAP}_1 + a_2\Times {\MAP}_2
                              + a_3 \qquad
                             \Ex\quad \mbox{blanked pixels replaced
                             with}\quad 0\cr
 \noalign{\vskip 2pt}
   'MEAN'&Average      &a_1\Times {\MAP}_1 + a_2\Times {\MAP}_2 \qquad
                             \qquad \Ex\quad {\MAP}_j\quad \Wh\quad
                             {\MAP}_i\quad \mbox{blanked}\cr
 \noalign{\vskip 2pt}
   'MULT'&Multiplication&a_1\Times {\MAP}_1 \Times {\MAP}_2 + a_2\cr
 \noalign{\vskip 2pt}
   'DIV '&Division      &a_1\Times{{\MAP}_1 / {\MAP}_2} + a_2\cr
 \noalign{\vskip 3pt}
   'SPIX'&Spectral Index&a_1\Times \ln\left( {{\MAP}_1 / {\MAP}_2}\right) /
                         \; \ln\left( {\nu_1 / \nu_2}\right)  + a_2
                          \qquad \Wh\quad {\MAP}_1 > a_3 \quad\mbox{and}
                          \quad {\MAP}_2 > a_4 \cr
 \noalign{\vskip 3pt}
   'OPTD'&Opacity       &a_1\Times\ln\left(a_3 {{\MAP}_1 /
                              {\MAP}_2} + a_4\right) + a_2
                          \qquad \Wh \quad {\MAP}_1 > a_5 \quad
                          \mbox{and} \quad {\MAP}_2 > a_6\cr
 \noalign{\vskip 3pt}
   'POLI'&RMS sum       &a_1\Times\sqrt{{\MAP}_1^2 + {\MAP}_2^2} + a_2\cr
 \noalign{\vskip 3pt}
   'POLC'&RMS sum       &a_1\Times C({\MAP}_1,{\MAP}_2)\sqrt{{\MAP}_1^2 +
                               {\MAP}_2^2} + a_2\cr
         &              &\qquad\qquad\qquad\hbox {where {\it C\/} is a
                              noise-based correction for Ricean bias}\cr
 \noalign{\vskip 3pt}
   'POLA'&Arctangent    &a_1\Times{\tan^{-1}}\left( {{\MAP}_2 /
                              {\MAP}_1}\right) + a_2  \qquad \Wh \quad
                              \sqrt{{\MAP}_1^2 + {\MAP}_2^2} > a_3\cr
 \noalign{\vskip 3pt}
   'REAL'&Real part     &a_1\Times {\MAP}_1 \Times \cos \left(
                              a_2\Times {\MAP}_2 \right) + a_3\cr
 \noalign{\vskip 2pt}
   'IMAG'&Imaginary part&a_1\Times{\MAP}_1 \Times \sin \left(
                              a_2\Times {\MAP}_2 \right) + a_3\cr
 \noalign{\vskip 2pt}
   'RM\ \ '&Rotation measure&a_1\Times RM({\MAP}_1, {\MAP}_2) + a_2\cr
 \noalign{\vskip 2pt}
   'CLIP'&Clipping      &{\MAP}_1\qquad\mbox{except blanked where}\quad
                              a_1 > {\MAP}_2 > a_2\cr
   \     &\             &\phantom{{\MAP}_1\qquad
                              \mbox{except blanked when}}\mbox{or}\quad
                              a_2 > a_1 > {\MAP}_2\cr
   \     &\             &\phantom{{\MAP}_1\qquad
                              \mbox{except blanked when}}\mbox{or}\quad
                              {\MAP}_2 > a_2 > a_1\cr}}}
\dispe{where the $a_i$ are user-adjustable parameters --- specified by
{\tt APARM} --- and ${\MAP}_1$ and ${\MAP}_2$ are the images selected
by {\tt INNAME}, {\it etc.}  and by {\tt IN2NAME}, {\it etc.},
respectively.  {\tt COMB} may be instructed to write an image of the
estimated noise in the combination in addition to the direct result
of the combination.  These noise images may be used as inputs to {\tt
COMB} and, \eg {\tt BLANK} to control later computations.  When
combining numerous images together, set {\tt DOHIST=-2} to prevent
history files from becoming much larger than the images.}
\iodx{sum}\iodx{spectral index}\iodx{opacity}\iodx{rotation measure}

{\tt \tndx{CONVL}} can compute the cross-correlation of two images and
report the location of the peak cross-correlation.

\subsections{Considerations in image combination}

     {\tt COMB} can use images of the uncertainties in the first two
input images to control the computation of the output.  The new task
{\tt \tndx{RMSD}} may be used to create an image of the rms in an
image, computing the rms self-consistently (robust, histogram, and
median absolute deviation methods available) in windows surrounding
each pixel.  Task {\tt \tndx{FLATN}} can compute weight and noise
images corresponding to mosaiced images.

     For some applications of {\tt \tndx{COMB}}, \indx{undefined
pixel} values may occur.  For example, if the spectral index is being
calculated and the intensity level on either image is negative, the
index is undefined. In this case, the pixel value is given a number
which is interpreted as undefined or ``blanked.''  Blanking also
arises naturally in operations of division, opacity, polarization
angle, and clipping and, of course, the input images may themselves be
blanked.  In addition, the output image can be blanked (set {\us
BPARM(4) = 0}) whenever either ${\MAP}_1 < ${\tt APARM(9)} or
${\MAP}_2 < ${\tt APARM(10)}. Alternatively, blanking may be done on
the basis of the estimated noise (set {\us BPARM(4) = 1}) or
signal-to-noise ratio (set {\us BPARM(4) = 2}) in the combination.
See {\us HELP COMB \CR} for a description of these options and certain
limitations in their use. With {\us APARM(8) = 1 \CR}, the user may
specify that all undefined pixels are to be assigned an apparently
valid value of zero, rather than the ``magic'' undefined-pixel value.
Alternatively,  the task {\tt \tndx{REMAG}} can be used to replace
blanked pixels in the output image with a user-specified value.
\iodx{blanked pixel}

     When combining two or more images, {\tt COMB}, {\tt PCNTR}, {\it
et al.}~must decide which pixels in the $2^{\und}$ image go with which
pixels in the $1^{\ust}$ image.  The user input parameter {\tt
DOALIGN} controls this process.  A value of 1 requires the two headers
to be correct and sufficiently similar that an alignment by coordinate
value is possible.  A value of $-2$ tells the programs to ignore the
headers and align by pixel number.  Enter {\us HELP DOALIGN \CR} for
details and intermediate options.  In some cases, the images may have
been created on different grids which are correctly described in the
headers.  The observations, for example, could have differed in the
phase reference position or projective geometry used or the imaging
could have been done with different axis increments.  Such images
should {\it not\/} be combined directly.  Instead, the header of one
should be used as a template for re-gridding the other.  tasks {\tt
\tndx{HGEOM}} and {\tt \tndx{OHGEO}} provide this service with good
interpolation methods. See \Sec{analgeom} and type {\us EXPLAIN HGEOM
\CR} or {\us EXPLAIN OHGEO \CR} for more information.

\Sects{Combining more than two images (\/{\tt CMPLX}, {\tt SUMIM}, {\tt SPIXR}, {\tt STACK})}{spixr}

The task {\tt \Tndx{CMPLX}} is new in {\tt 31DEC21}\@.  For pairs of
images which represent a complex quantity (either real and imaginary
or amplitude and phase), {\tt CMPLX} will perform various complex
mathematical operations on one such pair (conjugate or swap the type) or
combining two such pairs (various sums, multiplications, and divisions).

The task {\tt \tndx{SUMIM}} is used to sum or average any number of
images. Since \AIPS\ has only a limited number of adverbs of the kind
{\tt INNAME}, {\tt IN2NAME}, etc., {\tt SUMIM} requires that all input
images have identical {\tt INNAME} and \hbox{{\tt INCLASS}}. The input
images are then specified by {\tt INSEQ} (the sequence number of the
{\it first\/} input image), {\tt IN2SEQ} (the sequence number of the
{\it last\/} input image), and {\tt IN3SEQ} (the increment in sequence
number). All input images have to reside on the {\it same\/} disk.
\dispt{TASK\qs 'SUMIM' ; INP \CR}{to review the required inputs.}
\dispt{INDI\qs 0 ; MCAT \CR}{to help you find the catalog number of
            the first input image.}
\dispt{INDI\qs{\it n\/} ; GETN\qs {\it ctn\/} \CR}{to select the first
            input image from disk {\it n\/} catalog slot {\it ctn\/}.}
\dispt{IN2SEQ\qs{\it s\/} \CR}{to specify the sequence number of the
            last image to be included.}
\dispt{IN3SEQ\qs 0} {to specify the increment in sequence number
            ($=1$).}
\dispt{OUTN\qs '{\it xxxxx\/}' \CR}{to specify {\it xxxxx\/} for the
            name of the output image.}
\dispt{OUTC\qs '{\it ccc\/}' \CR}{to specify {\it ccc\/} for the class
            of the output image.}
\dispt{FACTOR\qs{\it f\/} \CR}{to specify the factor with which to
            multiply each image before adding. $f=1$ leads to
            summation, $f=0$ defaults to the inverse of the
            number of input images (average)}
\dispt{GO \CR}{to start {\tt SUMIM}.}
\dispe{This is a very noisy way to make a line-sum image.  For more
serious work, use {\tt BLANK} (\Sec{analblank}) and {\tt XMOM}
(\Sec{lineanal}) instead.}

A popular analysis technique has been developed in which images
centered upon objects of some chosen kind are simply added up even
though the objects' emission is less than the noise.  The belief is
that, if there is real emission just below detectability in individual
images, the summed image will reduce the noise and reveal the weak
emission.  The task {\tt \Tndx{STACK}} attempts such an analysis doing a
weighted mean or median of a matched set of images ignoring the
coordinates.

The task {\tt \Tndx{SPIXR}} is intended to fit spectral indexes
optionally including curvature to a cube of image planes.  This cube
is build with {\tt \tndx{FQUBE}} to make an {\tt FQID} axis out of
irregularly spaced frequencies.  The cube is transposed by {\tt
\tndx{TRANS}} to put the {\tt FQID} or, if build with {\tt MCUBE},
frequency axis first.  Then {\tt SPIXR} will do a least squares fit
for spectral index.  Again, the results will be noisy unless the
initial images have been blanked and converted to similar spatial
resolution.  The {\tt DPARM} and {\tt CPARM} options in {\tt SPIXR}
may also be used to blank pixels with bad solutions.  An interactive
version of {\tt SPIXR} called {\tt \Tndx{TVSPX}} has appeared in
{\tt 31DEC24}\@.  It allows you to interact with the outputs to attempt
to get better solutions by omitting selected channels.  In {\tt
31DEC25}, a similar task called {\tt \Tndx{LISPX}} fits spectral indices
to spectra in text files rather than image files.  The new task
{\tt \tndx{IM2TX}} writes such text files with the sum, average, or rms
over a region in an image cube while {\tt \tndx{TX2IM}} reads such text
files to create a one-dimensional image on \AIPS\ disk.  Such images
play nicely with {\tt SLICE}. {\tt SLFIT}, and all the slice display
verbs.  Another new task {\tt \Tndx{SPXMD}} creates model image cubes
with spectral indices.  See \AIPS\ Memo 126.\footnote{Greisen,
E. W. 2025, ``Spectral index fitting in \AIPS,'' AIPS Memo 126, {\tt
https://www.aips.nrao.edu/aipsdoc.html}}  The task {\tt \Tndx{SPFIX}} may
be used to construct a model image cube based on the output of {\tt
SPIXR}\@.  In {\tt 31DEC24}, {\tt \Tndx{UNSPX}} may be used to correct
the input cube (or, for example, a matching polarization cube) for the
spectral index.

\Sects{Image statistics and flux integration}{statistic}

     The task {\tt \tndx{IMEAN}} is used to determine the
\indx{statistics} of the image inside, or outside a specified
rectangular or circular area.  It derives the minimum and maximum
value and location, the rms, the average value and, if the image has
been Cleaned, an approximate \indx{flux density} within the area.  A
typical run might be:
\dispt{TASK\qs 'IMEAN' ; INP \CR}{to list the input parameters.}
\dispt{INDI\qs{\it n\/} ; GETN\qs {\it ctn\/} \CR}{to select the image
            file from disk {\it n\/} catalog slot {\it ctn\/}.}
\dispt{BLC\qs{\it n1\/}, {\it n2\/} ; TRC\qs{\it m1\/}, {\it m2\/}
            \CR}{to set the window from ({\it n1\/},{\it n2\/}) to
            ({\it m1\/},{\it m2\/}) --- or use {\tt \tndx{TVWIN}} with
            the cursor on the \hbox{TV}.}
\dispt{DOHIST\qs TRUE \CR}{to make a plot file of the pixel
            \indx{histogram}.}
\dispt{PIXRANGE\qs{\it x1\/}, {\it x2\/} \CR}{to set the range of the
            histogram from {\it x1\/} to {\it x2\/}.}
\dispt{NBOXES\qs{\it n\/} \CR}{to set the number of boxes in the
            histogram.}
\dispt{DOALL\qs 1 \CR}{to include pure 0 pixels in the statistics,
            a {\tt 31DEC24} option.  Otherwise they are ignored.}
\dispt{GO \CR}{to run the task.}
\dispe{A circular aperture may be specified with {\tt BLC =
-1,$radius$ ; TRC = $X_c , Y_c$}\@.  {\tt IMEAN} attempts to determine
the true noise of the image by fitting the peak of the histogram and
reports both that result and the one found by including all pixels
within the window.  {\tt IMEAN} now gets the initial guess for the
true noise from a robust computation over the input window and
returns the adverbs {\tt PIXSTD} and {\tt PIXAVG} from the histogram
fit to the {\tt AIPS} program.  {\tt IMEAN} now fills an additional
output adverb such that {\tt TRIANGLE($i$)} is the brightness level
exceeded by only $i$ per cent of the image.}

     The statistics will appear in the \AIPS\ window.  For a hard
copy type:
\dispt{PRTASK\qs 'IMEAN' ; PRTMSG \CR}{with {\tt PRIO} $\leq$ 5.}
\dispe{To see the histogram of the intensities, an example of which is
shown in \Sec{plotmisc}, type one of:}
\dispt{GO\qs \tndx{TKPL} \CR}{to display the histogram in the
         Tektronix window.}
\dispt{GO\qs LWPLA \CR}{to display the histogram on a PostScript
         printer.}
\pd

     The verbs {\tt \tndx{TVSTAT}} and {\tt \tndx{IMSTAT}} provide
similar functions to {\tt IMEAN} without the histogram and true rms
options.  Both return their results as {\tt AIPS} parameters {\tt
PIXAVG} (mean), {\tt PIXSTD} (rms), {\tt PIXVAL} (maximum), {\tt
PIXXY} (pixel position of the maximum), {\tt PIX2VAL} (minimum), {\tt
PIX2XY} (pixel position of the minimum).  {\tt IMSTAT} uses the same
file name, {\tt BLC}, and {\tt TRC} parameters as {\tt IMEAN}
including the circular aperture convention.  It is useful to prepare
the initial rms guess for that task although the {\tt PIXSTD} it
returns will often be a factor of several too large.  {\tt TVSTAT},
however, works on the image plane currently displayed on the TV and is
not limited to a single rectangular area.  Instead, the TV cursor is
used to mark one or more polygonal regions over which the function is
to be performed.  Type {\us EXPLAIN\qs TVSTAT \CR} for a description
of its operation.

     The interactive task {\tt \tndx{BLSUM}} employs a method similar
to that of \hbox{{\tt TVSTAT}}.  The TV cursor is used to mark a
region of interest in a ``blotch'' image.  Then {\tt BLSUM} finds the
flux in that region not only in the \indx{blotch} image but also in
each plane (separately) of a second image.  More than one region of
interest may be done in any given execution of the task.  In
spectral-line problems, the blotch image is often the continuum or the
line sum while the second image is the full ``cube'' in almost any
transposition.  The spectrum obtained may be saved as a {\tt SL}ice
file for further analysis and display.  The spectra may be saved as true
plot files as well as printer plots and the flux summation may be
weighted by the values (or their squares) found in the blotch image.
Numerous continuum applications also exist (\eg\ polarization,
comparison across frequency).  Type {\us EXPLAIN\qs BLSUM \CR} for a
description of the operation.

     The verb {\tt \tndx{IMDIST}} is used to measure the angular
distance and position angle between two pixel positions in up to two
images.  The separation is returned as adverb {\tt DIST}\@.  Verb
{\tt TVDIST} allows you to select the two pixels interactively from
the TV display.

     The verb {\tt \Tndx{IMCENTER}} may be used to determine the
intensity-weighted centroid of a rectangular or circular portion of an
image.  The verb returns adverbs {\tt PIXXY}, {\tt COORDINA}, and {\tt
ERROR} giving the pixel and physical coordinates of the centroid and
an indicator of success or failure.

\Sects{Blanking of images}{analblank}

\iodx{blanked pixel}\iodx{undefined pixel}
In order to determine accurate flux values in images, or moments of
velocity profiles, it is desirable to restrict the integrations to
pixels that contain emission, or, in other words, to exclude pixels
that contribute only noise. If this is not done, the inclusion of
noisy pixels will increase the rms in the derived integrated value to
an unacceptable extent. The task {\tt \tndx{BLANK}} gives the user the
opportunity to replace pixels containing pure noise with values that
\AIPS\ and its tasks interpret as {\it undefined\/}. The decision
whether a certain pixel contains pure noise, or carries some emission,
can be made subjectively (using the TV) or in a more objective fashion
(see below for an example). In all cases, {\tt BLANK} creates an
output image which is a copy of the input image with some pixels
replaced by undefined values, or --- if the user specifies it --- by
the value zero.

The most straightforward use of {\tt BLANK} is to apply a cutoff to
the input image, e.g. let {\tt BLANK} replace with an undefined value
every pixel in the input image that lies below a specified. \eg\
$3\sigma$ noise level. This effectively removes almost all noisy
pixels. The disadvantage is that this method also removes any {\it
signal} below the $3\sigma$ noise level. Since a substantial fraction
of the total flux may be ``hidden'' in pixels below $3\sigma$, this
method prevents an accurate total flux determination.  Another
straightforward use of {\tt BLANK} is to remove all pixels outside a
user-specified radius.  This allows blanking regions for which the
primary-beam corrections, and hence the noise levels, are large. A new
{\tt OPCODE = 'BOX'} lets one simply blank all pixels inside or outside
a list of up to 10 circular or rectangular boxes.

\iodx{blanked pixel}\iodx{undefined pixel}
A better way to perform the blanking is one which is not based on the
pixel values in the input image itself, but on those in a {\it
second\/} input image. Typically this is a convolved (spatially and/or
in velocity) version of the input image, which has a higher signal to
noise for extended emission than the input image. In the example given
here we have the input image $I_1$ of full spatial resolution, and a
convolved version of this input image $I_2$ with a linear beam size
roughly twice full resolution. Careful inspection of this second image
has shown that there are no outlying noise peaks above {\it f}~mJy/beam.
{\tt \tndx{BLANK}} is then run as follows:
\dispt{TASK\qs 'BLANK' ; INP \CR}{to review the required inputs.}
\dispt{INDI\qs 0 ; MCAT \CR}{to help you find the catalog numbers of
             $I_1$ and $I_2$.}
\dispt{INDI\qs{\it n1\/} ; GETN\qs {\it ctn1\/} \CR}{to select $I_1$
             from disk {\it n1\/} catalog slot {\it ctn1\/}.}
\dispt{IN2D\qs{\it n2\/} ; GET2N\qs {\it ctn2\/} \CR}{to select $I_2$
             from disk {\it n2\/} catalog slot {\it ctn2\/}.}
\dispt{OUTN\qs '{\it xxxxx\/}' \CR}{to specify {\it xxxxx\/} for the
             name of the blanked output image.}
\dispt{OUTC\qs '{\it ccc\/}' \CR}{to specify {\it ccc\/} for the class
             of the blanked output image.}
\dispt{OPCODE\qs 'IN2C' \CR}{to specify that the blanking is
             performed using pixel values in a {\it second\/} input
             image.}
\dispt{DPARM(3)\qs $sim\,\, -f\, ,\, f$ \CR}{to set {\tt DPARM(3)}
             and {\tt DPARM(4)} to specify that all pixels with fluxes
             in the second input image in the interval {\it (-f,f)\/}
             should be blanked.}
\dispt{GO \CR}{to compute the blanked output image.}
\dispe{The task {\tt \tndx{REMAG}} can be used to replace blanked
pixels by a value to be specified by the user.}

     The \AIPS\ TV display may be used to do a more subjective
blanking with this task.  Set {\us OPCODE\qs 'TVCU' \CR} to display
the image, one plane at a time in any transposition.  You will be
prompted to set ``\indx{blotch}'' regions (much like {\tt TVSTAT} and
{\tt BLSUM}) to define the areas to be blanked.  This is one method
for having different regions of signal at different spectral channels.
There are also four windowing methods for blanking spectral-line cubes
which have been transposed to have the frequency axis be first.  In
these methods, a window (range of spectral channels) about the peak
signal in each spectrum is retained.

     The task {\tt \tndx{RMSD}} may be used to write a version of
the input image blanking pixels below $N$ times the rms in the image,
computing the rms self-consistently in windows surrounding each
pixel.

\Sects{Fitting of images}{analfit}

     There are three tasks and two verbs which estimate the position
and intensity of a component on a two-dimensional image.  The simplest
and fastest methods are the verb {\tt IMCENTER} and {\tt MAXFIT}\@.
The latter fits a two-dimensional parabola to the maximum within a few
pixels of an image position, and gives the peak and its position.  The
tasks {\tt IMFIT} and {\tt JMFIT} are similar and fit an image
subsection with up to four Gaussian components with error estimates.
Tasks {\tt SAD} and {\tt TVSAD} attempt to automate the process of
finding and \indx{fitting} Gaussian components in an image.
Additionally, in one dimension, the task {\tt SLFIT} fits Gaussian
components to slice data and the task {\tt XGAUS} fits Gaussian
components to each row of an image cube.\iodx{modeling}

\subsections{Centroid fits (\/{\tt IMCENTER}) and parabolic fit to maximum (\/{\tt MAXFIT})}

     You may determine a centroid for a region in an image with the
verb {\tt \Tndx{IMCENTER}}.  Set the name parameters for the desired
image and then define the region with adverbs {\tt BLC} and {\tt TRC},
perhaps using {\tt TVLOAD; TVWIN \CR}\@.  Set {\tt FLUX} if you wish
to limit the computations to pixel values greater than {\tt FLUX}\@.
Then \dispt{IMCENTER; \qs IMVAL \CR}{to find the value at the
centroid.}
\pd

%\vfill\eject
     {\tt \tndx{MAXFIT}}'s speed makes it useful for simple regions.
Type:
\dispt{EXPLAIN\qs MAXFIT \CR}{to get a good explanation of the
             algorithm.}
\dispe{The inputs should be self-explanatory.  The {\tt IMSIZE}
parameter can be important in crowded fields.  {\tt MAXFIT} can be
used conveniently by first displaying the image on the TV and then
typing:}
\dispt{IMXY ; MAXFIT \CR}{ }
\dispe{First the cursor will appear on the \hbox{TV}.  Move it close
to a maximum, press the left mouse button, and hit button A, B, C, or
\hbox{D}.  The fit will appear in your \AIPS\ window.  Adverb values
{\tt PIXXY}, {\tt PIXVAL}, {\tt COORDINA}, and {\tt ERROR} will be
set appropriately.  Adverb {\tt FSHIFT} will also be set to suggest
the shift needed to place the source directly on a pixel.}

\Subsections{Two-dimensional Gaussian fitting (\/{\tt IMFIT}, {\tt JMFIT})}{imfit}

     A more sophisticated least-squares fit of an image is obtained
with {\tt \tndx{IMFIT}}, which fits an image with up to four
\indx{Gaussian} components and attempts to derive error estimates.  A
linear or curved, two-dimensional ``baseline'' may also be fitted.  A
sample set-up is as follows:
\dispt{TASK\qs 'IMFIT' ; INP \CR}{to list the input parameters.}
\dispt{INDI\qs{\it n\/} ; GETN\qs {\it ctn\/} \CR}{to select the image
              from disk {\it n\/} catalog slot {\it ctn\/}.}
\dispt{BLC\qs{\it n1\/}, {\it n2\/} ; TRC\qs{\it m1\/}, {\it m2\/}
              \CR}{to set the area to be fitted as ({\it n1\/},{\it
              n2\/}) to ({\it m1\/},{\it m2\/}) --- or use {\tt TVWIN}
              with the cursor on the \hbox{TV}.}
\dispt{NGAUSS\qs 2 \CR}{to set the number of components to be fitted
              to 2.}
\dispt{CTYPE\qs 1, 1 \CR}{to have both components be Gaussians.}
\dispt{GMAX\qs 0.34\qs 0.20 \CR}{to give estimates of peak intensity
              in Jy.}
\dispt{GPOS\qs 200, 100, 210, 110 \CR}{to give estimates of the pixel
              locations of each component.}
\dispt{GWID\qs 6 4 20 6 4 20 \CR}{to give estimates of component sizes
              in pixels.  In this case, each component has a FWHM of 6
              by 4 pixels with the major axis at position angle 20
              degrees.}
\dispt{DOWID\qs FALSE \CR}{to hold all of the widths constant (if
              required).}
\dispt{STVERS\qs 0 \CR}{to have the results places in a new ``stars''
              extension file for later plotting.}
\dispt{INP \CR}{to review inputs.}
\dispt{GO \CR}{to run the task.}
\pd
\iodx{fitting}\iodx{modeling}

     To improve accuracy, include as small an area as possible in the
fit. In some cases, it is useful to hold some of the parameters
constant, particularly when fitting a complex clump of emission with
several components.  The parameters can interact.  Error estimates are
given for each component based on the image rms in the image header or
determined by robust means over the full input image plane.  {\tt
IMFIT} will sometimes fail to converge in complicated regions.  When
this happens, you might try using the task {\tt \tndx{JMFIT}}, which
is very similar in function, but uses a different mathematical method
to minimize the rms.  Comparison of the results of {\tt IMFIT} and
{\tt JMFIT} will sometimes be instructive.  The tasks will correct the
results for the effects of the primary beam and bandwidth smearing if
you wish.  These tasks return adverbs {\tt FMAX}, {\tt FPOS}, and {\tt
FWIDTH} with the answers to the fit, {\tt DOMAX}, {\tt DOPOS}, and
{\tt DOWIDTH} with the uncertainties in the fits, and {\tt FSHIFT}
with the shift needed to place the first component  directly on a
pixel.  It is wise to treat the results of {\tt MAXFIT}, {\tt IMFIT}
and {\tt JMFIT} with caution.  The estimates of the errors, in
particular, are based on theory and on trials of deconvolution over a
range of widths.

     The verb {\tt MFITSET} may be used to set many of the input adverbs
for {\tt IMFIT} and {\tt JMFIT} from the image displayed on the TV.  The
verb sets the image name adverbs, then directs you to set the fitting
window (like {\tt TVWINDOW}), and then to point at the peak of Gaussian
component 1 (sets {\tt GMAX($i$)} and {\tt GPOS(*,$i$)}), then its major
axis half-power point (sets {\tt GWIDTH(1,$i$)} and {\tt
GWIDTH(3,$i$)}), then its minor axis half-power point (sets {\tt
GWIDTH(2,$i$)}).  Push buttons {\tt A}, {\tt B}, or {\tt C} to set each
of these points or push button {\tt D} to stop the process and set {\tt
NGAUSS}\@.  Instructions will appear on your terminal.

     Alternatively, use {\us RUN INPFIT \CR} (see \Sec{RUNfile}) to
obtain a procedure which will help to supply input parameters to {\tt
IMFIT}\@.  This {\tt RUN} file loads a procedure called
{\tt \tndx{INPFIT}} into \hbox{{\tt AIPS}}. To invoke it, load the image
which you want to fit onto the TV with {\tt \tndx{TVALL}} and type {\us
INPFIT ( 3 ) \CR} to specify three components.  The procedure will
prompt you to set the desired sub-image window with the TV cursor (it
uses verb {\tt \tndx{TVWINDOW}}) and then to point the TV cursor at the
peaks of each of the Gaussians, click the left mouse button when the
cursor is correctly placed, and push button A, B, C, or D\@.  The inputs
{\tt GMAX}, {\tt GPOS}, {\tt BLC}, and {\tt TRC} are set in this way.

\Subsections{Source recognition and fitting (\/{\tt SAD}, {\tt TVSAD})}{sad}

The task {\tt \tndx{SAD}} (\Sec{sdmodel}) attempts to find all sources
in a sub-image whose peaks are brighter than a given level.  It
searches the sub-image specified by {\tt BLC} and {\tt TRC} for all
points above this level and merges such points in contiguous
``islands.''  For each island, initial estimates of the strength,
size, and number of components are generated.  Then the fitting
algorithm used in {\tt JMFIT} is called to determine the least square
\indx{Gaussian} fit. Solutions which fail to meet certain criteria can
be retried as two components and, if they still fail, rejected.  {\tt
SAD} is a task with many adverbs, a full description of which would be
beyond the scope of this \Cookbook.  Enter {\us EXPLAIN\qs SAD \CR}
for a full description of this task and its parameters.  The effects
of bandwidth smearing and the primary beam may be corrected.  {\tt
SAD} produces a Model-Fit extension file which may be converted to a
stars file (\Sec{plotimag}) with {\tt \tndx{MF2ST}}\@.  The {\tt MF}
file may be printed with {\tt \tndx{MFPRT}} in formats suitable for
{\tt STARS} and in formats which may be used, with task {\tt
\tndx{BOXES}}, to prepare Clean boxes for input to the imaging
tasks.  {\tt SAD} can now directly attach a ``stars'' extension file
to the input image containing the fit Gaussians.  Plot tasks can then
overlay them on images.\iodx{fitting}\iodx{modeling}

A version of {\tt SAD} called {\tt \Tndx{TVSAD}} has been written along
with an \AIPS\ Memo\footnote{Greisen, E. W. 2014, ``TVSAD: interactive
search and destroy'' AIPS Memo 119, {\tt
https://www.aips.nrao.edu/aipsdoc.html}} was written describing its use
in detail.  Like {\tt SAD} it finds source islands and makes an initial
guess.  At this point it displays an interpolated image of the area
surrounding the island and marks it with the island boundary and the
initial guesses (plotted as ellipses at the half-power point).  You
may choose from a TV menu to enhance the display, to change the island
boundary, to change one of the initial guesses, to change the number
of Gaussians guessed and set their values (like verb {\tt MFITSET}),
to have the fit attempted, or to reject this island and go on to the
next.  After the fit, a residual image is displayed with the island
boundary and fit Gaussians marked.  At this stage you may accept the
fit, go back to the previous menu to try again, or reject this island
and go on the next island.  You may turn off the TV interaction and
have the task run automatically.  It will turn the TV interaction back
on if it finds a fit that does not meet the acceptance criteria.
Finally, {\tt TVSAD} writes out the residual image, printer displays,
and extension files exactly like {\tt SAD}\@.

\Subsections{Gaussian fits to slices (\/{\tt SLFIT})}{slfit}

     You can generate a one-dimensional slice (profile) through any
plane (characterized by the first two coordinates) of an image file
using the \AIPS\ task {\tt \tndx{SLICE}}\@. The output file is appended
to the image file as an {\tt SL} extension file. Slices are computed
along lines in the two-dimensional image joining any valid pair of
points selected by {\tt BLC} and \hbox{{\tt TRC}}.  A slice along the
third axis, at a single pixel (not necessarily integers) in the
first two axes, may also be prepared.  Slices directly along any
single axis may be saved without interpolation if desired.  If the
slice is directly along an {\tt FQID} axis, {\tt SLICE} will output a
slice which is linearly sampled in frequency.  Tasks {\tt
\tndx{ISPEC}}, {\tt \tndx{BLSUM}}, and {\tt \tndx{TVSPC}} may also
save slice extension files.  These are somewhat different in that they
can represent a sum over an area in the sky as a function of
frequency.  Nonetheless, the slice file display and fitting software
is of considerable use with these as well.  The set of software
dealing with slice file analysis and display can be obtained on your
terminal by typing {\us ABOUT ONED \hbox{\CR}}.  The list is also
given in \Rchap{list}.

     To generate a slice:
\dispt{TASK\qs 'SLICE' ; INP \CR}{to review the inputs to \hbox{{\tt
              SLICE}}.}
\dispe{Use {\tt INDISK} and {\tt GETNAME} to select the input image.
The beginning ({\tt BLC}) and ending ({\tt TRC}) points for the slice
can be specified conveniently using the TV cursor if the image to be
sliced is first displayed on the TV with {\tt \tndx{TVLOD}} or {\tt
\tndx{TVALL}}.  To set these points with the TV, type:}
\dispt{\tndx{SETSLICE} \CR}{ }
\dispe{then set the TV cursor to the desired beginning point for the
slice, press the left mouse button, and repeat for the ending point
for the slice.  Note that, for slices, {\tt BLC} need not be below or
to the left of {\tt TRC}\@.  Finally:}
\dispt{GO \CR}{to generate the slice file.}
\dispe{Slice files may be output as ASCII text files using the
{\tt OUTTEXT} adverb.  They contain detailed pixel and coordinate
information as well as the interpolated slice values.  They may also be
printed later by {\tt \Tndx{SLPRT}} including any one of the models fit
to it.  Slice files are archived in your disk catalog as {\tt SL}
extensions to the image file from which they were derived.  Running {\tt
SLICE} again with new parameters does not overwrite the slice file, but
makes another with a higher ``version'' number.  To review and/or delete
slice files, follow the instructions for {\tt \tndx{EXTLIST}} and {\tt
\tndx{EXTDEST}} of plot files in \Sec{plot} above, but use {\us
INEXT\qs 'SL' \CR} in place of {\us INEXT\qs 'PL' \CR}\@.}

     When {\tt SLICE} has terminated, the file may be plotted in the
TV display on your workstation using:
\dispt{INP\qs TVSLICE \CR}{to review the inputs to verb {\tt
           \tndx{TVSLICE}}.}
\dispt{INEXT\qs 'SL' ; EXTL \CR}{to find the intensity range and number
            of points in the interpolated slice.}
\dispe{The default scales will plot all slice points on a vertical
scale from the slice minimum to the slice maximum.  You can alter the
part of the slice that is plotted and the vertical scale by
specifying, for example:}
\dispt{BDROP\qs 100 ; EDROP\qs 225 \CR}{to drop 100 points from the
              beginning and 225 points from the end of the plotted
              portion of the slice.}
\dispt{PIXRANGE\qs -0.001\qs 0.004 \CR}{to set the range of the vertical
              axis to be $-1$ to 4 mJy/beam.}
\dispt{TVSLICE \CR}{to plot the slice in the TV window.}
\dispe{Note: several slices may be put on one TV plot.  Use
{\us TVASLICE \CR} for the additional ones.  Multiple colors may be
achieved by using different graphics channels ({\tt GRCHAN})\@.}

     Slice files may be converted into plot files by:
\dispt{GO\qs \tndx{SL2PL} \CR}{ }
\dispe{The resulting plot files may then be output by:}
\dispt{GO\qs LWPLA \CR}{to display the plot file on a PostScript
              printer.}
\dispt{GO\qs TKPL \CR}{to display the plot file in the Tek window.}
\dispt{GO\qs TVPL \CR}{to display the plot file on a TV graphics
              plane.}
\pd

     The task {\tt \tndx{SLFIT}} fits \indx{Gaussian} components to
one-dimensional data in slice files.  Assuming that the usual
{\tt GETNAME} step has been done, a typical session would go like:
\dispt{INEXT\qs 'SL'; EXTL \CR}{to list the parameters of the slice
             files.}
\dispt{INVERS\qs{\it m\/} \CR}{to select the $m^{\uth}$ file for
             analysis.}
\dispt{\tndx{TVSLICE} \CR}{to plot the slice in the TV window.}
\dispt{EDROP\qs840 ; BDROP\qs 700 \CR}{to select a subsection to fit.}
\dispt{TVSLICE \CR}{to re-plot just the subsection.}
\dispt{ORDER\qs 1 \CR}{to fit a linear baseline, no baseline up to
             quadratic are allowed.}
\dispt{NGAUSS\qs 2 \CR}{to fit 2 Gaussians.}
\dispt{\tndx{TVSET} \CR}{ }
\dispe{This verb will prompt you to {\tt POSITION CURSOR AT CENTER
\char'046\ HEIGHT OF GAUSSIAN COMP 1}. Move the cursor to the
requested position and hit any button.  Then you are asked to {\tt
POSITION CURSOR AT HALFWIDTH OF GAUSSIAN COMP 1}.  Move the cursor to
the half-intensity point of the component and click any button.
Continue until all components have been entered.  (Note: these
operations are also available on the Tek device with verbs beginning
with {\tt TK}\@.  We recommend the TV versions since cursor reading in
X-Windows emulations of Tek devices appears to be unreliable.)  Then
type:}
\dispt{TVAGUESS \CR}{to plot the guess on top of the slice plot.}
\dispe{If everything looks ok, then:}
\dispt{GO\qs SLFIT \CR}{to run the task.}
\pd\iodx{fitting}\iodx{modeling}

     When the task gets an answer, the solution will be displayed as
\AIPS\ messages, recorded in the message file, and recorded in
the slice file itself.  To get a hard copy of the results:
\dispt{PRTASK\qs 'SLFIT' ; PRTMSG \CR}{to print the message file.}
\dispe{and, to display the results in the TV window, enter:}
\dispt{TVSLICE \CR}{to re-plot the slice.}
\dispt{TVAMODEL \CR}{to add the model results to the plot.}
\dispt{TVACOMPS \CR}{to add the individual components of the model
               to the plot.}
\dispt{TVARESID \CR}{to add the residuals (data -- model)
               to the plot.}
\dispe{The TV plot may be easier to examine if you use different {\tt
GRCHAN} for the different types of plot.  To get a higher quality plot
of the results, an example of which is shown in \Sec{plotcntr}, type:}
\dispt{DORES\qs TRUE ; DOMOD\qs 3 \CR}{to request the residuals, the
               model, and the model components.}
\dispt{DOSLICE\qs FALSE \CR}{to leave the slice data out of the
               plot.}
\dispt{TASK\qs '\tndx{SL2PL}' ; GO ; WAIT \CR}{to make a plot file and
               wait for it to be complete.}
\pd

\Subsections{Spectral parameter fitting (\/{\tt TVSPC}, {\tt XGAUS}, {\tt ZEMAN}, {\tt AGAUS}, {\tt ZAMAN}, {\tt RMFIT}, {\tt FARS})}{fars}

     Task {\tt \Tndx{TVSPC}} assists users in getting to know their data
cubes.  It uses a 2-dimensional image plane of some parameter that is
useful in visualizing the full field.  A moment-zero image is one
obvious choice.  The user selects a pixel on this image using the TV
display and a spectrum at that coordinate is displayed.  The task is
highly interactive allowing a quick choice of an interesting pixel.  The
spectrum, or a portion of the spectrum, at that point may be fit by up
to 4 Gaussians plus baseline and may be saved as a {\tt SL}ice file.
The corresponding spectrum from a second transposed cube may also be
displayed, allowing for example the I and V or the Q and U polarizations
to be displayed simultaneously.  Optionally, a third spectral cube may
be displayed with the spectral plane selected interactively from the
spectral plots.  See the associated \AIPS\ Memo\footnote{Greisen,
E. W. 2025, ``Exploring Image Cubes in \AIPS,'' AIPS Memo 120 revised,
{\tt https://www.aips.nrao.edu/aipsdoc.html}}.  In earlier releases, use
{\tt \tndx{XPLOT}} with {\tt DOTV 1} to familiarize yourself with your
image cube.

     A task called {\tt \Tndx{TVIEW}} offers interactive TV displays of
an image cube in all 3 transpositions plus a reference image or
spectrum.  The task is similar to {\tt TVSPC} but is designed solely to
help the user become better acquainted with the data cube.  The task is
described in an \AIPS\ Memo\footnote{Greisen, E. W. 2025, ``Further
Exploration of Image Cubes in \AIPS,'' AIPS Memo 124 revised,\\   {\tt
https://www.aips.nrao.edu/aipsdoc.html}}.

     {\tt \tndx{XGAUS}} is an interactive task which can fit up to
32 Gaussians and a linear baseline to each row of an image.  In
{\tt 31DEC13}, it was redesigned so that it begins by setting up a
table with a row for each pixel on the second and thirs axes of the
cube.  It populates the table with the peak image intensities and fit
results, so that it may be re-started multiple times with the same
table, and so that it provides multiple means to edit the results before
it finally writes its results as a set of $n-1$ dimensional image files.
Although {\tt XGAUS} was designed for use primarily on transposed
spectral-line cubes (see \Sec{linetrans}), it has a wide variety of
other applications.  The interaction is optional and uses the TV window
on your workstation.  The data, initial guess, model fit (total and
components), and the residual for each row may be plotted on the TV
screen.  If the number of Gaussians being fit is larger than one, you
may choose for each row to enter a revised initial guess using the
cursor in the TV window.  This process is similar to that of {\tt
TVSET} described above (\Sec{slfit}).    If things go well, you may
turn off the interactive model setting; the task will turn it back on
if there is a bad fit at some pixel.  After all selected pixels have
been fit, the task enters an image and edit mode.  Images are computed
for the residual rms and for all Gaussian parameters and their
uncertainties.  A menu is shown offering displays of the images and
several methods to revisit the solutions for selected pixels.  This
includes swapping the solutions between components and re-doing a list
of individual pixels or all pixels for which the solutions or
uncertainties exceed specified ranges.  When you are satisfied with the
result, you may instruct the task to write out images of the residual
rms and the Gaussian parameters and their uncertainties.  The use of
{\tt XGAUS} as well as {\tt ZEMAN}, {\tt RMFIT}, and the plotting and
modeling tasks (below) is discussed in detail in \AIPS\ Memo
118.\footnote{Greisen, E. W. 2025, ``Modeling Spectral Cubes in \AIPS,''
AIPS Memo 118 revised, {\tt https://www.aips.nrao.edu/aipsdoc.html}}
See the memo for recent (2025) changes.

     Task {\tt \tndx{ZEMAN}} was written to fit for Zeeman splitting.
The basic function fit to the V Stokes spectrum is a constant times the
total intensity plus another constant times the derivative of the total
intensity with frequency.  The task is similar to {\tt XGAUS} in that it
first sets up a table of image intensities and fit results, then fits
all pixels above specified intensities, and then offers the image
display and edit modes.  Unlike previous Zeeman programs (in other
packages), {\tt ZEMAN} also offers the option to use the results of {\tt
XGAUS} on the total intensity cube to fit the V Stokes parameter with a
constant times the total intensity plus a separate constant for the
derivative of each Gaussian component with frequency.  This allows for
multiple magnetic fields at the same pixel, each corresponding to a
separate Gaussian spectral component.

     Tasks {\tt \tndx{AGAUS}} and {\tt \tndx{ZAMAN}} have appeared to
perform the same functions but on absorption-line spectral cubes.  The
fit is done to the observations, but the parameter that is Gaussian is
the optical depth.  These tasks and the essential mathematics are
described in \AIPS\ Memo 122\footnote{Greisen, E. W. 2025, ``Modeling
Absorption-line Cubes in \AIPS,'' AIPS Memo 122 revised,\\ {\tt
https://www.aips.nrao.edu/aipsdoc.html}} which was updated in 2025.

     Task {\tt \Tndx{XG2PL}} plots the solution for individual spectra
from {\tt XGAUS}\@.  The corresponding {\tt ZEMAN} fit may also be
plotted in a separate panel.  Absorption line and optical depth models
may also be plotted.  Task {\tt \Tndx{XG2XG}} will copy an existing {\tt
XG} or {\tt ZE} table to a new one with a different upper limit to the
number of Gaussians.

     Polarization spectra are often fit for rotation measure.  The
old task {\tt \tndx{RM}} reads a transposed cube of the polarization
angle made with multiple {\tt COMB}s, then {\tt FQUBE} or {\tt MCUBE}
followed by {\tt TRANS}.  It fits the rotation measure and the
intrinsic magnetic field direction using one of two possible methods
to resolve lobe ambiguities.

     The task {\tt \Tndx{FARS}} reads two similar cubes of Q and U
polarization images and performs a ``\Indx{rotation-measure
synthesis}.''  The output of {\tt FARS} is an image cube of the real
part and another image cube of the imaginary part of the Fourier
transform on the $\lambda^2$ axis, with or without one-dimensional
Cleaning.  Slice files of the complex RM transfer function (``dirty
beam'') are also written.  Task {\tt \Tndx{AFARS}} reads these cubes
to produce images of the maximum rotation measure and of the amplitude
or phase at the maximum.  Task {\tt \Tndx{RFARS}} applies the rotation
measure image to the {\tt FARS} input cubes to produce de-rotated
cubes of Q and U.  These may be {\tt \tndx{SQASH}}'ed to make an image
of the average un-rotated polarization.  The {\tt RUN} file/procedure
{\tt \Tndx{DOFARS}} assists with the whole process, doing matrix
transpositions, finding channel weights, running FARS, transposing the
outputs, and cleaning up.

     Rotation-measure synthesis remains an experimental procedure at
present.  To test the handling of spectra in Q and U, the task {\tt
\Tndx{TARS}} was written.  It reads a text file giving the spectrum of
Q and U at some single coordinate and performs the RM synthesis using
methods from {\tt FARS} plus an additional experimental form of
complex Clean.  Up to 20 model components may be added to the Q/U
spectral data at specified rotation measure, amplitude, and phase.
Task {\tt \Tndx{QUXTR}} was written to extract a spectrum from and
pair of Q and U polarization cubes for input to {\tt TARS}\@.  The
text-file output of {\tt TARS} may then be plotted with {\tt TARPL},
which allows multiple RM spectra from the same {\tt TARS} output file
to plotted on top of each other.  In {\tt 31DEC20}, new task
{\tt \Tndx{MTARS}} prepares model Q/U spectra with up to 9999 model
components and {\tt \Tndx{FTARS}} performs an interactive fitting
of the input to {\tt TARS} using the {\tt TARS} output as a guide.
This is {\tt RMFIT} (see below) for a single spectrum.  {\tt TARPL}
can now also lot the input to {\tt TARS}\@.

     It has been found that rotation-measure synthesis is severely
limited in its ability to separate multiple RM components.  Therefore,
another {\tt XGAUS}-like task called {\tt RMFIT} was written.  It uses
the {\tt FARS} rotation-measure output cubes to provide initial
guesses for fits to the Q and U polarization spectral cubes.  Like
{\tt XGAUS}, it first builds a table of image intensities to hold the
fit results and then displays the FARS spectrum at each pixel to take
an initial guess with which to fit the Q and U spectra.  They are
displayed and, if the fit is accepted, the task goes on to the next
pixel.  {\tt RMFIT} is restartable and has the same sort of image/edit
stage in which images are displayed and the fits may be revisited by
means similar to those in {\tt XGAUS}\@.  An option to fit a spectral
index in Q and U is offered, but, in general, the input cubes should
have been corrected by the total intensity spectral index and the
channel-dependent primary beam before being used in {\tt RMFIT}\@.  An
additional spectral index in Q and U may then indicate ``thick''
rotation measure screens rather than a true source spectral index.
Other models of thickness may be fit instead.  The task may be
re-started repeatedly and output images written only when desired.
Despite rather simple fitting methods, {\tt RMFIT} has shown the ability
to separate closely spaced components not separable by rotation measure
synthesis.  Task {\tt \Tndx{RM2PL}} makes plot files from the solutions
for individual Q/U or Polarization/angle spectra.

%\vfill\eject
\sects{Image analysis}

     Image \Indx{analysis} is a very broad subject covering
essentially all that \AIPS\ does or would like to do plus specialized
programs designed to analyze a user's particular image in the light of
his favorite astrophysical theories.  \AIPS\ provides some general
programs to perform geometric conversions, image filtering or
enhancement, and model fitting and subtraction.  These are the
subjects of the following sections. Specialized programs for
spectral-line, VLBI, and single-dish data reduction are described in
\Rchap{line}, \Rchap{vlbi}, and \Rchap{sd}, respectively.  Chapter~11
of {\it \jndx{Synthesis Imaging in Radio Astronomy}\/}\footnote{{\it
Synthesis Imaging in Radio Astronomy\/}, A collection of Lectures from
the Third NRAO Synthesis Imaging Summer School, eds. R. A. Perley, F.
R. Schwab and A. H. Bridle, Astronomical Society of the Pacific
Conference Series Volume~6 (1989)} covers the topic of image analysis
in more detail.

\Subsections{Geometric conversions}{analgeom}

     The units of the geometry of an image are described in its header
by the coordinate reference values, reference pixels, axis increments,
axis dimensions, and axis types.  The types of coordinates (celestial,
galactic, etc.) and the type of tangent-plane projection (SIN from the
VLA, TAN from optical telescopes, ARC from Schmidt telescopes, NCP
from the WSRT) are specified in the \AIPS\ headers by character
strings.  See \Sec{coordinates} and \AIPS\ Memo No.~27 for details of
these projections.  A ``geometric conversion'' is an alteration of one
or more of these geometry parameters while maintaining the correctness
of both the header and the image data.  The \AIPS\ tasks which do this
interpolate the data from the pixel positions in the input image to
the desired pixel positions in the output image.
\Iodx{geometric transformation}

     The simplest geometric conversion is a re-gridding of the data
with new axis increments and dimensions with no change in the type of
projection or coordinates.  The task {\tt \tndx{LGEOM}} performs this
basic function and also allows rotation of the image.  One use of
this task is to obtain smoother displays by re-gridding a sub-image onto
a finer grid.  To rotate and blow up the inner portion of a $512^2$
image, enter:
\dispt{TASK\qs 'LGEOM' ; INP \CR}{to review the inputs.}
\dispt{INDISK\qs {\it n\/} ; GETN\qs {\it ctn\/} \CR}{to select the
               image.}
\dispt{BLC\qs 150 ; TRC\qs 350 \CR}{to select only the inner portion
               of the image area.}
\dispt{IMSIZE\qs 800 \CR}{to get an $800^2$ output image.  This will
               allow the sub-image to be blown up by a factor of 3 and
               rotated without having the corners ``falling'' off the
               edges of the output image.}
\dispt{APARM\qs 0 \CR}{to reset all parameters to defaults.}
\dispt{APARM(3) = 30 \CR}{to rotate the image $30^{\circ}$
               counterclockwise (East from North usually).}
\dispt{APARM(4) = 3 \CR}{to blow up the scale (axis increments) by a
               factor of 3.}
\dispt{APARM(6) = 1 \CR}{to use cubic polynomial interpolation.}
\dispt{INP \CR}{to check the inputs.}
\dispt{GO \CR}{to run the program.}
\dispe{{\tt LGEOM} allows shifts of the image center, an additional
scaling of the {\it y\/} axis relative to the {\it x\/} axis, and
polynomial interpolations of up to $7^{\uth}$ order.  {\tt
\tndx{OGEOM}} is similar to {\tt LGEOM}, but handles blanked pixels
in a manner that does not increase the blanked area.}

     A much more general \Indx{geometric transformation} is performed
by {\tt \tndx{OHGEO}} and  {\tt \tndx{HGEOM}}, which convert one image
into the geometry of a second image.  The type of projection, the axis
increments, the rotation, and the coordinate reference values and
locations of one image are converted to those of a second image. One
of these tasks should be used before comparing images (with {\tt
COMB}, {\tt KNTR}, {\tt PCNTR}, {\tt BLANK}, {\tt TVBLINK}, etc.) made
with different geometries, \ie\ radio and optical images in different
types of projection or VLA images taken with different phase reference
positions.  Use {\us EXPLAIN OHGEO \CR} to obtain the details and
useful advice.  {\tt \tndx{SKYVE}} re-grids images from the Digital Sky
Survey (optical DSS) into coordinates recognized by \hbox{\AIPS}.

     A  potentially very powerful transformation is performed by {\tt
\tndx{PGEOM}}. In its basic mode, it converts between rectangular and
polar coordinates. An example of this operation is illustrated in
\Rfig{analplot}.  However, {\tt PGEOM} can also ``de-project''
elliptical objects to correct for their inclination and ``unwrap''
spiral objects.  Type {\us EXPLAIN PGEOM \CR} for information.

\begin{figure}
\centering
%\resizebox{\hsize}{!}{\gname{cntr}\hspace{2cm}\gname{lgeom}}
\resizebox{\hsize}{!}{\gbb{528,537}{cntr}\hspace{2cm}\gbb{506,715}{lgeom}}
\vspace{6pt}
\hbox to \hsize{\hbox to 0.5\hsize{\hss input image\hss}\hss
        \hbox to 0.5\hsize{\hss{\tt \tndx{LGEOM}} with rotation and
        interpolation\hss}}
\vfill
%\resizebox{\hsize}{!}{\gname{pgeom}\hspace{0.3cm}\gname{ninerg}}
\resizebox{\hsize}{!}{\gbb{542,581}{pgeom}\hspace{0.3cm}\gbb{507,621}{ninerg}}
\vspace{6pt}
\hbox to \hsize{\hbox to 0.5\hsize{\hss{\tt \tndx{PGEOM}}\hss}\hss
      \hbox to 0.5\hsize{\hss{\tt \tndx{NINER}}: {\tt 'SE  '}
      derivative\hss}}
\caption{Geometric and other functions on an image.}
\label{fig:analplot}
\end{figure}

\subsections{Mathematical operations on a single image}

The task {\tt \tndx{MATHS}} allows the user to do a mathematical
operation on a single image on a pixel by pixel basis.  Currently
supported mathematical operators are: {\tt SIN}, {\tt COS}, {\tt TAN},
{\tt ASIN}, {\tt ACOS}, {\tt ATAN}, {\tt LOG}, {\tt LOGN}, {\tt ALOG},
{\tt EXP}, {\tt POLY}, {\tt POWR}, and \hbox{{\tt MOD}}.  An example
of {\tt MATHS} follows, in which the output image ({\tt OUT}) is
computed in terms of the natural logarithm of the input image ({\tt
IN}) as follows: $\tt OUT = 4 + 2\times (\log(3\times IN) - 1)$

\dispt{TASK\qs 'MATHS' ; INP \CR}{to review the required inputs.}
\dispt{INDI\qs 0 ; MCAT \CR}{to help you find the catalog number of
              the input image.}
\dispt{INDI\qs{\it n\/} ; GETN\qs {\it ctn\/} \CR}{to specify the
              image, on disk {\it n\/} catalog slot {\it ctn\/} as the
              input.}
\dispt{OUTN\qs '{\it xxxxx\/}' \CR}{to choose {\it xxxxx\/} as the
              name for the output image.}
\dispt{OUTC\qs '{\it ccc\/}' \CR}{to choose {\it ccc\/} as the class
              for the output image.}
\dispt{OPCODE\qs 'LOGN' \CR}{to specify the operation to be performed
              (a  natural logarithm).}
\dispt{CPARM\qs 4 , 2 , 3 , -1 \CR}{to specify the coefficients.}
\dispt{GO \CR}{to start {\tt MATHS}.}
\dispe{Undefined output pixels (in the current example, all pixels in
the input image $\leq 0$) are either blanked ({\tt CPARM(6)} $\leq 0$)
or put to zero {\tt (CPARM(6)} $> 0$). Type {\us EXPLAIN MATHS \CR}
for further information on the available operators and the meaning of
{\tt CPARM} for any particular operator.}

%\vfill\eject
\subsections{Primary beam correction}

{\tt \tndx{PBCOR}} allows correction for the attenuation due to the
shape of the primary beam. Its use is straightforward:
\dispt{TASK\qs 'PBCOR' ; INP \CR}{to review the required inputs.}
\dispt{INDI\qs 0 ; MCAT \CR}{to help you find the catalog number of
             the input image}
\dispt{INDI\qs{\it n\/} ; GETN\qs {\it ctn\/} \CR}{to select the input
             image from disk {\it n\/} catalog slot {\it ctn\/}.}
\dispt{OUTN\qs '{\it xxxxx\/}' \CR}{to specify {\it xxxxx\/} for the
             name of the output image.}
\dispt{OUTC\qs '{\it ccc\/}' \CR}{to specify {\it ccc\/} for the class
             of the output image}
\dispt{PBPARM\qs 0 \CR}{to use the VLA, EVLA, ATCA, GMRT, or MeerKAT
             beam parameters which are known for the particular
             receiver.}
\dispt{COORDIN\qs 0 \CR}{to use the pointing position from the image
             header.}
\dispt{GO \CR}{to start {\tt PBCOR}.}
\dispe{The default behavior requested above uses the position in the
header as the pointing position and uses the empirically determined
shape of the EVLA, VLA, MeerKAT, GMRT, or ATCA primary beam; {\tt PBCOR}
will scale the primary beam shape according to the frequency provided in
the image header and use the parameters associated with the particular
antenna feed.  These defaults can be overridden by specifying
particular values of {\tt COORDIN} and {\tt PBPARM}\@.  They beam
parameters are frequency dependent within each band, so {\tt PBCOR}
determines the beam value at the two tabulated frequencies nearest to
the image frequency and then interpolates.  In {\tt 31DEC21}, Gaussian
and polynomial beam patterns have been added as options specified with
{\tt OPCODE} and {\tt APARM}\@.  Beam parameters for MeerKAT and GMRT
were added to {\tt 31DEC22} and {\tt 31DEC23}, respectively, and are
known to all tasks which correct for the primary beam.}

     The task {\tt \Tndx{SPCOR}} may be used to apply corrections both
for primary beam and for spectral index.  The latter are based on images
of spectral index and spectral index curvature such as those used in
{\tt IMAGR} (\Sec{spixcor}).  Such corrections may be significant in
Faraday-rotation synthesis (\Sec{spixr}, \Sec{fars}).

     An image of the primary beam may be generated with the task {\tt
\tndx{PATGN}} using {\us OPCODE\qs 'BEAM' \CR} with other adverbs to
give the antenna type, frequency, cell size, image size, and,
optionally, the parameters of the beam shape.

%\vfill\eject
\Subsections{Changing the resolution of an image}{ccres}

{\tt \Tndx{CCRES}} allows you to change the resolution of a Cleaned
image by removing any Clean components in the image and then restoring
Clean components with your choice of resolution.  The task may also
be used to remove Clean components to create a residual image or to
restore Clean components to an existing residual image.  {\tt CCRES}
allows you to smooth or hyper-resolve your image.  Unlike {\tt RSTOR},
{\tt CCRES} re-scales the residual image to put it into units of
Jy/beam for the new beam.  This may be a superior way to image with a
beam that does not replicate the central portion of the dirty beam.
{\tt IMAGR} leaves the residual image in units of Jy per dirty beam
while restoring the Clean components in units of Jy per the Clean beam
given in the header.

Note that {\tt CCRES} only changes the Clean components, not the
residual image resolution.  Furthermore, {\tt CCRES} does not take
into account the varying resolutions of the many planes in an image
cube.  {\tt \tndx{CONVL}} on the other hand, with {\tt OPCODE 'GAUS'},
will convolve both the Clean components and the residual to the
requested resolution, taking into account the change in input
resolution as a function of frequency.

%\vfill\eject
\subsections{Filtering}

     For our purposes here, we can define ``\indx{filtering}'' as
applying an operator to an image in order to enhance some aspects of
the image.  The operators can be linear or nonlinear and do, in
general, destroy some of the information content of the output image.
As a result, users should be cautious about summing fluxes or fitting
models in filtered images.  (Technically, these remarks can also be
made about Clean and self-calibration.)  However, filtered images may
bring out important aspects of the data and often make excellent, if
unfamiliar-looking, displays of particular aspects.\iodx{analysis}

     {\tt \tndx{NINER}} produces an image by applying an operator to
each cell of an image and its 8 nearest cells.  The task offers three
nonlinear operators which enhance edges (regions of high gradient in
any direction). It also offers linear convolutions with a $3\times3$
kernel which can be provided by the user or chosen from a variety of
built-in kernels.  Among the latter are kernels to enhance point
sources and kernels to measure gradients in any of 8 directions.  The
{\tt 'SOBL'} edge-enhancement filter can bring out jets, wisps, and
points in the data, while the gradient convolutions produce images
which resemble a landscape viewed from above with illumination at some
glancing angle (as when viewing the Moon).  Both are very effective
when displayed on the TV or by the {\tt KNTR} / {\tt LWPLA}
combination (see \Rfig{analplot}).  Enter {\us EXPLAIN NINER \CR} for
additional information.

     {\tt MWFLT}, at present, applies any one of six non-linear,
low-pass filters to the input image.  Each filter is applied in a
user-specified window surrounding each input pixel.  One of the
operators is a ``normalization'' filter designed to reduce the dynamic
range required for the image while bringing out weaker features.  Two
of the operators are a ``min'' and ``max'' within the window.  When
applied in succession, they produce a useful low-pass filtered image
(Rudnick, L. 2002, PASP, 114, 427).  Other operators produce, at each
pixel, the weighted sum of the input and the median, the
``alpha-trimmed'' mean, or the alpha-trimmed mode of the data in the
window surrounding the pixel.  These filters can be turned into
high-pass filters by subtracting the output of {\tt \tndx{MWFLT}} from
the input with \hbox{{\tt COMB}}. Type {\us EXPLAIN MWFLT \CR} for
further information.

     Histogram equalization provides another form of non-linear
filtering.  {\tt \tndx{HISEQ}} converts the intensities of the full
input image to make an output image with a nearly flat histogram.
This magnifies small differences in the heavily occupied parts of the
histogram (usually noise) and diminishes large differences in the less
occupied parts (often real signal).  {\tt TVHLD} is an interactive
task that loads an image to the TV with histogram equalization and
then allows the intensity range and method of computing the histogram
to be modified.  It can write out at the end an equalized image in
arbitrary (non-physical) units.  {\tt \tndx{AHIST}} does an
``adaptive'' histogram equalization on each pixel using a rectangular
window centered on that pixel.  This will magnify small differences in
a more local sense, bringing out structures in smooth areas of
different brightness.  {\tt \tndx{SHADW}} generates a shadowed image
as if a landscape having elevation proportional to image value were
illuminated by the Sun at a user-controlled angle.  Although these
tasks magnify noise, they are likely to elucidate real structures in
large areas of nearly constant brightness.

\vfill\eject
\sects{Modeling in the image and uv planes}

     Special considerations for analysis and modeling of spectral-line
image cubes are discussed in \Sec{lineanal}.  Models of galaxy rotation
are fit by {\tt \tndx{GAL}} to images of the predominant velocity
(first moment images usually), while the entire data cube may be fit
by task {\tt \tndx{CUBIT}}\@.

     The addition of model data to an image or \uv\ data set is often
useful either to simplify later processing steps or to study
processing steps using a ``source'' of known structure.  For example,
the removal of the response to an appropriate uniform disk from the
\uv\ data for a planet will leave Clean the task of deconvolving only
the remaining fine-scale structure to which it is well suited.  The
removal of a few bright point sources of known position and strength
may allow imaging with significant tapers in a numerically smaller
field.  The tasks {\tt \tndx{MODIM}}, {\tt \tndx{MODSP}}, {\tt
\tndx{UVMOD}}, {\tt \tndx{MODAB}}, and {\tt \tndx{SPMOD}} will add (or
subtract) up to 9999 point, Gaussian, disk, rectangular, spherical, or
exponential sources to the (scaled) input image or \uv\ data,
respectively.  These tasks can also add noise and allow the original
data to be replaced by the model.  {\tt UVMOD} can include a spectral
index for the sources, {\tt SPMOD} includes spectral lines for the
sources, {\tt MODIM} can include both a spectral index, a rotation
measure, and even a rotation measure thickness for each component, and
{\tt MODSP} can include polarized spectral lines with spatially
varying spectral structure. Type {\us EXPLAIN MODIM ; EXPLAIN UVMOD ;
EXPLAIN SPMOD ; EXPLAIN MODAB ; EXPLAIN MODSP \CR} for details or see
\AIPS\ Memos 118\footnote{Greisen, E. W. 2025, ``Modeling Spectral
Cubes in \AIPS,'' AIPS Memo 118 revised, {\tt
https://www.aips.nrao.edu/aipsdoc.html}} and 122\footnote{Greisen, E. W.
2025, ``Modeling Absorption-line Cubes in \AIPS,'' AIPS Memo 122
revised, {\tt https://www.aips.nrao.edu/aipsdoc.html}}.  For simple
cases, the older task {\tt IMMOD} may be easier to use than {\tt
MODIM}\@.\iodx{modeling}

     The task {\tt \tndx{CCMOD}} will create a clean-components file
representing a Gaussian, disk, or Gaussian times disk model.  Clean may
then be ``restarted'' with the model as its initial set of components.

The task {\tt \tndx{UVFIT}} may be useful for fitting \indx{Gaussian}
or uniform-sphere models to \uv\ data sets with a maximum of 2.5
million visibilities.  Up to 60 source components may be fit along
with up to 30 antenna gains.  Provision for getting initial guesses
for the specified spectral channel from a text file with guesses for
many channels is now available as is a compact text file output option
for the solutions.  Task {\tt OMFIT} is a more complicated and
difficult to use task which fits source components in a $uv$ data set
along with antennas gains.  It allows multiple different model types
and even a full self-calibration.  The results from {\tt OMFIT} are
often well worth the extra effort to obtain them.

\AIPS\ contains tasks which create simulated data.  {\tt PATGN} will
make images of various patterns.  {\tt \Tndx{DTSIM}} generates $uv$
data following instructions given primarily in a KEYIN-format text
file.  You may specify the antennas in detail or as the VLBA or VLA\@.
Source parameters and models, frequency values and structure, data
calibration errors of numerous types, scan structure and sequence, and
more may be specified.  {\tt \Tndx{UVCON}} also generates $uv$ data
from ``scratch'' using text files of antenna data and Tsys and
efficiency data as well as images of a source model.  The two tasks
differ in their approach, making both of considerable interest.

\subsections{Analysis in the uv plane}

Several tasks now perform some analysis on $uv$ data.   The other new
task, {\tt \tndx{ELFIT}}, fits polynomials to table data as functions of
elevation, zenith angle, hour angle, parallactic angle, or azimuth.  It
has been used, for example, to measure antenna spillover, plotting Psys
versus zenith angle.

{\tt DFTIM} is similar to the plot task {\tt DFTPL} in that it Fourier
transforms visibility data to a particular image pixel (celestial
coordinate).  {\tt DFTPL} makes a plot versus time for a single group of
frequencies.  It can do various Stokes including polarization amplitude
and position angle.  {\tt \tndx{DFTIM}} instead writes out an image at
that coordinate with frequency and time as the axes.  The frequencies
and times in this ``waterfall'' image may be averaged as the image is
created.  {\tt \Tndx{ACIMG}} makes a similar waterfall plot for
autocorrelation data, with the third axis being antenna number.  These
tasks can now display and image other parameters in addition to the
correctly computed DFT\@.  New task {\tt(\tndx{DFTQU}} computes a
3-color image with Stokes Q and U as the two axes with color set by
the time.

Statistical analysis of visibility data is performed by several tasks.
{\tt \Tndx{UVRMS}} averages the selected data in {\tt SOLINT} time
intervals and then can plot the average values as a function of time and
as a histogram.  A variety of statistical parameters are computed and
printed.  {\tt \Tndx{SPRMS}} determines and plots the mean and standard
deviation of the selected data as a function of spectral channel.  Note
that both tasks will combine data from multiple sources, baselines,
etc.~if so instructed.  {\tt \Tndx{RIRMS}} computes statistics over the
included visibility data and then prints a matrix over baselines of the
real and imaginary parts separately.  Histogram plots and plots over
time may be generated.  In {\tt 31DEC21}, task {\tt \tndx{VBRFI}}
computes statistics for a data set consisting only of auto-correlation
records.  It writes out a text file containing the results and can make
plots.  {\tt \tndx{PLRFI}} can make plots from one or more of these text
files.

\sects{Additional recipes}

% chapter *************************************************
\recipe{Golden mousse}

\bre
\Item {Combine 1 cup mashed ripe {\bf bananas}, 2
     tablespoons {\bf orange juice}, 1/4 cup shredded {\bf coconut}, 3
     tablespoons {\bf brown sugar}, a few grains {\bf salt}, and 1/8
     teaspoon grated {\bf orange rind}.}
\Item {Whip until stiff 1 cup {\bf heavy cream}.}
\Item {Fold whipped cream into fruit mixture and turn into
     freezing tray.  Freeze rapidly without stirring until firm.}
\ere

% chapter *************************************************
\recipe{Coriander banana nut bread}

\bre
\Item {Blend together in a large bowl $1 {2\over3}$ cups sifted
     all-purpose {\bf flour}, 3/4 cup {\bf sugar}, 1 tablespoon {\bf
     baking powder}, 1/2 teaspoon {\bf baking soda}, 1/2 teaspoon {\bf
     salt}, 2 teaspoons ground {\bf coriander}.}
\Item {Mix in $1$ cup chopped unblanched {\bf almonds} and set
     aside.}
\Item {Melt 1/3 cup {\bf shortening} and set aside to cool.}
\Item {Mix until well blended 1 large well-beaten {\bf egg}, 1/4
     cup {\bf buttermilk}, and 1 teaspoon {\bf vanilla extract}.}
\Item {Blend in $1 {1\over4}$ cups mashed ripe {\bf
     bananas} and the shortening.}
\Item {Make a well in center of dry ingredients and add banana
     mixture all at one time.  Stir only enough to moisten dry
     ingredients.}
\Item {Turn into greased $9\times5\times3$-inch loaf pan and
     spread to corners.}
\Item {Bake at \dgg{350} about 1 hour or until a wooden pick comes
     out clean when inserted in center of bread.  Immediately remove
     from pan and set on rack to cool.}
\ere
