.ec _
.ll 80
.ad b
.in 4
.ti -4
1 Language
.nf
FEATHER       : Add short spacings (image feathering)
FLUX          : Compute integrated flux from Support or Mask
HOW__TO        : Getting help on hwo to perform some action
MAP__CONTINUUM : Determine the continuum image from a spectral cube
MAP__POLAR     : Derive Polarization Images from Stokes Images
MASK          : Define the MASK 
MFS           : Multi Frequency Synthesis (under development - not functional)
MOMENTS       : Compute Moments for data cubes
PROPER__MOTION : Apply proper motion information to UV data
STOKES        : Extract one Stokes parameter from multi-polarization UV table
UV__ADD        : Add some extra column to the current UV data
UV__CIRCLE     : Deproject and compute radial visibility profile 
UV__CORRELATE  : Spectral matching for UV data
UV__DEPROJECT  : Deproject UV data
UV__FIT        : Fit UV data with simple functions
UV__LINEARIZE  ! Linearize "random" frequency axis
UV__MERGE      : Merge (possibly many) UV tables
UV__MOSAIC     : Split or Build a Mosaic UV table
UV__PREVIEW    : Quick look at the spectral aspects of the UV data
UV__RADIAL     : Deproject and compute azimutal average of UV data
UV__SHORT      : Compute and add short spacings to UV data
XY__SHORT      : Compute the short spacing image from the SINGLE Dish table
.fi
 
  
 
.!======================================================================  
  
.ti -4
1 FEATHER
.ti +4
[ADVANCED_\]FEATHER [?] [/FILE Combined HIGHRes LOWres] [/REPROJECT]

  Combines a data cube containing High resolution data (HIGHres) with
one containing the short spacing data (LOWres). Automatic reprojection
and spatial resampling of the LOWres data may be done if the
option /REPROJECT is specified. 

  The method is to hybridize in the UV plane the data, retaining short
UV spacings from LOWres and long UV spacings from HIGHres. It is controlled
mainly by variable FEATHER__RADIUS, the transition radius, and 
FEATHER__EXPO, an exponent controlling the transition sharpness

Other variables allow some flux re-scaling or verification.

  FEATHER ?  will list the input parameters

.ti -4
2 /REPROJECT
.ti +4
  [ADVANCED_\]FEATHER [/FILE Combined HIGHRes LOWres] /REPROJECT
  
  Allow to automatic reproject and rescale the LOWres images to the
projection and sampling of the HIGHres one. If /REPROJECT is not
present and the HIGHres and LOWres data do not match, FEATHER will
complain and stop. 

.ti -4
2 /FILE
.ti +4  
[ADVANCED_\]FEATHER /FILE Combined HIGHRes LOWres [/REPROJECT]
  
  Takes the data from files named HIGHres and LOWres and put the
combined result in file named Combined. The default extension .lmv-sky.
  
  Without the /FILE option, FEATHER takes HIGHres from the SKY buffer,
LOWres from the Short Spacing buffer (SHORT, equal to SINGLE if it is 
a data cube, or derived by UV__SHORT if not), and put the result 
into an image variable named FEATHERED. The result can be written
as any image by WRITE FEATHERED FileName.

Note: Currently, in all cases, the images reside in memory.
A buffer mode for the /FILE option will be added later.
.ti -4 
2 Algorithm
  
  FEATHER use the following steps
.nf
- Make oversampled Fourier Transform of both HIGHres and LOWres images
- Compute the truncation function f(r)
- Make the Truncated compact Fourier Transform, f(r) x T(LOW)
- Make the complement long baseline Fourier Transform, (1-f(r)) x T(HIGH)
- Sum them T(ALL) = R x f(r) x T(LOW) + (1-f(r)) x T(HIGH)
     where R is a scale factor taken from FEATHER__RATIO
- Make the inverse Fourier Transform
- Truncate the resulting image to original size and Mask of the HIGHres
  images
.fi

If LOWres is a single-dish image, f(r) should normally be the beam
of that telescope to use optimal Signal-to-noise ratio from that data
set. However, because of pointing errors and other calibration issues
such as spectral baseline, using a sharper transition function gives
better results. FEATHER uses the function  
.nf
    f(r) = exp(-(r/Radius)^Expo)
.fi 
where Radius is taken from FEATHER__RADIUS and Expo from FEATHER__EXPO.  

.ti -4
2 Variables:
.ti +4
  FEATHER uses the folling input variables
.nf 
  FEATHER__RADIUS,    the transition radius
  FEATHER__EXPO, an exponent controlling the transition sharpness
  FEATHER__RATIO, a scale factor for the short spacing (LOWres) data.
  FEATHER__RANGE, the limits of the overlapping region (see details)
.fi

.ti -4
2 FEATHER__RADIUS
.ti +4
  Real FEATHER__RADIUS  (default 15.0)
  
  FEATHER__RADIUS is the transition radius (in meters) used to compute
the combination function f(uv) = exp(-(uv/Radius)^Expo).

.ti -4
2 FEATHER__EXPO
.ti +4
  Real FEATHER__EXPO  (default 8.0)

  FEATHER__EXPO is the exponent used to computed the
combination function f(uv) = exp(-(uv/Radius)^Expo).

.ti -4
2 FEATHER__RATIO
.ti +4
  Real FEATHER__RATIO (default 1.0)

  FEATHER__RATIO is the scale factor to be applied to the LOWres data
in the combination.

.ti -4
2 FEATHER__RANGE
.ti +4
  Real FEATHER__RANGE[2]

  FEATHER__RANGE[2] defines a region of "overlapping" UV
spacings over which the ratio of LOWres and HIGHres visibilities
can be checked. If the flux scale is correct, this ratio should be 1. 
FEATHER__RANGE defaults to FEATHER__RADIUS/1.15 and FEATHER__RADIUS*1.15.

  The computed ratio is only a guide, and not used in the algorithm.
A proper definition of FEATHER__RANGE requires knowledge of the
initial UV coverage of the HIGHres and LOWres data sets. If 
FEATHER__RANGE is too large, the computed ratio has no real meaning.

.ti -4
1 FLUX
.ti +4
[ADVANCED_\]FLUX Cursor|Mask|Support

  Compute the integrated flux from the CLEAN image, using zones
defined either by calling the Cursor, or by the current Support,
or by the current Mask.

  If the CLEAN data is a 3-D cube, the integrated flux will be
a spectrum.

  For FLUX MASK, if the Mask defines several separate zones, an
integrated flux will be computed for each zone. Zones are ordered
by decreasing number of pixels. 

  The FLUX results are available in the FLUX SIC structure, and
can be displayed by SHOW FLUX  and also SHOW COMPOSITE.

.ti -4
2 Limitations
.ti +4

FLUX MASK does not yet recognize properly Frequency dependent Masks.

.ti -4
2 Results 
.ti +4

  The FLUX results are available in the FLUX SIC structure
.nf  
FLUX%NC                       Number of channels
FLUX%FREQUENCIES[Flux%Nc]     Frequencies of the Channels
FLUX%VELOCITIES[Flux%Nc]      Velocities of the Channels
FLUX%NF                       Number of Fields (Zones)
FLUX%VALUES[Flux%Nc,Flux%Nf]  Integrated Flux for each channel and Zone
.fi

For Cursor or Support defined regions, the enclosing polygon is
also accessible:
.nf
FLUX%NXY                      Number of polygon summits
FLUX%X                        X coordinates of summits
FLUX%Y                        Y coordinates of summits
.fi  

.ti -4
1 HOW__TO
.ti +4
[ADVANCED_\]HOW__TO  solve a simple problem

  Ask IMAGER informations to help you solving your problem, expressed
in a natural way. Examples
.nf
  HOW do i subtract continuum ?
  HOW do i control the display ?
.fi  
Rules:
.nf
  - simple words ("do" "i" "?" "the", etc...) are ignored. You can just 
    type them to have a normal syntax in your question.
  - all significant words (e.g. "subtract" and "continuum") must be
    found to have a matching topic. 
  - significant words use exact matching. "continuum" is not the same as 
    "cont".
  - partial match is possible if a significant word ends up by *.  
    "cont*" will match "continuum".
  - if no topic matches all significant words, a list of partial matches
    is given to guide you. Use a simpler question with less significant
    words among those proposed.
.fi
   
   HOW__TO ? 
.br
  will list all topics
    
.ti -4
1 MAP__CONTINUUM
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] [/METHOD KEY [Parameters [...]]]

  Compute a continuum image from the Clean, Dirty or any other 3-D data set.
The derivation of the continuum follows the algorithm specified in the
/METHOD option (or the last specified in this way if the /METHOD option
is not present).

  The result is placed in the CONTINUUM buffer. 

.ti -4
2 /METHOD
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] /METHOD KEY [Parameters [...]]

  Change the algorithm used to compute the Continuum image. KEY is the name
of the selected method. Available methods are GLOBAL, GAUSS, SCM, C-SCM, and EGM.
The fastest method is GLOBAL, than GAUSS, than SCM.  

  The selected method is sticky: it will be used until further modified by the /METHOD option.

.ti -4
2 GLOBAL
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] /METHOD GLOBAL [Threshold [Nhisto]]

  Compute the integrated spectrum (over the region specified by CENTER and SIZE
variables), and delineate the line-free region by Gaussian fitting the histogram
of the spectrum intensity. 
  The optional arguments control the algorithm. Threshold is clipping level
in sigma units: values in range 2.5 - 5 are usable (default 3.5).
Nhisto is the number of histogram bins. The default is to adjust this number
depending on the number of channels in the data. This is the same algorithm 
as used in UV__CONTINUUM, or in a per pixel mode by the GAUSS method.

  The continuum is then derived by integrating in the line-free regions. This
method is fast, and gives a uniform noise since the same channels are used for all pixels.
It may be inaccurate into several ways:
.br
- Regions with strong broad line may still be contaminated by emission from the line wings
.br
- The same applies to regions with line confusion.
.br
- Continuum emission in regions with no line emission is not derived to the maximum
sensitivity. This can be an issue in case of line confusion at some positions.

  
.ti -4
2 GAUSS
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] /METHOD GAUSS [Threshold [Nhist]]

  Compute the continuum based on the per-pixel spectrum. Each spectrum is sigma-clipped
and the histogram of the intensity distribution is fitted by a Gaussian.  Corrective
techniques are applied to ensure the fit has converged.  The position of this Gaussian
gives the continuum level.  A noise estimate is also derived.

  The method does not deliver a spatially independent noise, but adapts the bandwidth
to the line free zones for each pixel. It may fail for pixels that are close to
line confusion.
  
  The optional arguments control the algorithm. Threshold is clipping level
value for the Gaussian: valuesi n range 2.5 - 4 are usable (default 3.5).
Nhist is the number of histogram bins. The default is to adjust this number
depending on the number of channels in the data.


.ti -4
2 SCM
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] /METHOD SCM [Threshold [MaxIter]]

  Compute the continuum based on the per-pixel spectrum. Each spectrum is sigma-clipped
until convergence of the noise. The method is similar to the GAUSS method, but more robust
at the expense of lower speed because of the iterative median  clipping. Threshold
is the number of sigma used for clipping. MaxIter is the maximum number of clipping
operations performed (default 6).

  The method does not deliver a spatially independent noise, but adapts the bandwidth
to the line free zones for each pixel. It may fail for pixels that are close to
line confusion, though less than the GAUSS method.

.ti -4
2 C-SCM
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] /METHOD C-SCM [Threshold [MaxIter]]

  As for the SCM method, but the continuum is noise de-biased depending on the fraction
of the bandwidth covered by emission and absorption lines. Marginally slower than
SCM.

.ti -4
2 EGM 
.ti +4
[ADVANCED_\]MAP__CONTINUUM [DIRTY|CLEAN|Other] /METHOD EGM [Threshold]

.ti +16  *** Not yet implemented ***
   
  This method is similar to the GAUSS method, but uses an exponentially modified
Gaussian to fit the intensity distribution histogram. 

.ti -4
1 MAP__POLAR
.ti +4
[ADVANCED_\]MAP__POLAR [GenericBegin [GenericEnd]] [/COMPUTE [Threshold]]
[/BACKGROUND Type Min Max] [/STEP Step Xfirst Yfirst] [/ANGLE Atype]

Derive or Display the Polarization fraction and Polarization angles images from the (I,Q,U) Stokes images. 

GenericBegin indicates the file name prefix, and GenericEnd the filename postfix, including
extension. The Stokes I (resp. Q, U) image 
is assumed to be in 'GenericName'"-I"'GenericEnd'(resp. -Q and -U)
The Polarization fraction image will be called 'GenericBegin'"-P"'GenericEnd', while the Polarization
angle image is 'GenericBegin'"-A"'GenericEnd". 

The default end is ".lmv-clean". However, when using with the Imager PIPELINE, continuum
images are in derived from the UV Table names by adding +C before the file extension, so 
GenericEnd should be "+C.lmv-clean".

.ti +4
MAP__POLAR ? 
.br
will simply display the current values of the "sticky" control parameters.

.ti -4
2 /ANGLE
.ti +4
.br
[ADVANCED_\]MAP__POLAR [GenericBegin [GenericEnd]] /ANGLE AType
[/BACKGROUND Type [Min Max]  [/STEP Step Xfirst Yfirst]

Define which type of vector orientation is displayed. Atype can be
.br 
POLAR   to give each vector the direction of the polarization
.br 
BFIELD   to give each vector the "magnetic field" direction orientation
under the assumption of "usual" alignment mechanism. POLAR and BFIELD
orientations just differ by 90 dgrees. 

Beware that the interpretation of this
difference is dependent on the actual polarization mechanism !.

The value is "sticky", and remains until a contradictory AType is given,
or a MAP__POLAR /COMPUTE command is performed.

If no argument is present, the command only sets the AType value.
If arguments are present, the display is done according to the
specified arguments and options. 


.ti -4
2 /COMPUTE 
.ti +4
[ADVANCED_\]MAP__POLAR GenericBegin [GenericEnd] [/COMPUTE [Threshold]]

Compute the Polarization Fraction image 'GenericBegin'"-P"'.Type', and the Polarization
Angle image 'GenericBegin'"-A"'GenericEnd" from the 'GenericName'"-K"'GenericEnd' images
where -K is all of the -I, -Q, and -U Stokes images.

The derivation is only made on pixels that are brighter than Threshold sigma in the Stokes I
image. The use of the /COMPUTE option reset all parameters that control further
display to their default values.


.ti -4
2 /BACKGROUND 
.ti +4 
[ADVANCED_\]MAP__POLAR GenericBegin [GenericEnd] /BACKGROUND Type [Min Max] 
[/STEP Step Xfirst Yfirst]

Show the polarization vectors derived from the Polarization Angle and Fraction maps
overlaid on a background image.

Type can be I for total intensity, F for fractional polarization in percent, or P for
the polarized intensity. Min and Max indicate the SCALE to be used for the color scaling
(through a temporary assignments of the SCALE values for SHOW command called by MAP__POLAR).

Type, Min, and Max, like Step, Xfirst, Yfirst are "sticky" (remanent): they keep the
previous value until a new one is specified, or are reset to their default values
by use of the /COMPUTE option.  Default is I for Type, 0 for Min and Max, which implies
an automatic scaling to the data range.

.ti -4
2 /STEP
.ti +4
[ADVANCED_\]MAP__POLAR GenericBegin [GenericEnd] 
[/BACKGROUND Type Min Max] /STEP Step [Xfirst Yfirst]

Specify the Step in pixels between adjacent display of polarization vectors. If not
specified, or if 0, Step is empirically derived from the angular resolution.

Xfirst and Yfirst indicate the starting pixel along the X and Y axis respectively,
allowing a controlled centering of the vector distribution on the background image.

Type, Min, and Max, like Step, Xfirst, Yfirst are "sticky" (remanent): they keep the
previous value until a new one is specified, or are reset to their default values
by use of the /COMPUTE option.  Default is 0 for Step, 1 for Xfirst and Yfirst.

.ti -4
1 MASK
.ti +4
[ADVANCED_\]MASK [Key [Arguments ...] [/FROM InputCube]

  Handle the MASK buffer, which can be used to select regions
for Cleaning (see SUPPORT /MASK) or to mask any data cube.
    
  Without argument (or with argument INTERACTIVE), an interactive tool 
is used to manipulate the mask. Valid operations are
.nf
  ADD         Add a region to the mask
  APPLY       Apply the mask to a buffer
  CHECK       Check Clean and Mask consistency
  COLLAPSE    Collapse a 3D mask into 2D
  INITIALIZE  Initialize the Mask (2D or 3D)
  INTERACTIVE Interactively define mask planes Step by Step
  LABEL       Convert the mask values to numbered regions
  OVERLAY     Overlay the Mask to the Clean image
  READ        Read the Mask from a file
  REMOVE      Remove a region from the mask
  SHOW        Show the Mask (as SHOW MASK)
  THRESHOLD   Compute an automatic mask
  USE         Use the Mask in Clean (as SUPPORT /MASK)
  WRITE       Write the Mask on file (as WRITE MASK)
.fi

.ti -4
2 /FROM
.ti +4
[ADVANCED_\]MASK THRESHOLD Arguments [...] /FROM InputCube

  Specify which data  cube (buffer or SIC variable) is to be 
used to define the Mask. The default is CLEAN or SKY, depending on 
the last one displayed by SHOW or VIEW. 

Currently the option only applies when the THRESHOLD keyword is being used.

.ti -4
2 Tricks
.ti +4
  The MASK variable is ReadOnly. Yet, the user may want to modify it
directly by himself.  The following commands
.nf 
  DEFINE ALIAS WMASK MASK /GLOBAL
  LET WMASK /STATUS WRITE
.fi
will create an alias to MASK which can be written by the user at will.
This method is actually used in the Interactive MASK tool.

.ti -4
2 ADD
.ti +4
[ADVANCED_\]MASK ADD Shape [Arguments ...]

  Add the specified Shape to the current mask.
Shape can be 
.nf
  CIRCLE      Ox Oy Diameter
  ELLIPSE     Ox Oy Major Minor Angle
  RECTANGLE   Ox Oy Major Minor Angle
  POLYGON     File
.fi
where Ox Oy are the center of the shapes,  Major and Minor
the axes length (= side lengths for the Rectangle...) and Angle
the Position Angle of the Major axis.

For the POLYGON, the  GreG polygon read from the specified File
(note that this overrides any previous definition of this polygon).

  
.ti -4
2 APPLY
.ti +4
[ADVANCED_\]MASK APPLY SicVariable

Apply the mask to the corresponding 3-D variable.

The space dimensions must coincide (pixel per pixel), but the spectral 
axes can differ. The command will select the appropriate Mask channel 
for each plane of the SicVariable.  If the Mask is 2-D only, it will be 
applied to all planes.

.ti -4
2 CHECK
.ti +4
[ADVANCED_\]MASK CHECK [SicVariable]

Check the Mask consistency against the specified SicVariable.
The default is against Clean.

.ti -4
2 INITIALIZE 
.ti +4
[ADVANCED_\]MASK INITIALIZE 2D|3D

  Initialize an empty 2-D or 3-D mask. For a 2-D mask, the 
interactive tool will use the mean image as a background
for the definition.

.ti -4
2 INTERACTIVE
.ti +4
[ADVANCED_\]MASK INTERACTIVE [Nchan]

  Enter the interactive tool, moving Nchan channels at each
  Next or Previous button. Default is 1.

.ti +4 
[ADVANCED_\]MASK 
.br
is equivalent to 
.ti +4 
[ADVANCED_\]MASK INTERACTIVE 1

.ti -4
2 LABEL
.ti +4
[ADVANCED_\]MASK LABEL

  Convert the Mask to labelled connex regions. Pixel in 
each region is given a common integer value, the region
number. Region numbers are ordered by decreasing number
of pixels. 

*** Caution: currently only works on 2-D masks. ***

For 3-D masks, the first plane is the result of collapsing
the 3-D mask on it, and then applying the labelling
process. This may change according to further needs.

.ti -4
2 OVERLAY
.ti +4
[ADVANCED_\]MASK OVERLAY

Display a SHOW-like overlay of the Mask on top of the current
image (default is Clean, normally). All SHOW parameters apply.

.ti -4
2 READ
.ti +4
[ADVANCED_\]MASK READ File.[msk]

  Read the Mask from a Gildas data-cube. 

.ti -4
2 REMOVE
.ti +4
[ADVANCED_\]MASK REMOVE Shape [Arguments ...]

  Remove the specified Shape from the current Mask.
Shape can be 
.nf
  CIRCLE      Ox Oy Diameter
  ELLIPSE     Ox Oy Major Minor Angle
  RECTANGLE   Ox Oy Major Minor Angle
  POLYGON     File
.fi
where Ox Oy are the center of the shapes,  Major and Minor
the axes length (= side lengths for the Rectangle...) and Angle
the Position Angle of the Major axis.

For the POLYGON, the  GreG polygon read from the specified File
(note that this overrides any previous definition of this polygon).

.ti -4
2 SHOW
.ti +4
[ADVANCED_\]MASK SHOW

  Similar to SHOW MASK command, but useing a spacing equal 
  to 0.5 to illustrate the boundaries.
  
.ti -4
2 THRESHOLD
.ti +4
[ADVANCED_\]MASK THRESHOLD Value Unit [GUARD Guard] [SMOOTH Smooth Length]
  [REGIONS Nregion]

Define a Mask from thresholding the CLEAN image. If the CLEAN image
is 3-D, the Mask will be 3-D.  

The method involves a first thresholding, optionally followed by a 
smoothing and a second thresholding to extend the support. The mask is 
the logical OR of the Raw and Smooth masks.

The algorithm to define the mask is controlled by 5 parameters, 4 of which
are optional and specified as values after their corresponding keyword.
The arguments
.ti +4  
Value Unit
.br 
indicate the threshold and its unit under 
which the mask is set to 0.  The unit can be %, SIGMA, NOISE,
Jy, milliJy, microJy, K, milliK, microK, or NATIVE.

Value is not just a simple number: its interpretation depends on whether
it has an explicit sigma (+ or -), in which case only values above of
below are retained, of no sign at all, in which case comparisons are
made on the absolute values.

The default is 6 sigma. The noise is
taken from the computed Clean noise (clean%gil%rms) if defined,
or from the theoretical noise (clean or dirty%gil%noise) if not.

.ti +4  
SMOOTH Smooth Length
.ti +8
Smooth 
.br 
indicates the threshold under which the Smooth Mask is set to 0 after smoothing. 
There is no default. If keyword SMOOTH is not present, there is
no smooth mask. This smoothed threshold is in the same units as the main one.
.ti +8  
Length
.br 
is the size of the smoothing gaussian to derive the smooth mask from
the initial mask (in arcsec).  If set to *, or not specified, it takes
the default which is the Clean beam major axis.

.ti +4
GUARD Guard
.ti +8 
Guard 
.br 
indicates the size of the guard band at edges where the mask is set to zero, in units
of image size. The default is 0.18, i.e. the mask can extends
a little more than the inner quarter.  This is to avoid the
edges where sidelobes aliasing occurs.

.ti +4
REGIONS Regions
.ti +8
Regions
.br
is the maximum number of separate regions retained in the mask. 
The regions are ordered by decreasing size, and only the first Regions 
ones are kept.  Default is 0, which means keep all regions.

.ti -4
2 USE
.ti +4
[ADVANCED_\]MASK USE

  Use the MASK in Clean deconvolution. 

  Equivalent to SUPPORT /MASK command.

.ti -4
2 WRITE
.ti +4
[ADVANCED_\]MASK WRITE File

  Save the Mask on a File. Default extension is .msk.

  Equivalent to WRITE MASK command.
  
.!==============================

.ti -4
1 MFS
.ti +4
[ADVANCED_\]MFS

  ** NOT OPERATIONAL -- UNDER DEVELOPMENT **

  Multi-frequency synthesis, allowing to account for spectral
index changes across the observed field of view for very wide
bandwidths continuum imaging.

.ti -4
1 MOMENTS
.ti +4
[ADVANCED_\]MOMENTS [Image|File.Ext] [/CUTS] [/MASK]
    [/METHOD Mean|Peak|Parabolic] [/RANGE Min Max TYPE]
    [/THRESHOLD Thre [Unit]]


  Compute the 4 main "moments" of a data cube. If no argument
is given, the data cube is either the SKY one (if present)
or the CLEAN one. The argument may specify a Gildas file
(when a . is present in the argument), or a SIC Image variable.

The 4 moments are stored in new SIC Image variables:
.nf
M__AREA   Integrated area over the velocity range
M__PEAK   Peak brightness value
M__VELO   Mean or peak velocity 
M__WIDTH  Weighted line width
.fi
The options control the method, the selected part of
the cube (default channels from FIRST to LAST), and the
threshold for detection (default 3 sigma).

The resulting images can be displayed using command SHOW MOMENTS
and saved using WRITE MOMENTS.
.ti -4
2 /CUTS
.ti +4
[ADVANCED_\]MOMENTS  [Image|File.Ext] [/CUTS MinArea [NRegions]]

Restrict the moment images to the region(s) where the integrated
area M__AREA is greater than MinArea.  This option is exclusive
of any other, and no argument is accepted. It uses previously
computed moments.

The optional NRegions number is the maximum number of separate
regions to be kept (default 1).

.ti -4
2 /MASK
.ti +4
[ADVANCED_\]MOMENTS  [Image|File.Ext] /MASK
  [/METHOD Mean|Peak|Parabola] [/RANGE Min Max TYPE]
  [/THRESHOLD Thre [Unit]]

Compute the 4 main moments and truncate them outside the current MASK. 

.ti -4
2 /METHOD
.ti +4
[ADVANCED_\]MOMENTS   [Image|File.Ext] /METHOD Mean|Peak|Parabola
  [/MASK] [/RANGE Min Max TYPE] [/THRESHOLD Thre [Unit]]

Specify which method to be used to compute the velocity and peak
values. The default method, MEAN, computes an intensity weighted
velocity, and takes the peak intensity at each pixel.
Method PEAK takes the velocity at the peak intensity. Method
PARABOLA makes a parabolic fit over 3 channels around the peak
intensity channel to derive the velocity, and takes the peak
value of this parabola for the peak brightness.
   
.ti -4
2 /RANGE
.ti +4
[ADVANCED_\]MOMENTS  [Image|File.Ext] /RANGE Min Max TYPE [/MASK]
      [/METHOD Mean|Peak|Parabola] [/THRESHOLD Thre [Unit]]

Specify the range of channels to be selected. TYPE can be
VELOCITY, FREQUENCY or CHANNELS.  If not present, the range
is defined by FIRST and LAST variables.

.ti -4
2 /THRESHOLD
.ti +4
[ADVANCED_\]MOMENTS  [Image|File.Ext] /THRESHOLD Thre [UNIT]
  [/MASK] [/METHOD Mean|Peak|Parabola] [/RANGE Min Max TYPE]

Specify the minimum intensity of the input data cube to 
consider a given pixel,channel as valid. Keyword UNIT can be
given  to indicate whether Thre is given in noise unit (UNIT = SIGMA)
or in data cube units if UNIT is omitted.

The default arguments of /THRESHOLD are 3 SIGMA. 

.ti -4
1 PROPER__MOTION
.ti +4
[ADVANCED_\]PROPER__MOTION muRA muDec [/FILE FileIn FileOut]

  Apply specified proper motion to current or specified UV Table.
Proper motion values are specified in milliarcsec per year (mas/a).

If no /FILE option is present, they are applied to the current UV table.

.ti -4
2 /FILE
.ti +4
[ADVANCED_\]PROPER__MOTION muRA muDec /FILE FileIn FileOut

  Apply specified proper motion to the specified UV Tables.
Proper motion values are specified in milliarcsec per year (mas/a).

Currently, the input file FileIn and output file FileOut must differ.

.!======================================================================

.ti -4
1 STOKES
.ti +4
[CLEAN_\]STOKES Key [/FILE UVin UVout]

Derive a single polarization UV table with the polarization state 
specified by Key from a multi-polarization UV table. The command
work on the UV__DATA buffer unless the /FILE option is present.  

Key is any of the following
.br
NONE, I, Q, U, V, RR, LL, HH, VV, XX, YY.

A typical use is after command FITS on CASA data
.br
.nf 
  FITS Fits.uvfits TO UVin.uvt
  STOKES NONE /File UVin Uvout
.fi

.ti -4
2 /FILE
.ti +4
[CLEAN_\]STOKES Key /FILE UVin UVout

Derive a single polarization UV table UVout with the polarization state 
specified by Key from a multi-polarization UV table UVin. Key is any of 
the following: NONE, I, Q, U, V, RR, LL, HH, VV, XX, YY.

.ti -4
1 UV__ADD
.ti +4
[ADVANCED_\]UV__ADD ITEM [Mode] [/FILE FileIn FileOut]

  Compute and add some missing information in a UV Table, such as the 
Doppler correction and the Parallactic Angle 

The information is derived from the Observatory coordinates, from 
the Telescope name in the input UV table. This can be supplied by 
the SPECIFY TELESCOPE command if not available.

ITEM can take values DOPPLER, PARALLACTIC or * for both.

Mode is a debug control integer which indicates in which column
the information should be placed. The default is 0, i.e. the
command will re-use the column of the appropriate type, or add it
if not present.  It may be set to 3, as often column 3 contains
the Scan number, which is not a relevant information for imaging.
Other values are at the user's peril...


.ti -4
2 /FILE
.ti +4
[ADVANCED_\]UV__ADD ITEM [Mode] /FILE FileIn FileOut
  
Use the UV data in the file FileIn, and write the completed 
visibilities in the file FileOut.   


.ti -4
1 UV__CIRCLE
.ti +4 
[ADVANCED_\]UV__CIRCLE [x0 y0 Rota Incli]  
  [/SAMPLING QSTEP [Unit [QMIN QMAX]]] [/ZERO [Flux]]

Compute a UV table containing the radial distribution of the 
azimutal average of the visibilities after deprojection for 
inclination and orientation (Incli, Rota, in Degrees) around 
a specified center (x0,y0  in Radians). All arguments default to 0.
ROTA is here the position angle of axis of (assumed) 
rotational invariance of the object. Thus, when using results
from UV__FIT one should use ROTA = PA-90, where PA is the Position Angle
of the Major axis.

The resulting UV table have visibilities only with V values equal to
0, so that the U values contain the radial distance in the UV plane.
This is convenient to display the azimutal average of the visibilities
as a function of UV distance, but cannot be used for further imaging.

See UV__RADIAL if you want to image the circular average of
the brightness distribution.

.ti -4
2 /SAMPLING
.ti +4
[ADVANCED_\]UV__CIRCLE [x0 y0 Rota Incli] /SAMPLING QSTEP [Unit [QMIN QMAX]] 
  [/ZERO [Flux]]

Specify the sampling of the UV distances: Qstep is the step, Qmin and Qmax
the min and max. Distances are in the specified unit, which can be "meter" (default)
or "kwave". If /SAMPLING is not present, an automatic
guess is made from the minimum and maximum baselines and the dish diameter.

.ti -4
2 /ZERO
.ti +4
[ADVANCED_\]UV__CIRCLE [x0 y0 Rota Incli] /ZERO [Flux] 
  [/SAMPLING QSTEP [Unit [QMIN QMAX]]]

Add  the zero spacing flux to the azimutal average.  If no value
is given, the zero spacing flux is extrapolated from the
shortest baselines using a parabolic interpolation centered on (u,v)=(0,0).

.!----------------------------------------------------------------------
.ti -4
1 UV__CORRELATE
.ti +4
[ADVANCED_\]UV__CORRELATE ResultFile [/FILE Data Model]

Compute the Frequency Cross-Correlation spectrum of two UV data sets.
The two UV data set must be referenced to the same position.


The data sets can be specified with the /FILE option. If not,
UV__CORRELATE will correlate the current UV data (UV__DATA) 
with the Model UV data (UV__MODEL), that can be loaded by 
READ UV and READ MODEL respectively. The Model UV data can 
also be computed by command MODEL.

ResultFile indicates on which data file the result must be written.
This result is a UV table with only the (0,0) spacing, that contains
the correlation spectrum. It can be displayed using command UV__PREVIEW.

See command BUNDLES_\UV__DETECT (that encapsulates in a more comprehensive way
UV__CORRRELATE) to compute the same result from a UV data file and
an Image model.

.ti -4
2 /FILE
.ti +4
[ADVANCED_\]UV__CORRELATE /FILE Data Model

Compute the Frequency Cross-Correlation spectrum of two UV data sets
in the specified file names.

The two UV data set must be referenced to the same position, and
have a compatible velocity resolution.

.!----------------------------------------------------------------------
.ti -4
1 UV__DEPROJECT
.ti +4 
[ADVANCED_\]UV__DEPROJECT x0 y0 Rota Incli 

Deproject a UV table for inclination and orientation (Incli, 
Rota, in Degrees) around a specified center (x0,y0  in Radians).
This can be useful for almost planar or cylindrical objects (e.g.
galaxies, or protoplanetary disks). When using results
from UV__FIT one should use ROTA = PA-90, where PA is the Position Angle
of the Major axis for a proper deprojection.

The result becomes the current UV table.

.ti -4
1 UV__FIT
.ti +4
[ADVANCED_\]UV__FIT  [Func1 .. FuncN] [/CONTINUUM [Field]] 
  [/INDEX SpIndex [Frequency]] [/OUTPUT [File]] [/QUIET]  
  [/RANGE Min Max TYPE]] [/SAVE File]
  [/UVRANGE Min Max [Unit]]  [/WIDGET N]
  
Fit UV data with a few simple functions. Func1 to FuncN
(currently N < 5) are the names of the functions to be fitted. If
not specified, the last names (or those attributed
by the /WIDGET options) are used.

The models are either simple functions or linear combinations
of simple functions.  Input parameters and results of the fitting process are 
(in sequential order) the position
offsets in R.A. and Dec (in arc second) of the model source from the phase
reference center, and its flux (Jansky).  Depending on the fitting
functions additional parameters and fit results are possible. Currently supported
distributions and additional fit parameters (in order) are:
.nf
POINT     Point source		    : None 	
E__GAUSS   Elliptic Gaussian source  : FWHM Axes (Major and Minor), Pos Ang
C__GAUSS   Circular Gaussian source  : FWHM Axis
C__DISK    Circular Disk             : Diameter
E__DISK    Elliptical (inclined) Disk: Axis (Major and Minor), Pos Ang
RING      Annulus		    : Diameter (Inner and Outer)	
EXPO      Exponential brightness    : FWHM Axis
POWER-2   B = 1/r^2		    : FWHM Axis
POWER-3   B = 1/r^3		    : FWHM Axis
U__RING    Unresolved Annulus         : Radius
E__RING    Inclined Annulus          : Inner, Outer, Pos Ang, Ratio
E__EXPO    Elliptic exponential       : FWHM Axes (Major and Minor), Pos Ang
SPERGEL   Spergel brightness profile : FWHM Axis, nu
E__SPERGEL Elliptic Spergel profile   : FWHM Axes (Maj. and Min.), Pos Ang, nu
 
.fi

The function parameters are found in a SIC structure named
UVF% under names UVF%PARi%PAR[7] (starting values), 
UVF%PARi%RANGE[7] (starting ranges) and UVF%PARi%START[7]
(number of starts). The /WIDGET option is a convenient
way to set these variables.

UV__RESIDUAL will compute the fit residual when used after UV__FIT, 
while it computes the residual from the Clean component list if 
used after CLEAN.

WRITE UV__FIT file[.uvfit] will save the fit results in a GILDAS table,
in the same format than that of the UV__FIT task.

The Pos Ang (PA) are the Position Angles of the major axis of the
distribution. To deproject the elliptical shapes, one should
use the Position Angle of the rotational axis, PA-90 (see commands
UV__CIRCLE, UV__DEPROJECT and UV__RADIAL)

.ti -4
2 /CONTINUUM
.ti +4
[ADVANCED_\]UV__FIT  [Func1 .. FuncN] /CONTINUUM [Field] 
  [/INDEX SpIndex [Frequency]] [/OUTPUT [File]] [/QUIET] [  
  [/RANGE Min Max TYPE]] [/UVRANGE Min Max [Unit]] 

Instruct UV__FIT to fit a Continuum channel derived from the current
UV table instead of per-channel values.

Field is the field size to determine the number of channels that can be 
averaged together. If not specified, it is derived by default like for
UV__MAP /CONTINUUM.
The additional option /INDEX can be used to specify a spectral index
and a reference frequency, while /RANGE can be used to restrict the
channel range used for the continuum.

This option is incompatible with /WIDGET and /SAVE.

.ti -4
2 /INDEX
.ti +4
[ADVANCED_\]UV__FIT  [Func1 .. FuncN] /CONTINUUM [Field] 
  /INDEX SpIndex [Frequency]
  [/OUTPUT [File]] [/QUIET]  [/RANGE Min Max TYPE]]
  [/UVRANGE Min Max [Unit]]  [/WIDGET N]

Instruct UV__FIT to fit a Continuum channel derived from the current
UV table instead of per-channel values, using the specified
spectral index SpIndex and giving flux at the specified Frequency
(in MHz, if none given an average frequency is derived from the UV data).

/INDEX can only be used if /CONTINUUM option is present.

Nc is the numbField is the field size to determine the number of channels that can be 
averaged together. If not specified, it is derived by default like for
UV__MAP /CONTINUUM.
The additional option /RANGE can be used to specify the range of selected
channels.

This option is incompatible with /WIDGET and /SAVE.

.ti -4
2 /OUTPUT 
.ti +4
[ADVANCED_\]UV__FIT  [Func1 .. FuncN] /OUTPUT [File [NEW]]
  [/CONTINUUM [Field]] [/INDEX SpIndex [Frequency]]  [/QUIET]  
  [/RANGE Min Max TYPE]] [/SAVE File]
  [/UVRANGE Min Max [Unit]]  

Write the fit results into a text output file, rather than on screen. 
The optional argument "File", if present, indicates to write on a new file of the
specified file name. If "File" already exists, an error is raised, unless
keyword NEW is also specified.

If /OUTPUT has no argument, the last opened
output file will be appended. This mechanism can be used to store results
from different UV tables into the same output file. 

.ti -4
2 /QUIET
.ti +4 
[ADVANCED_\]UV__FIT  /QUIET  [/WIDGET N]

[ADVANCED_\]UV__FIT  [Func1 .. FuncN] /QUIET [/CONTINUUM [Field]] 
  [/INDEX SpIndex [Frequency]] [/OUTPUT [File]] 
  [/RANGE Min Max TYPE]] [/SAVE File]
  [/UVRANGE Min Max [Unit]]  [/WIDGET N]

Activate the quiet mode. Only a progress report (25%, 50% and 75% done)
is issued in this case, not a per-channel message.  This mode
is recommended for many channels.

.ti -4
2 /RANGE
.ti +4
[ADVANCED_\]UV__FIT  [Func1 .. FuncN] /CONTINUUM [Field] 
  [/INDEX SpIndex [Frequency]] [/OUTPUT [File]] [/QUIET]  
  /RANGE Min Max TYPE   [/UVRANGE Min Max [Unit]]  

Instruct UV__FIT to fit a Continuum channel derived from the current
UV table instead of per-channel values, using the channel range
specified by Min Max and TYPE (units of Min and Max, can be
CHANNEL, FREQUENCY or VELOCITY).

/RANGE can only be used if /CONTINUUM option is present.

Field is the field size to determine the number of channels that can be 
averaged together. If not specified, it is derived by default like for
UV__MAP /CONTINUUM.
The additional option /INDEX can be used to specify a spectral index
and a reference frequency.

This option is incompatible with /WIDGET and /SAVE.


.ti -4
2 /RESULT
.ti +4
[ADVANCED_\]UV__FIT /RESULT  Nstep Min Max

Test functionality only. For 1 channel, compute the expected visibility
radial profile between Min and Max with Nstep steps. The profile is
created in variable UVF%PLOT.

This option may disappear without further notice.
.ti -4
2 /SAVE
.ti +4 
[ADVANCED_\]UV__FIT /SAVE OutputFile

Save the input parameters, into a text output file. This file is then
a script which can be re-executed to set the input parameters
for UV__FIT.

If the data has only 1 channel, the fit results (see HELP
UV__FIT ResultValues) are also written in the same file. These
Results values can be re-used as starting parameters (allowing
to iterate the fit if needed) by passing argument DO to the script:
.ti +8
@ OutputFile DO

.ti -4
2 /UVRANGE
.ti +4
[ADVANCED_\]UV__FIT  [Func1 .. FuncN] [/CONTINUUM [Field]] 
  [/INDEX SpIndex [Frequency]] [/OUTPUT [File]] [/QUIET]  
  [/RANGE Min Max TYPE]] [/SAVE File]
  /UVRANGE Min Max [Unit]  [/WIDGET N]

Specify the range of Baseline lengths to be used to select
the visibilities to be fitted.  This option can be used to
filter out extended sources, such that the fitted parameters
of compact sources will be less biased.

.ti -4
2 /WIDGET
.ti +4  
[ADVANCED_\]UV__FIT   /WIDGET N [/QUIET] [/UVRANGE Min Max [Unit]]

Create a Widget to specify the function names and input parameters 
for UV__FIT for N functions.  Once these are defined by the user,
clicking the GO button will launch the computation.

.ti -4
2 History
.ti +4 
[ADVANCED_\]UV__FIT  [Func1 .. FuncN]  [/QUIET] [/SAVE File] [/WIDGET N]
    
This command is similar to the pre-existing task UV__FIT, but works 
on the current UV buffer, thus offering a simpler integration in IMAGER.

.ti -4
2 ResultTable

The UV__FIT results are stored in an internal table named UV__FIT. This 
table can later be saved using command WRITE UV__FIT FileName. The 
table is organized as a M by N array, where M is the number of channels
in the UV data and the organization in N is the following:
.nf
N:  P1 P2 P3 Vel A1 A2 A3 Par1 Err1 Par2 Err2 ... A1 A2 A3 Par1 Err1 ...

where P1 = RMS of the fitting process
      P2 = number of supplied functions  (NF$)
      P3 = total number of parameter
     Vel = velocity of the i-th channel (i lies between 1 and M)
      A1 = 1 (for the first function), = 2 (for the second function)
      A2 = function code (POINT = 1, E__GAUSS = 2, ... , POWER-3 = 8)
      A3 = number of parameters of the function      
    Parx = result of the fit parameter (ordering as in input)
    Errx = error of the fitting process for the parameter Parx
 	
.fi
For example, fitting models with the two functions POINT and C__GAUSS 
produce files with N=24 (4 headers + 3+2*3 for POINT + 3+2*4 for C__GAUSS,
as the POINT and C__GAUSS functions have 3 and 4 parameters respectively).

SHOW UV__FIT will display plots from this table.  

.ti -4
2 ResultValues
.ti +4

For data with only 1 channel, the fit UV__FIT results are available as
variables  UVF%PARi%RESULTS[7] (for the results) and UVF%PARi%ERRORS[7]
(for their formal errors) for every function number i. These variables
are written in the output file by the UV__FIT /SAVE OutputFile command.

They are also available in the internal table named UV__FIT, as for
any other number of channels (see HELP UV__FIT ResultTable)

.ti -4
1 UV__LINEARIZE
.ti +4 
  UV__LINEARIZE  [Tolereance] [/FILE FileIn FileOut]
  
  Convert a "random" frequency axis (one with a specified frequency per
channel) to a standard linear regularly spaced frequency / velocity axis defined by
Reference, Value and Increment. 

  This is done by ordering the frequencies, and filling the gaps by empty
(zero weight) channels, as much as possible. It thus requires that the
input frequencies are already regularly spaced (within the user specified
Tolerance), and that gaps are not too large (to avoid creating a large
number of unused channels).

  The value of Tolerance is sticky (default at start 1.E-3 channel).

    *** Still under development ***
    
    Currently works only in Memory
    
    No control on Gaps yet


.ti -4
1 UV__MERGE
.ti +4

  [ADVANCED_\]UV__MERGE OutFile /FILES In1 In2 ... Inn [/IGNORE]
    [/MODE [LINE|STACK|CONCATENATE|INTERSECT|STITCH|CONTINUUM [Index [Freq]]]
    [/SCALES F1 ... Fn] [/WEIGHTS W1 ... Wn ] 
  
  Merge many UV data files, with calibration factor and weight factors
and (for Line data) spectral resampling as in the first  one. OutFile
is the name of the output UV table.

  For Line data, the default is to merge lines of the same molecular
transition (same Rest Frequency). However the STACK mode allows 
stacking UV data from different spectral lines, re-aligned in velocity.
This can allow detection of molecules with many transitions.
  
  For Continuum data (1 channel and/or option /MODE CONTINUUM), a 
spectral index and a reference Frequency can be specified to 
merge all UV tables.

.ti -4
2 /FILES
.ti +4

  [ADVANCED_\]UV__MERGE OutFile /FILES In1 In2 ... Inn [/IGNORE]
    [/MODE [LINE|STACK|CONCATENATE|INTERSECT|STITCH|CONTINUUM [Index [Freq]]]
    [/SCALES F1 ... Fn] [/WEIGHTS W1 ... Wn ] 
  
  Specify the names of the UV tables to be merged. The first one is
used as a reference for resampling (line data) or Frequency (continuum data).

  Instead of individual file names, a character array variable can be used
to specify the input UV tables.  A common use is with the DIR%FILE array
created by command SIC FIND:
.nf
  SIC FIND A-*.uvt
  UV__MERGE M-all /FILES DIR%FILE
.fi
will merge in Line mode all files of name A-*.uvt into M-all.uvt

.ti -4
2 /IGNORE
.ti +4

  [ADVANCED_\]UV__MERGE OutFile /FILES In1 In2 ... Inn /IGNORE
    [/MODE [LINE|STACK|CONCATENATE|INTERSECT|STITCH|CONTINUUM [Index [Freq]]]
    [/SCALES F1 ... Fn] [/WEIGHTS W1 ... Wn ] 

  Ignore trailing columns in the process. This can be useful when merging
data from moving objects (e.g. proper motion) from ALMA data, where the
UV tables may appear as tiny mosaics. 


.ti -4
2 /MODE
.ti +4

  [ADVANCED_\]UV__MERGE OutFile /FILES In1 In2 ... Inn 
    /MODE [LINE|STACK|CONCATENATE|INTERSECT|STITCH|CONTINUUM [Index [Freq]]]
    [/IGNORE] [/SCALES F1 ... Fn] [/WEIGHTS W1 ... Wn ] 
  
  Specify the merging mode.  The default mode is LINE.
  
  In LINE mode, for spectral line UV tables (more than 1 channel), 
the default is that the spectral lines must have the same Rest Frequency. 
Resampling (in velocity, which is then identical in frequency) is done on
the grid of the first UV table In1.
  
  In mode CONCATENATE, a common spectral axis encompassing those of the
initial UV tables is defined, and all UV tables are resampled on this one.
Spectral resolution is set by the first UV table.

  In mode INTERSECT, the common spectral axis is the intersection of the
coverage of all UV tables. Spectral resolution is set by the first UV table.
  
  In mode STACK, the Rest Frequencies can differ. Resampling is then
done in velocity, and the (u,v) coordinates scaled as the Rest
Frequency ratios to conserve the angular resolution of the data.
The /SCALES and /WEIGHT factors can be used to incorporate prior knowledge
of the expected line ratios to optimize S/N.

  For mode CONTINUUM, a spectral index can be specified, as well as a reference Frequency.
(u,v) coordinates are scaled appropriately, as well as Flux and
Weights in this case. The /SCALES and /WEIGHTS factors are applied
on top of this automatic spectral index scaling. Input Line UV Tables
are treated as multi-frequency Continuum ones (as in UV__CONTINUUM 
command).

  In mode STITCH, line (even single channel) tables with different frequencies 
but the same uv coverage are glued together to create a UV table with wider frequency 
coverage. The input UV tables must be time-baseline ordered. The output
UV table is given a random frequency axis, where each channel has its
own frequency. This operation may be needed for data coming from the EVLA
for example.

    ****  mode STITCH is still under development ***


  
.ti -4
2 /SCALES
.ti +4

  [ADVANCED_\]UV__MERGE OutFile /FILES In1 In2 ... Inn [/IGNORE]
    [/MODE [LINE|STACK|CONCATENATE|INTERSECT|CONTINUUM [Index [Freq]]]
    /SCALES F1 ... Fn [/WEIGHTS W1 ... Wn ] 
  
  Specify the flux scaling factors for each UV table.
  
  For /MODE CONTINUUM, the spectral index is applied separately from
this flux scale factor (by further multiplication).
  
.ti -4
2 /WEIGHTS
.ti +4

  [ADVANCED_\]UV__MERGE OutFile /FILES In1 In2 ... Inn  [/IGNORE]
    [/MODE [LINE|STACK|CONCATENATE|INTERSECT|CONTINUUM [Index [Freq]]]
    [/SCALES F1 ... Fn] /WEIGHTS W1 ... Wn  
  
  Specify the weight scaling factors for each UV table. The weight
scaling factor is independent of the flux scaling factor. This means
that to conserve the Signa-to-Noise ratio, one should normally use
Wi = 1/Fi^2.
  
  For /MODE CONTINUUM, the spectral index is applied separately from
this weight scaling factor (by further multiplication).
  
  
.ti -4
1 UV__MOSAIC
.ti +4

  [ADVANCED_\]UV__MOSAIC Mosaic  MERGE|SPLIT [Fields [...]]
  
  Built a Mosaic UV table from individual fields (MERGE keyword), 
or split a Mosaic UV table in individual fields (SPLIT keyword)
  
  For MERGE, all single-field UV tables must match spectroscopically.
Use command UV__RESAMPLE /LIKE on individual fields if needed 
to ensure this.
  
.ti -4
2 MERGE
.ti +4
  [ADVANCED_\]UV__MOSAIC Mosaic  MERGE Fields [...]

  Build a new Mosaic UV table from the single-fields UV tables
indicateed by the arguments following the MERGE keyword.
  
  The Mosaic UV table name will be Mosaic.uvt
  
  If only 1 argument is following the keyword MERGE, it is 
assumed to be a SIC Character array variable containing the filenames
of all single-field UV tables needed to build the mosaic. 
This is typically used as follows:
.nf
    IMAGER> SIC FIND fields*.uvt
    IMAGER> UV__MOSAIC my__mosaic MERGE dir%file
.fi
The number of fields is thus given by the size of the array.
  
  If more than 1 argument follow the keyword MERGE, each one
indicates a separate single-field UV table.  It is not possible
to use a character array in this case.
  

.ti -4
2 SPLIT
.ti +4
  [ADVANCED_\]UV__MOSAIC Mosaic SPLIT [Fields]
  
  Split a UV table of name "Mosaic.uvt" into a series
of single-fields UV tables of generic name Fields. 
Individual names are then Fields-1.uvt, ... Fields-n.uvt
  
  If not specified, Fields default to the name given by Mosaic.

.ti -4
1 UV__PREVIEW
.ti +4
[ADVANCED_\]UV__PREVIEW  [TAPER Ntaper] [CLIP Threshold] 
  [HISTO Nhisto] [SMOOTH Nsmooth] [/BROWSE [Ataper]] 
  [/FILE UvData.uvt [Drop]]

A fast previewer to figure out if there is signal and what
is its spectral shape.  The command attempts to find out
the line free regions and to estimate a continuum region.

The output of UV__PREVIEW can be used for further processing
commands (UV__BASELINE and UV__FILTER, UV__SPLIT, SPECIFY, etc...)

If a catalog is defined (see HELP CATALOG), it will also
display line identification (red for detected ones, blue
for the others).
  
  The behaviour is controlled by 4 parameters than can be
set through the "KEY Value" optional argument pairs. These are
.nf
  TAPER   Ntaper    : number of scale sizes  (default 4)
  CLIP    Threshold : Clipping level in Sigma (default 3.5)
  SMOOTH  Nsmooth   : Number of spectral smoothing (default 3)
  HISTO   Nhisto    : Size of histogram
.fi
These values are "sticky": they remain valid until further change,
and they can be listed by 
.ti +4
UV__PREVIEW ? 

.ti -4
2 /BROWSE
.ti +4
[ADVANCED_\]UV__PREVIEW /BROWSE [Ataper] [/FILE FileIn] [Drop]]


    Use a "split window" previewer instead of just one window.
The bottom window displays full spectra for all tapers, the top
window is a user-controlled zoom of one of the tapers, with spectral
line identifications if a catalog is available. The cursor is called
and the user can adjust the zoom display with it.
Press H for help, E for exit.

  Ataper indicates the taper number (default: last one).

.ti -4
2 /FILE
.ti +4 
[ADVANCED_\]UV__PREVIEW [Key Value [...]] /FILE FileIn [Drop]
[/BROWSE Ataper]

Without /FILE, UV__PREVIEW works from the current UV data set.

With the /FILE option, it will pre-view the UV data set from the
specified file. Edge channels are automatically dropped in this
mode, as many telescopes (NOEMA or ALMA) do not produce 
useable data in these ones. The default drop is 5% of bandwidth
on each side, but can be changed with the option Drop value (in %).

.ti -4
2 Algorithm
.ti +4

UV__PREVIEW computes for Ntapers different tapers the spectrum towards 
the phase center. The taper ranges are determined from the available 
baseline lengths and telescope diameter. Ntapes is controlled by
the value of Key TAPER. 

These spectra are then smoothed by averaging several channels (1,4,16 
and 64) to be sensitive to different linewdiths. The nummber of
smoothed spectra per taper is controlled by the value of Key SMOOTH.
  
For each spectrum, UV__PREVIEW then attempts to figure out if there is 
line emission and the line-free channels to define the continuum level. 
This is based on the histogram of the intensity distribution of all 
channels. The most likely value and the noise level is derived from 
this histogram. An iterative scheme, blanking out of range (presumably 
line emission) channels, is used for this to converge towards a 
Gaussian histogram, which normally represents the noise distribution 
around the continuum level.

As a last step, blanked channels are accumulated in a list of
channels, which thus contain possible line emission at any of the
Ntapers angular scales and Nsmooth spectral resolutions.

.ti -4  
2 Limitations
.ti +4
  
UV__PREVIEW cannot identify lines if there are two few channels. It 
will only display the spectra in this case. A minimum of 32 channels is 
required, but confused spectra may also prevent a proper line 
recognition.

The line detection is based on the current specified velocity. If 
this is incorrect, lines may appear shifted and considered as not 
detected. PREVIEW%TOLERANCE indicates the matching precision in 
frequency (default is 2 MHz).

If variable REDSHIFT exists, the frequency scale is
corrected for that source Redshift, so that line identification
remains possible.

.ti -4
2 Output
.ti +4

  UV__PREVIEW returns the list of possible line channels through 
variable PREVIEW%CHANNELS. If no line emission was 
identified at any scale, the list is empty and the variable does not 
exist.
  
With this list, the user can compute the continuum image, using 
commands UV__FILTER /CHANNELS PREVIEW%CHANNELS (or simply UV__FILTER), 
then UV__CONTINUUM and the usual UV__MAP and CLEAN. Alternatively, 
the user can filter out the continuum emission using UV__BASELINE.

If a catalog is present, UV__PREVIEW also creates several other variables.
PREVIEW%FOUND indicates the spectral line falling in the frequency
range, while PREVIEW%DETECTED indicates the dectected lines.
These two structures have the following variables, e.g. for FOUND:
.nf
PREVIEW%Found%FREQ     The line frequencies
PREVIEW%Found%LINES    The line names
PREVIEW%Found%SPECIES  The molecule name
.fi
PREVIEW%EDGES and  PREVIEW%FREQUENCIES contain the start and end 
channels (for %EDGES, resp. frequencies for %FREQUENCIES) of each 
contiguous range of channels in PREVIOUS%CHANNELS. These variables 
are used for line identification and imaging in the 
.nf 
  @ image__lines
.fi
script.

Finally, UV__PREVIEW returns in PREVIEW%FMIN PREVIEW%FMAX the frequency
coverage, and in PREVIEW%FREQ the rest frequency of the most likely 
spectral line in the window, and in PREVIEW%LINES its name. 
If no spectral line has been identified,
PREVIEW%FREQ is just the mean of PREVIEW%FMIN and PREVIEW%FMAX, and
PREVIEW%LINES does not exist.

.ti -4
1 UV__RADIAL
.ti +4 
[ADVANCED_\]UV__RADIAL x0 y0 Rota Incli  [/SAMPLING QSTEP [QMIN QMAX]] 
[/ZERO [Flux]]

Compute a UV table containing the radial distribution of the azimutal average of the 
visibilities after deprojection for inclination and orientation (Incli, 
Rota, in Degrees) around a specified center (x0,y0  in Radians).
ROTA is here the position angle of axis of (assumed) 
rotational invariance of the object. Thus, when using results
from UV__FIT one should use ROTA = PA-90, where PA is the Position Angle
of the Major axis.

The result becomes the current UV table. 
The resulting UV table has a (u,v) coverage which 
is extended by rotation, so that it can be used to image the
(rotationally symmetric) 2-D radial distribution using standard
commands like UV__MAP and CLEAN.   The radial profile of the
brightness distribution can then be recovered by using any
radial cut through this image.

Note, however, that in a SHOW UV command with "radius" along one axis,
all visibilities at different azimut are superimposed. See UV__CIRCLE
for a different way of computing an azimutal average, more suited for 
SHOW UV.

.ti -4
2 /SAMPLING
.ti +4
[ADVANCED_\]UV__RADIAL [x0 y0 Rota Incli] /SAMPLING QSTEP [Unit [QMIN QMAX]] 
  [/ZERO [Flux]]

Specify the sampling of the UV distances: Qstep is the step, Qmin and Qmax
the min and max. Distances are in the specified unit, which can be "meter" (default)
or "kwave". If /SAMPLING is not present, an automatic
guess is made from the minimum and maximum baselines and the dish diameter.
 
.ti -4
2 /ZERO
.ti +4
[ADVANCED_\]UV__RADIAL [x0 y0 Rota Incli] /ZERO [Flux] 
  [/SAMPLING QSTEP [Unit [QMIN QMAX]]] 

Add  the zero spacing flux to the azimutal average.  If no value
is given, the zero spacing flux is extrapolated from the
shortest baselines using a parabolic interpolation centered on (u,v)=(0,0).


.ti -4
1 UV__SHORT
.ti +4
[ADVANCED_\]UV__SHORT [Arg] [/CHECK] [/REMOVE] [/RESAMPLE]

.so imager-help-uvshort.nroff-so

.ti -4
1 XY__SHORT
.ti +4
[ADVANCED_\]XY__SHORT [Arg] 

Compute the Short Spacings image from the current "Single Dish" dataset 
(read by READ SINGLE) when this dataset is a Class table, 
and make it available as the SHORT image variable.

  If the "Single Dish" dataset is already a 3-D data cube, nothing
is done as it is alreay accessible through the SHORT image variable.

XY__SHORT uses the same input parameters as UV__SHORT. It corresponds
to Step__1 of UV__SHORT.
 
.ti -4
1 ENDOFHELP


