.ec _
.ll 76
.ad b
.in 4
.ti -4
1 Language
  CLEAN_\ Language Summary

  The CLEAN_\ Language contains commands related to UV data handling, UV to DataCubes conversion and DataCube processing.
  
.nf
ALMA          : Joint deconvolution of ALMA and ACA dirty images
BUFFERS       : List and Display the known buffer status
CCT__CLEAN     : Compute CLEAN image from Clean Component Table, without residuals
CCT__CONVERT   : Convert an image into a Clean Component Table
CCT__MERGE     : Merge two Clean Component Tables
CLEAN         : Deconvolve a dirty image using the current METHOD
.! COLOR         : Control the color LUT to highlight the Zero level
DISCARD       : Discard one of the active data buffers
DUMP          : Dump the control parameters of the deconvolution algorithms
FIT           : Fit the dirty beam
.! INSPECT__3D    : Visualize datacube by cuts along 3 main directions
MAP__COMBINE   : Combine two data Cubes
MAP__COMPRESS  : Average a Cube by several channels 
MAP__INTEGRATE : Compute a Moment 0 Map
MAP__REPROJECT : Spatial resampling of a Cube
MAP__RESAMPLE  : Resample a Cube on a different Velocity/Frequency scale
MAP__SMOOTH    : Smooth by N channels
MOSAIC        : Toggle the mosaic mode
MX            : Iteratively image and deconvolve a dirty image
PRIMARY       : Apply primary beam correction
READ          : Read the input files in internal buffers
.! SHOW          : Display (in a plot) some internal buffer result
SPECIFY       : Change the Frequency / Velocity scale or the Telescope
SUPPORT       : Define the support used to search clean components
UV__BASELINE   : Subtract a continuum baseline from a Line UV data
UV__CHECK      : Check UV data for null visibilities or per channel flags.
UV__COMPRESS   : Compress a Line UV data into another Line UV data
UV__CONTINUUM  : Compress a Line UV data into a Continuum UV data
UV__EXTRACT    : Extract a range from
UV__FILTER     : Filter out (line) channels
UV__FLAG       : Interactively flag UV data
UV__MAP        : Build the dirty image and beam from a UV table
UV__RESAMPLE   : Resample (in Velocity) the UV data
UV__RESIDUAL   : Subtract Clean Component from the UV Data
UV__RESTORE    : Restore a Clean image from UV data and Clean Components
UV__REWEIGHT   : Evaluate UV weights from visibility statistics
UV__SHIFT      : Shift a UV table to common phase center
UV__SMOOTH     : Smooth spectrally a Line UV data
UV__SPLIT      : Split a UV table into Line and Continuum
UV__STAT       : Gives beam sizes and noise properties as a function of
                 tapering or robust weighting parameter
UV__TIME       : Time average the current UV data
UV__TRIM       : Suppress useless information from UV data
UV__TRUNCATE   : Truncate the baseline range of the UV data
.! VIEW          : Show (in a GO VIEW-like plot) some internal buffer result
WRITE         : Save internal buffers or Image variables onto output files
.fi

.ti -4
1 ALMA
.ti +4
[CLEAN_\]ALMA [FirstPlane [LastPlane]] [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY] [/NOISE] [/METHOD]

Joint deconvolution methods specific to ALMA+ACA observations.

The ALMA simulator can be accessed either by typing "@ alma" at the prompt
or from the MAPPING main menu.

.ti -4
1 BUFFERS
.ti +4
[CLEAN_\]BUFFERS

List the status (sizes) of known buffers.  Active buffers can be
nullified by using the DISCARD command.
.ti -4
2 AGAINS 
.ti +4

  AGAINS is a buffer containing the results of a self-calibration
with command SELFCAL. It is a special table in the following format.
Each line contains a different time stamp. Column 1 is the Time
(in seconds), Col 2 the Date (in Days, with an arbitrary origin),
Col 3 the number of antennas, Col 4 the antenna reference number,
and then, for each antennas i, Cols (2+3*i:2+3*i) contains the
Amplitude correction factor, the Phase correction (in degree), and
the Signal-to-noise of the correction.

.ti -4
2 BEAM
.ti +4
  BEAM is a 2,3 or 4-D image buffer containing the synthesized beam
computed by UV__MAP (or by READ BEAM).
        
.ti -4 
2 CCT
. ti +4
  CCT is a special 3-D array containing the Clean Component Table.
The first dimension contains (x,y,f), the flux (in Jy) at offset
x,y (in radians). The second dimension handles the number of channels.
The last dimension handles the Clean iteration number. 

.ti -4
2 CGAINS
.ti +4
 
 CGAINS is a pseudo-UV table containing the complex gain correction
 resulting from a SELFCAL command (or read by READ CGAINS). It is
 analogous to a single-channel UV table, but interpreted by IMAGER
 as gain corrections to apply to the UV data by command APPLY.
 
.ti -4
2 CLEAN
.ti +4
  CLEAN is the deconvolved 2 or 3-D image produced by UV__MAP
(or read by READ CLEAN).  It is not corrected for primary 
beam attenuation.
  
  For Mosaics, command CLEAN produces a SKY brightness map, corrected
 from primary beam attenuations.

.ti -4
2 CLIPPED
.ti +4
  CLIPPED is a 2-D table containing the Clipped spectra produced
by command UV__PREVIEW. Col 1 contains the Velocity, Cols 2:N+1
the spectra for the N tapers used in UV__PREVIEW, Col N+2 
the natural weights.

.ti -4
2 CONTINUUM
.ti +4
  CONTINUUM contains the pseudo-UV table used (and created) by 
command UV__MAP /CONTINUUM to construct the continuum image. See
command UV__CONTINUUM for details.

.ti -4  
2 DIRTY
.ti +4
  DIRTY contains the dirty image produced by UV__MAP. Its interpretation
is different for a Single field than for a Mosaic.

.ti -4
2 EXTRACTED
.ti +4
  EXTRACTED   contains the 3-D data cube produced by command EXTRACT

.ti -4
2 FIELDS
.ti +4
  FIELDS is an intermediate buffer created by SHOW PRIMARY. It
is a transposed version of the PRIMARY buffer, in order (l,m,f) where
f is the field number.
  
  Note: there is a confusion with the FIELDS structure created
by READ UV on Mosaic UV tables.

.ti -4
2 MASK 
.ti +4
  MASK contains the Mask computed by command MASK (or read by READ MASK).
It may be used (or not) for CLEAN, depending on the selected type
of Support (see SUPPORT /MASK and MASK USE commands).        

.ti -4
2 M__AREA   
.ti +4
    M__AREA is a 2-D image containing the integrated area
computed by command MOMENTS   (CASA 0-th moment)
    
.ti -4
2 M__PEAK   
.ti +4
    M__PEAK is a 2-D image containing the peak flux 
computed by command MOMENTS   (CASA 8-th moment)
    
.ti -4
2 M__VELO   
.ti +4
    M__VELO is a 2-D image containing the mean velocity 
computed by command MOMENTS. Its value depends on the method
used in command MOMENTS: it can be the 1-st moment, or a fit
of the peak velocity.    
    
.ti -4
2 M__WIDTH   
.ti +4
    M__WIDTH is a 2-D image containing the velocity dispersion
computed by command MOMENTS. It is equivalent to the Full Width
at Half Maximum is the line shape is Gaussian.
    
.ti -4
2 PRIMARY
.ti +4
  PRIMARY is the primary beam, computed by command PRIMARY or
read by command READ PRIMARY. It may be 2-D (for single fields)
or 3-D (for Mosaics). It the later case, it is in the order
(f,l,m) where f is the field number. 

.ti -4
2 RESIDUAL
.ti +4
  RESIDUAL is the image of the residuals from the Clean deconvolution.

.ti -4
2 SHORT
.ti +4
  SHORT is the Short-Spacing image, computed by commands UV__SHORT
or XY__SHORT, or read by command READ SINGLE.

.ti -4 
2 SINGLE
.ti +4
  SINGLE is the Single-Dish data read by command READ SINGLE.
It may be a Class-table or a 3-D data cube.

.ti -4
2 SKY
.ti +4
  SKY is a 3-D image buffer containing the current estimate of the 
Sky brightness distribution. It is provided by command PRIMARY from 
the CLEAN and PRIMARY buffers for single-field data, but by command 
CLEAN for Mosaics.  Noise is not uniform in SKY image.

.ti -4
2 SLICED
.ti +4
  SLICED is 2-D buffer produced by the SLICE command.

.ti -4
2 SPECTRUM 
.ti +4
  SPECTRUM is a 2-D table containing the  spectra produced
by command UV__PREVIEW. Col 1 contains the Velocity, Cols 2:N+1
the spectra for the N tapers used in UV__PREVIEW, Col N+2 

.ti -4
2 UV
.ti +4
  UV is the current UV data. It is initially set by command READ UV,
but modified by many UV__like commands (resampling, calibration, etc...)

.ti -4
2 UV__FIT
.ti +4
  UV__FIT handles the results of the UV__FIT command. It is a
special format 2-D table. See HELP UV__FIT for details.

.ti -4
2 UVCONT
.ti +4
  UVCONT handles the intermediate (pseudo-)UV table created and used
by command UV__MAP /CONT for Multi-Frequency-Synthesis. It is a valid
2-D UV table, but which have more than 1 visibility for the same time
and baseline pair, with different (frequency-scaled) (u,v) coordinates.
Such UV tables can be properly imaged, but not properly self-calibrated.

.ti -4
2 UVRADIAL
.ti +4
  UVRADIAL  handles an azimutally averaged version of the UV data. It
is produced by command UV__RADIAL.

.ti -4
2 WEIGHT
.ti +4
  WEIGHT is the equivalent of PRIMARY for Mosaics. It is a 2 or 3-D 
image buffer containing the relative response given by all pointings 
of the Mosaic coverage.

.ti -4
1 CCT__CLEAN
.ti +4
  [CLEAN_\]CCT__CLEAN [Niter]
  
  Convert the CCT Clean Component Table into the CLEAN image. The
residuals are not added at this stage, contrary to what is done by
the CLEAN command.

 Niter is the last iteration to be retained (to be implemented). If
 not present, all components are considered. 

.ti -4
1 CCT__CONVERT
.ti +4
  [CLEAN_\]CCT__CONVERT [Threshold]
  
  Convert the CLEAN image into the CCT Clean Component Table.
  
  Threshold is the minimum (absolute value of) flux per pixel 
retained. Default is 0

.ti -4
1 CCT__MERGE
.ti +4
  [CLEAN_\]CCT__MERGE Out In1 In2


  Combine two input Clean Component Tables.
  
  Out can be a file name or an existing Image variable. 
The distinction is made by the existence of a "." in the name
          If it is a file, it is created like the In1 Variable
          If it is an Image variable, it must match the number
        of channels of the In1 Variable, and
          be large enough to handle the total number of components.
          
  In1 and In2 can be file names or existing Image variables.
They must match in terms of number of channels.
  
.ti -4
1 CLEAN
.ti +4
[CLEAN_\]CLEAN [FirstPlane [LastPlane]] [/RESTART [File]][/PLOT Clean|Residu] 
  [/FLUX Fmin Fmax] [/QUERY] [/NITER NiterList] [/ARES AresList]

Deconvolve a Mosaic or Single-field using the current METHOD (in SIC variable METHOD).
See INPUT CLEAN for the other SIC variables controlling the deconvolution process.
Supported methods are CLARK, HOGBOM, MRC, MULTISCALE and SDI. Use
HELP CLEAN Method and/or HELP CLEAN METHODNAME for further details 
on each algorithm. 

Clean the specified plane interval (default: planes between variables FIRST
and LAST). If only FirstPlane is specified, Clean only that plane.
This command allows a per-plane definition of the convergence criteria 
CLEAN__NITER and CLEAN__ARES.

.so imager-help-clean-input.nroff

.ti -4
2 /FLUX
.ti +4
[CLEAN_\]CLEAN [FirstPlane[LastPlane]] /FLUX Fmin Fmax [/PLOT Clean|Residu] [/QUERY] [/NITER NiterList] [/ARES AresList]

Display the cumulative Clean flux as Clean progresses. This option is
inactive in Parallel mode.

.ti -4
2 /PLOT
.ti +4
[CLEAN_\]CLEAN [FirstPlane [LastPlane]] /PLOT Clean|Residu [/FLUX Fmin Fmax] [/QUERY] [/NITER NiterList] [/ARES AresList]

Display the iterated Clean or Residual image for Cleaning methods which have
major cycles (CLARK or SDI). This option is inactive in Parallel mode.

.ti -4
2 /QUERY
.ti +4
[CLEAN_\]CLEAN [FirstPlane [LastPlane]] /PLOT Clean|Residu /QUERY [/FLUX Fmin Fmax] [/NITER NiterList] [/ARES AresList]

*** Obsolescent ***

Prompt for continuation when a Major cycle is complete. This option is inactive in Parallel mode. 

As a replacement of this facility, we suggest you to fragment your CLEAN in several steps, using the /RESTART option 
and the VIEW CLEAN (or RESIDUAl) command after each step.

.ti -4
2 /NITER
.ti +4

[CLEAN_\]CLEAN [FirstPlane [LastPlane]] /NITER NiterList [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY] [/ARES AresList]

Use a per-plane value for the number of iterations, instead of the
global NITER variable.  NiterList should be a 1-D integer array
of dimension the number of channels.

This option is only available through the CLEAN command, not through
the specific command of each method.

.ti -4
2 /ARES
.ti +4

[CLEAN_\]CLEAN [FirstPlane [LastPlane]] /ARES AresList [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY] [/NITER NiterList] 

Use a per-plane value for the absolute residual used to stop
cleaning,  instead of the
global ARES variable.  AresList should be a 1-D real  array
of dimension the number of channels.


.ti -4 
2 /RESTART
.ti +4

[CLEAN_\]CLEAN [FirstPlane [LastPlane]] /RESTART [File] [/PLOT Clean|Residu] 
  [/FLUX Fmin Fmax] [/QUERY] [/NITER NiterList] [/ARES AresList]

Instruct CLEAN to start from the specified Clean Component Table stored in the specified File, 
or those currently in memory if no File is given.

This can be used to re-start a Clean that was not deep enough. It can be used to split the Clean
operation in several steps, possibly changing the support at each step, or even the Clean METHOD.

For spectral data, the starting model should have the same number of channels, or have only 1.
The later capability can be used to start from the Clean Components derived from a Continuum-only 
data set, so that deconvolution proceeds to find out the line-only structure. This is an alternative
to separate deconvolution of Continuum and continuum-subtracted data followed by addition of the
Clean images.

.ti -4
2 Methods:
.nf
  CLARK       A minor/major cycle cleaning using FFTs for speed
              Fast, but less stable than others.
  HOGBOM      The basic deconvolution method, working component per 
              component. Slow but robust
  MRC         A dual-scale multi-resolution Clean working on a smooth
              and a difference map. Fast, but with no notions of Clean
              components
  MULTISCALE  A 3-scales multi-resolution-Clean working on 3 smoothed
              versions of the map. Slow, but very stable and adapted to
              sources with extended structures.
  SDI         A major-cycle only method. Good for extended structures
              but not very performant overall. 
.fi
.ti -4
2 CLARK
.ti +4
  CLEAN [FirstPlane [LastPlane]] [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY]

with METHOD = CLARK

A Major-Minor cycles CLEAN method, originally developed by B.Clark, in
which clean components are selected using a limited beam patch, and
deconvolved through Fourier transform at each major cycle. In mosaic mode
(See command MOSAIC), a mosaic clean is performed. Rings and/or stripes may
appear on extended sources.  Faster than the HOGBOM method for single
fields but maybe slower for mosaics. The strategy to search for CLEAN
components in CLARK method does not work properly when the secondary side lobes
are too large (e.g. larger than 0.3), or in case of high phase noise.

.ti -4
2 HOGBOM
.ti +4
  CLEAN [FirstPlane [LastPlane]] [/FLUX Fmin Fmax] [/RESTART [File]]

with METHOD = CLEAN

The simplest CLEAN algorithm, originally developed by Hogbom. In mosaic
mode (See command MOSAIC), a mosaic clean is performed.  Rings and or
stripes may appear on extended sources. It is slower than CLARK for a single
field but maybe faster for a mosaic. It is extremely robust.  Cleaning can
be interrupted by pressing _^C at any time.

.ti -4
2 MRC
.ti +4
CLEAN [FirstPlane [LastPlane]] [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY] 

with Method = MRC

Perform a Multi-Resolution CLEAN on the current dirty image.  MRC does not
support mosaics for theoretical reasons.

If option /PLOT is given, a display of the CLEAN or RESIDUAL map
will be shown at each major cycle, depending on the argument (default:
Residual). The user will be prompted for continuation when the /QUERY
option is present. The cumulative, already cleaned flux is displayed in
real time in an additional window while cleaning goes on when the /FLUX
option is present. Parameters of the /FLUX option are then used to give the
flux limits for this display. A summary plot with the Difference, Smooth,
and total CLEANed maps is also displayed.


.ti -4
2 MULTI
.ti +4
CLEAN [FirstPlane [LastPlane]] [/FLUX Fmin Fmax] [/RESTART [File]]

with METHOD = MULTI

Perform a 3-scales Hogbom-like deconvolution. A each minor cycle, the
the scale with the highest signal to noise is used to define the
Clean Components to retain. The algorithm is thus very stable.
 
The cumulative, already  cleaned flux is displayed in real time
in an additional window while cleaning goes on when the /FLUX option is
present. Parameters of the /FLUX option are then used to give the flux
limits for this display.

MULTI also works on mosaics.  The smoothing ratio can be controlled
by variable CLEAN__SMOOTH.

.ti -4
2 SDI
.ti +4
CLEAN [FirstPlane [LastPlane]] [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY] [/RESTART [File]]

with METHOD = SDI

Perform a Steer-Dewdney-Ito CLEAN. This clean method selects an ensemble of
clean components and remove them at once using FFTs.  It works best for
extended sources and UV coverages with short spacings. In such a case, it
may avoid the "ringing" features which appear using the CLARK or HOGBOM
techniques. In mosaic mode (see command MOSAIC), a mosaic clean is
performed.

SDI is very sensitive to the selected support (see MASK and SUPPORT commands),
especially when the dirty beam sidelobes are significant.

.ti -4
2 Variables:
.ti +4
.so imager-help-clean-clean-list.nroff

.so imager-help-clean-clean-desc.nroff

.ti -4
1 DISCARD
.ti +4
[CLEAN_\]DISCARD BufferName

Discard (i.e. remove from the memory and the list of known variables) 
the specified buffer. 

Only the most important buffers (e.g. DIRTY, CLEAN,
etc...) can be discarded. The current list is:
.br
  CCT,   CLEAN,   CONTINUUM,   DIRTY,   MASK,   PRIMARY,   RESIDUAL,
.br
  SINGLEDISH,   SKY,   UVCONT,   UVSELF,   UV__MODEL


.ti -4
1 DUMP
.ti +4
[CLEAN_\]DUMP [U]

Dump on screen the control parameters of the different CLEAN deconvolution
algorithms, mainly for debugging purpose. "DUMP U" dumps the parameters as
input by the user while "DUMP" dumps the parameters really used and/or
modified by the deconvolution algorithm.

.ti -4
1 FIT
.ti +4
[CLEAN_\]FIT [Plane] | [CHANNEL First Last] [FIELD First Last] 
  [/THRESHOLD Value] [/JVM__FACTOR [NoCircle]] 

Fit the dirty beam to obtain the clean beam parameters.  

For single fields, "FIT Plane" can be used to fit just one of the possible
Frequency dependent beam planes. Note that the number of beam plane can
be different from that of image channels.

For mosaics, dirty beams can be up to 4-D, depending on Frequency and Field number.
Keywords CHANNEL (or equivalently PLANE) and FIELD allow to restrict the fit 
to the specified range of Channels or Field numbers. All ranges are considered

Note that an automatic FIT is performed by all CLEAN algorithms when needed. 
The appropriate Frequency plane corresponding to each image channel is used.
For mosaics, CLEAN takes the average of the fitted beam parameters on all fields.

User specified values can be used instead (see HELP FIT FixedValues).

.ti -4
2 FixedValues 
.ti +4 

Clean beam parameters can also be specified by the users, by loading the BEAM__SIZE array with values other than its 
default values (0,0,0). In this case, no automatic fit will be performed. 

In general, we discourage this usage, as it may result in a very improper flux
scaling if the beam size is inappropriate. This mode should be reserved
to special cases where the beam cannot be properly fitted, or to
have a circular beam by taking as beam size the geometrical mean
of the fitted major and minor sizes.

Fixing the beam size should be associated to the FIT /JVM command to minimize 
(but not suppress !...) errors in total flux scaling. 

.ti -4
2 Results
.ti +4

Beam parameters are returned in the BEAM__FITTED array which is
analogous to the BEAM__SIZE one (Major axis, Minor axis in arcsec,
and Position angle, in degrees East from North), and in
the BEAM__JVM variable, that contains the scaling factor of
the residuals.


.ti -4 
2 /JVM__FACTOR
.ti +4
[CLEAN_\]FIT [Plane] | [CHANNEL First Last] [FIELD First Last] 
  [/THRESHOLD Value] /JVM__FACTOR [NoCircle] 

This option instructs the FIT command to estimate the so-called
JvM factor (from Jorsater _& van Moorsel 1995), which is the
ratio of Clean beam area to Dirty beam area.  The value is
returned into the BEAM__JVM variable.

The Dirty beam area is an ill-defined quantity (if no Zero spacing
is included, the Dirty beam area tends toward Zero when a sufficiently
large area is included). It is defined here by integrating only
up to the first null of the Dirty beam.

In case of Dirty beams presenting shoulders around the main beam, 
this ratio may be used to adjust the contribution of residuals to 
the CLEAN image so that the flux is better preserved.
For well-behaved beams, it should be quite close to 1.

NoCircle is an argument which, if present, indicates that the
Clean and Dirty beam should not be circularized to derive the factor;
this should be reserved for debugging.


.ti -4
2 /THRESHOLD
.ti +4
[CLEAN_\]FIT /THRESHOLD Value [/JVM__FACTOR]

Use Value instead of CLEAN__SIDELOBE to fit only regions of the beam
above Value by a Gaussian.  Gaussian fit may give different sizes
for significantly non-Gaussian beams.

.ti -4 
2 BEAM__SIZE

BEAM__SIZE is a Real array of size 3 containing the user-specified values
for the Clean beam size, with BEAM__SIZE[1] the Major axis, BEAM__SIZE[2] the
Minor axis (both in arcsec) and BEAM__SIZE[3] the Position angle (in degrees, North towards East).

If BEAM__SIZE[1] and BEAM__SIZE[2] are 0, the CLEAN or FIT commands will determine 
the Clean beam size (available in variable BEAM__FITTED similar
to BEAM__SIZE) by adjusting the dirty beam main peak.

If only one of BEAM__SIZE[1] and BEAM__SIZE[2] is non zero, it will be
used as the Clean beam size for a circular beam.

If both are non zero, BEAM__SIZE totally specifies the Clean beam size.
BEAM__FITTED is thus set to the BEAM__SIZE values when used.

.ti -4 
2 CLEAN__SIDELOBE 

Minimal relative intensity to consider for fitting the syntheized
beam to obtain the Clean beam parameters (BEAM__SIZE variable) 
when 0.  The default is 0.30.

In case of poor UV coverage, CLEAN__SIDELOBE should be higher than the
maximum sidelobe level to perform a good Gaussian fit. Some particularly
bad UV coverage may not allow any good fit at all, however.


.ti -4
1 MAP__COMBINE
.ti +4
[CLEAN_\]MAP__COMBINE OutCube CODE In1 In2 [Off] [/FACTOR A1 A2]
  [/THRESHOLD T1 T2] [/BLANKING Bval]

Combine in different ways two input images (or data cubes)...

  MAP__COMBINE also supports an "intuitive" , more mathematical syntax,
.ti +4
  MAP__COMBINE OutCube = [A1*]In1 Oper [A2*]In2 [Off] 
  [/THRESHOLD T1 T2] [/BLANKING Bval]

where Oper can be any of the values allowed for CODE, or one of the 4 standard operators, +-/*,
and scale factors are given in a natural way.  


OutCube can be a file name or an existing SIC Image variable. 
The distinction is made by the existence of a "." in the name.
If it is a file, it is created like the In1 Variable
If it is a SIC Image variable, it must exist and match the shape of In1. 
  
In1 can be a file name or an existing SIC Image variable.
    
In2 can be a file name or an existing Image variable.
The rank of In2 must be smaller than or equal to that of In1, and 
other dimensions must match.  

CODE is the Operation Code: see HELP MAP__COMBINE CODE for details.
Off is an optional offset for the operation. 

A1 and A2 are scale factors applied to In1 and In2 if needed (default
1).

T1 and T2 are thresholds below which no result is computed (default none).

.ti -4
2 CODE
.ti +4
[CLEAN_\]MAP__COMBINE OutCube CODE In1 In2 [Off] [/FACTOR A1 A2]
  [/THRESHOLD T1 T2] [/BLANKING Bval]

  CODE is the operation code. Allowed values are
.nf
ADD      or PLUS    OutCube = A1*In1 + A2*In2 + Off 
SUBTRACT or MINUS   OutCube = A1*In1 - A2*In2 + Off  
DIVIDE   or OVER    OutCube = A1*In1 / A2*In2 + Off    
MULTIPLY or TIMES   OutCube = A1*In1 * A2*In2 + Off    
OPACITY             OutCube = -Log( A1*In1 / A2*In2 + Off)  
INDEX               OutCube = Log( A1*In1 / A2*In2) / Log(Nu1/Nu2)  
.fi  
where Nu1 is the Frequency of In1, and Nu2 that of In2.
Off is 0 if not specified.
  
  With the "intuitive" mathematical syntax,
.ti +4
  MAP__COMBINE OutCube = [A1*]In1 Oper [A2*]In2 [Off] 

Oper can be any of the above values for CODE, or one of the 4 standard operators, +-/*,
and scale factors are given in a natural way, defaulting to 1 if not present. 
  
.ti -4
2 /BLANKING
.ti +4
[CLEAN_\]MAP__COMBINE OutCube CODE In1 In2 [/FACTOR A1 A2]
  [/THRESHOLD T1 T2] /BLANKING Bval

Specify the Blanking value to be used in the OutCube. If not
specified, the Blanking from In1 is used instead, and
that of In2 if In1 has no Blanking.

.ti -4
2 /FACTOR 
.ti +4
[CLEAN_\]MAP__COMBINE OutCube CODE In1 In2 /FACTOR A1 A2
  [/THRESHOLD T1 T2] [/BLANKING Bval]

Specify the factors to apply to In1 and In2. Default is 1.0.
This option is not available in the "intuitive" math syntax, where
the factors are specified directly.

.ti -4
2 /THRESHOLD 
.ti +4
[CLEAN_\]MAP__COMBINE OutCube CODE In1 In2 [/FACTOR A1 A2]
  /THRESHOLD T1 T2] [/BLANKING Bval]

Specify the thresholds above which the computation is
valid for In1 and In2.  For pixels below this threshold,
the OutCube is blanked.

Default is no threshold (-huge(0.)).

.ti -4
1 MAP__COMPRESS
.ti +4
[CLEAN_\]MAP__COMPRESS WhichOne Nc [First TYPE] [Output]

Resample (in frequency/velocity) a data cuvbe by averaging NC adjacent channels. 

WhichOne indicates which data cube must be compressed. Allowed values are
.nf  
    - DIRTY, CLEAN or SKY
    - *, which means all of the previous existing ones
    - Any SIC Image Variable that is not a built-in buffer in IMAGER
    - An existing GILDAS data file
.fi
MAP__INTEGRATE only works on 3-D data cubes, replacing them by 
2-D images.

Output is a string indicating where the results will be placed.

.ti -4
2 Output
.ti +4
[CLEAN_\]MAP__COMPRESS WhichOne Nc [First TYPE] [Output]

Output is a string indicating where the results will be placed.
It can be
.nf
    - Any SIC Image Variable that is not a built-in buffer in IMAGER
      The variable must exist and be of adequate size.
    - A file name. The command will write the result as a GILDAS data file
      with this name.
.fi
The distinction between SIC Image Variable and Filenames is based
on the presence of a dot (".") or semi-colon (":") that indicate that
the string refers to a filename.

Output is compulsory unless WhichOne referes to one of the allowed
built-in buffer names (DIRTY, CLEAN or SKY) and forbidden if WhichOne
is *.  When Output is not present, the result are written in place on the
specified buffers.


.ti -4
1 MAP__INTEGRATE
.ti +4
[CLEAN_\]MAP__INTEGRATE WhichOne Min Max Type [Output]

Compute the integrated intensity map(s) over the specified
range from the specified data cube. Type can be VELOCITY
FREQUENCY or CHANNELS. 

WhichOne indicates which data cube must be compressed. Allowed values are
.nf  
    - DIRTY, CLEAN or SKY
    - *, which means all of the previous existing ones
    - Any SIC Image Variable that is not a built-in buffer in IMAGER
    - An existing GILDAS data file
.fi
MAP__INTEGRATE only works on 3-D data cubes, replacing them by 
2-D images.

Output is a name that indicates where the results will be placed,


.ti -4
2 Output
.ti +4
[CLEAN_\]MAP__INTEGRATE WhichOne Min Max Type [Output]

Output is a string indicating where the results will be placed.
It can be
.nf
    - Any SIC Image Variable that is not a built-in buffer in IMAGER
      The variable must exist and be of adequate size.
    - A file name. The command will write the result as a GILDAS data file
      with this name.
.fi
The distinction between SIC Image Variable and Filenames is based
on the presence of a dot (".") or semi-colon (":") that indicate that
the string refers to a filename.

Output is compulsory unless WhichOne referes to one of the allowed
built-in buffer names (DIRTY, CLEAN or SKY) and forbidden if WhichOne
is *.  When Output is not present, the result are written in place on the
specified buffers.

.ti -4
1 MAP__REPROJECT
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    [/BLANKING Bval Eval]    [/LIKE Template]
    [/PROJECTION Type Cx Cy [Angle]]
    [/SYSTEM Type [Equinox]]
    [/X__AXIS Nx Ref Val Inc]
    [/Y__AXIS Ny Ref Val Inc]

Resample spatially a Map or Cube according to the specified
projection (and coordinate system).  The characteristics of the
Output Cube can be controlled by the /LIKE option, or explicitely
by a combination of /PROJECTION, /SYSTEM, /X__AXIS, /Y__AXIS options.

Input can be a GILDAS data file, or a SIC image variable.
Output is a GILDAS data file that is created by the command.

.ti -4
2 /BLANKING
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    /BLANKING Bval Eval    [/LIKE Template]
    [/PROJECTION Type Cx Cy [Angle]]
    [/SYSTEM Type [Equinox]]
    [/X__AXIS Nx Ref Val Inc]
    [/Y__AXIS Ny Ref Val Inc]

Specify the desired Blanking value. If not present, this is
inherited from the Input, or the Template if specified.

.ti -4
2 /LIKE
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    /LIKE Template [/BLANKING Bval Eval]

Specify the shape and projection of the desired Output Cube
from a Template. Template is either a GILDAS data file, or
a SIC Header (or Image) variable.

The Blanking value, if not specified through /BLANKING,
will be inherited from the Template.

The /LIKE option is incompatible with the /PROJECTION, /SYSTEM,
/X__AXIS and /Y__AXIS options.

.ti -4
2 /PROJECTION 
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    [/BLANKING Bval Eval]    
    /PROJECTION Type Cx Cy [Angle]
    [/SYSTEM Type [Equinox]]
    [/X__AXIS Nx Ref Val Inc]
    [/Y__AXIS Ny Ref Val Inc]

Specify the desired Projection center. If Angle is not specified,
it is set to 0. Any argument with a value of * is left unchanged
from the Input Cube value.

This option is incompatible with the /LIKE option.

.ti -4
2 /SYSTEM 
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    [/BLANKING Bval Eval]    
    [/PROJECTION Type Cx Cy [Angle]]
    /SYSTEM Type [Equinox]
    [/X__AXIS Nx Ref Val Inc]
    [/Y__AXIS Ny Ref Val Inc]

Specify the desired coordinate System. Equinox default to 2000.0
for EQUATORIAL system if not specified.

This option is incompatible with the /LIKE option.

.ti -4
2 /X__AXIS 
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    [/BLANKING Bval Eval]    
    [/PROJECTION Type Cx Cy [Angle]]
    [/SYSTEM Type [Equinox]]
    /X__AXIS Nx Ref Val Inc
    [/Y__AXIS Ny Ref Val Inc]

Specify the desired X axis sampling. Any argument with a value of * 
is left unchanged from the Input Cube value.

This option is incompatible with the /LIKE option.

.ti -4
2 /Y__AXIS 
.ti +4
[CLEAN_\]MAP__REPROJECT Output Input   
    [/BLANKING Bval Eval]    
    [/PROJECTION Type Cx Cy [Angle]]
    [/SYSTEM Type [Equinox]]
    [/X__AXIS Nx Ref Val Inc]
    /Y__AXIS Ny Ref Val Inc]

Specify the desired Y axis sampling. Any argument with a value of * 
is left unchanged from the Input Cube value.

This option is incompatible with the /LIKE option.

.ti -4
1 MAP__RESAMPLE
.ti +4
[CLEAN_\]MAP__RESAMPLE WhichOne [Nc Ref Val Inc] [Result] [/LIKE Mold]

Resample 3-D data cubes on a different velocity scale.  
.nf
     Nc   new number of channels
     Ref  New reference pixel
     Val  New velocity at reference pixel
     Inc  Velocity increment
.fi
WhichOne indicates which data cube must be compressed. Allowed values are
.nf  
     - Built-in buffers DIRTY, CLEAN, SKY, SINGLE or *, which means all
       of the previous existing ones. Resampling is done in place.
     - Any SIC Image Variable that is not a built-in buffer in IMAGER.
     - A GILDAS data file
.fi
For the two later cases, the Result argument indicates where the resampled
data cube is stored. Result can be a file name or an existing SIC variable
of adequate dimensions.

MAP__RESAMPLE only works on 3-D data cubes. 

.ti -4
2 /LIKE
.ti +4
[CLEAN_\]MAP__RESAMPLE WhichOne [Result] [/LIKE Mold]

Resample 3-D data cubes on the same velocity scale than the specified 
Mold. Mold can be a SIC variable or GILDAS data file.

.ti -4 
1 MAP__SMOOTH
.ti +4 
[CLEAN_\]MAP__SMOOTH WhichOne Nc [Result] [/ASYMMETRIC]

Smooth a  3-D data cubes by Nc channels along the velocity axis.
.nf
     Nc   number of channels to be averaged in smoothing.
.fi
WhichOne indicates which data cube must be compressed. Allowed values are
.nf  
     - Built-in buffers DIRTY, CLEAN, SKY, SINGLE or *, which means all
       of the previous existing ones. Smoothing is done in place.
     - Any SIC Image Variable that is not a built-in buffer in IMAGER.
     - A GILDAS data file
.fi
For the two later cases, the Result argument indicates where the smoothed
data cube is stored. Result can be a file name or an existing SIC variable
of adequate dimensions.

By default, the smoothing does not modify the spectral sampling of the cubes. While
this naturally occurs when the smoothing number Nc is odd, the Nc even case
requires a specific handling.  For Nc even, the smoothed channel at
channel "i" sums up half of channel i-Nc/2, half of channels i+Nc/2 and
all channels in between.  Thus for Nc=2, this is a Hanning smoothing.

Like for UV__SMOOTH, this behaviour can be modified by option /ASYMMETRIC.

.ti -4
2 /ASYMMETRIC
.ti +4 
[CLEAN_\]MAP__SMOOTH WhichOne Nc [Result] /ASYMMETRIC 

Make no attempt to preserve the spectral sampling when Nc is even: the 
reference channel is then shifted by half the channel spacing.

For odd Nc, the smoothing is naturally symmetric, so the option has no impact.

.ti -4
1 SPECIFY
.ti +4
[CLEAN_\]SPECIFY Keyword [Values...] [/FOR SicVariable]

Specify or modify some information in internal buffers or in
a Sic Image Variable.

Recognized values for Keyword are
BLANKING, FREQUENCY, LINENAME, VELOCITY, TELESCOPE

If present the /FOR option indicates which buffer or Image variable
should be affected. If no /FOR option is given, all relevant
available buffers are affected (CLEAN, DIRTY, UV, etc...)

.ti -4
2 BLANKING
.ti +4
SPECIFY BLANKING Value /FOR SicVariable
.br
Specify or Modify the blanking value in the specifed Image variable
SicVariable. Option /FOR is mandatory for this action.

.ti -4
2 FREQUENCY
.ti +4
SPECIFY FREQUENCY Value
.br
Modify the rest frequency and recompute the velocity scale accordingly.
Value is the new rest frequency in MHz

.ti -4
2 LINENAME
.ti +4
SPECIFY LINENAME Name
.br
Change the spectral line name.

.ti -4
2 VELOCITY
.ti +4
SPECIFY VELOCITY Value
.br
Modify the source velocity and recompute the rest frequency scale accordingly
Value is the new velocity in km/s.


.ti -4
2 TELESCOPE
.ti +4
SPECIFY TELESCOPE Name

Add or Replace the telescope section with the parameters (name,
size, position) for the specified telescope name, essentially to 
get the most appropriate beam parameter.

A Telescope section is required for MOSAIC. The beamsize will
depend on telescope diameter and frequency, with a telescope
dependent factor. The default beam size is 1.13 Lambda/D.

.ti -4
1 MOSAIC
.ti +4
[CLEAN_\]MOSAIC On|Off

Turn on or off the mosaic mode for deconvolution. Note that a READ PRIMARY
command, or a UV__MAP command working on a Mosaic UV Table, automatically switches
on the mosaic mode. The program prompt changes to inform the user of the
current operating mode for deconvolution.


.ti -4
1 MX
.ti +4
[CLEAN_\]MX [FirstPlane [LastPlane]] [/PLOT Clean|Residu] [/FLUX Fmin Fmax] [/QUERY]

Make and deconvolve maps starting from a UV table. It combines UV__MAP and
CLEAN in a single step.

The mapping process is identical to UV__MAP.  It makes a map from UV data
by griding the UV data using a convolving function, and then Fast Fourier
Transforming the individual channels.  However, MX always produces a single
beam for all channels, thus neglecting frequency change between channels.
MX enables to shift the map center and rotate the image, by shifting the
phase tracking center and rotating the UV coordinates of the input UV
table.

The CLEAN algorithm is similar to the CLARK method, but with major cycles
operating directly on the ungridded UV table rather than in the image
plane. Accordingly, aliasing affects only of the residuals, not the clean
components. It is thus more accurate but also slower than CLARK as it asks
for the gridding step at each major cycle.  MX also shares the same
limitation as CLARK on large sidelobes.

.so imager-help-clean-input.nroff

.ti +4
        [CLEAN\MX ?
.br
    Will list all MAP__* and CLEAN__ * variables controlling the MX parameters.

.ti -4 
2 Variables:
.ti +4
.so imager-help-clean-uvmap-list.nroff

.so imager-help-clean-clean-list.nroff

.ti -4
1 PRIMARY
.ti  +4
[CLEAN_\]PRIMARY [BeamSize] [/TRUNCATE Percent]

Apply approximate primary beam correction to a single field deconvolved
(CLEAN) image, in order to create the sky brightness image (named SKY).
The truncation level is given by default by variable CLEAN__TRUNCATE,
and can be overriden by the /TRUNCATE option.

The primary beam model is a simple Gaussian.
If BeamSize (in radian) is specified, uses the corresponding
half-power beam size to determine the Gaussian beam.
If not, the parameters are taken from the telescope parameters, as
found in the telescope section of the CLEAN image and the observing 
frequency from the CLEAN image (e.g. for ALMA it uses 1.13 Lambda/D).

The SKY image is written with extension .lmv-sky by command WRITE.


.ti -4
2 /TRUNCATE
.ti  +4
[CLEAN_\]PRIMARY [BeamSize] /TRUNCATE Percent

Specify the truncation level. Default (in % of peak beam response)
is given by the CLEAN__TRUNCATE variable. Values are blanked beyond this.

.ti -4
1 READ
.ti +4
[CLEAN_\]READ Buffer File [/COMPACT] [/FREQUENCY RestFreq]
  [/RANGE Min Max Type] [/NOTRAIL]

Read the specified internal buffer (BEAM, CCT, CGAINS, CLEAN, DIRTY,  
MASK, MODEL, PRIMARY, RESIDUAL, SKY, SUPPORT, SINGLEDISH, UV) from input File. 
Default extension is .uvt for UV, CGAINS and MODEL, and for the others, 
in order, .beam, .cct, .lmv-clean, .lmv, .msk, .lobe, .lmv-res, 
.lmv-sky, .pol and .tab respectively. FITS file format is supported
for Data Cubes when the extension is given as .fits (see HELP READ FITS
for more details).

A subset of all available channels can 
be indicated through the /RANGE option, even for UV tables.

The corresponding buffer is available as a SIC image-like variable
of the same name, so that one can use e.g. HEADER DIRTY command.

READ * Name   will attempt to read all existing files of
same Name with the standard file types corresponding to the
respective buffers.

The /COMPACT option is used to load the ACA-specific internal buffer used
in the ALMA joint deconvolution method.

The /NOTRAIL allows to ignore trailing columns in UV data. This is normally not
recommended and should be used for debug only. An exception is for
"false" mosaics with just 1 field: see HELP READ /NOTRAIL for
details.

.ti -4
2 Buffers
.ti +4
[CLEAN_\]READ Buffer File [/COMPACT]
  
  The recognized Buffer names for READ are:
.nf
  BEAM        Synthesized Dirty beam
  CCT         Clean Component list
  CGAINS      Complex gains for APPLY command
  CLEAN       Deconvolved Clean image
  DIRTY       Dirty image
  PRIMARY     Primary beam
  RESIDUAL    Residual image
  MASK        Spatial mask 
  MODEL       UV table for Clean components
  SINGLEDISH  Single-Dish table or data cube
  SKY         Primary beam-corrected deconvolved sky brightness
  SUPPORT     Polygon enclosing the Support for Cleaning
  UV__DATA     UV data table
  UV__FIT      UV__FIT results table (for SHOW UV__FIT)
.fi
The MODEL UV table is for use in conjunction with commands in 
the CALIBRATE\ language, i.e. for Self-Calibration.

The following ones are allowed with the /COMPACT option
.nf
  BEAM        Synthesized Dirty beam
  DIRTY       Dirty image
  PRIMARY     Primary beam
  RESIDUAL    Residual image
  UV__DATA     UV data table
.fi

.ti -4
2 FITS
.ti +4
[CLEAN_\]READ Buffer File [/COMPACT]

For most buffers of type "Data Cube" (e.g. BEAM, CLEAN, DIRTY,
PRIMARY, RESIDUAL, SINGLEDISH, SKY), the input File can be 
in FITS format.  READ will check for the appropriate data format
when appropriate.  If the buffer does not accept FITS data format,
an error message is issued.

UVFITS data format is not supported for UV data, because a number
of important informations is sometimes stored in FITS Extensions. 
UVFITS format files should be converted to UV Tables in the GILDAS 
data format using the "@ fits__to__uvt" script.

.ti -4
2 Optimisation
.ti +4

Reading can be lengthy, especially for ALMA data.
IMAGER attempts to minimize read operations by checking
if anything has changed since the last command.  This
capability is enable if the SIC variable MAPPING__OPTIMIZE
is non zero, disabled otherwise.
  
  Currently, the READ command always display a message
about what reading may have been skipped, and whether this
possible optimization has been overridden by user choice.

.ti -4
2 /COMPACT
.ti +4
[CLEAN_\]READ Buffer File /COMPACT [/RANGE Min Max Type]

Read the specified internal buffer (UV, MODEL,
BEAM, PRIMARY, DIRTY, CLEAN, MASK, CCT) from input File to the
"compact array" data area.

.ti -4
2 /FREQUENCY
.ti +4
[CLEAN_\]READ Buffer File /FREQUENCY RestFreq [/RANGE Min Max Type]

Read the specified internal buffer and reset the velocity
scale to the corresponding rest frequencies. Velocities specified
in the /RANGE Min Max VELOCITY option would then refer to this
new frequency.

.ti -4
2 /NOTRAIL
.ti +4
[CLEAN_\]READ Buffer File /NOTRAIL [/FREQUENCY Freq] [/RANGE Min Max Type]

When reading UV Tables, ignores any trailing column. Trailing
columns normally appear for mosaics. However, ALMA sometimes uses
known proper motions to shift (by small amounts) phase centers
between two observing periods, yielding pseudo-mosaics with tiny
(in general insignificant) displacements.  The /NOTRAIL option
allows to ignore these details.

.ti -4
2 /PLANES
.ti +4
[CLEAN_\]READ Buffer File /PLANES Min Max 

Read only the last axis "planes" between the  First and Last implied
by Min and Max. For an LMV-ordered cube, this would be equivalent to 
.ti +4
  READ Buffer File /RANGE Min Max CHANNEL
.br
However, for transposed data cubes, VML or LVM-ordered for example, this is
not true at all when a Frequency/Velocity axis is present: /RANGE would
specify a subset of this(yet) axis, while /PLANES always indicate
a subset of the 3rd axis of the cube.

Min and Max indicate offsets from Plane 1 and the number of planes Nplane.
Thus Max can be negative: it then indicates Last = Nplane-Max. 
Also Min=0 and Max=0 implies loading all the channels.

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]READ Buffer File /RANGE Min Max Type

Load only the channels between the First and Last
defined by Min Max and Type.  Type can be
CHANNEL, VELOCITY or FREQUENCY. If the Data cube has
no Frequency/Velocity axis, only CHANNEL is allowed.

For type CHANNEL, Min and Max indicate offsets from
Channel 1 and Channel Nchan (the number of channels
in the data set). Thus Max can be negative: it then
indicates Last = Nchan-Max. Also Min=0 and Max=0 implies
loading all the channels.

The /RANGE option is not allowed for FITS files.

For UV tables with more than 1 Stokes parameter,
which are **NOT** fully supported by IMAGER, the
meaning of "channel" is ambiguous.

.ti -4
2 SINGLE
.ti +4
[CLEAN_\]READ SINGLE File[.ext] [/RANGE Min Max Type]

Read the "Single Dish" data set. It can be a Class table (.tab),
or a 3-D data cube (.lmv order).  The data set is available
as the SINGLE image variable.

If it is a 3-D data cube, the SHORT image variable is also defined
(the data area is shared with that of the SINGLE imager variable,
but the Headers are separate).  If it is a Class table, the
SHORT image becomes undefined. It will be computed by commands
UV__SHORT (see HELP UV__SHORT Step__1) or XY__SHORT. 


.ti -4
1 SUPPORT
.ti +4
[CLEAN_\]SUPPORT [Polygon] [/CURSOR] [/MASK] [/PLOT] [/RESET] [/VARIABLE] 

Define and/or plot the support inside which to search for CLEAN 
components. The support can be defined through a mask (see /MASK option)
or a polygon, depending on the selected options.
The /PLOT option can then be used to plot it.

A polygon stored in a file, or in a Sic variable (/VARIABLE option),
can be loaded as the polygon support. 

See also the [ADVANCED_\]MASK command for a complementary way of 
defining supports, in particular 3-D supports.

.ti -4
2 /CURSOR
.ti +4
[CLEAN_\]SUPPORT /CURSOR

With option /CURSOR, SUPPORT calls the interactive cursor to define the polygon
summits.  Type any key to go to next summit, D to correct the last one and
type E to end the polygon definition. The last polygon side will then
appear. The polygon definition may be aborted by typing Q. For graphical
displays, you may use the mouse buttons for the commands.  The left mouse
button draws a vertex, the middle mouse button deletes the last vertex, and
the right mouse button ends the polygon definition.

The resulting support is available in the Sic structure SUPPORT:
.nf
  - SUPPORT%NXY  [Integer]  Number of summits
  - SUPPORT%X    [Double]   X coordinates
  - SUPPORT%Y    [Double]   Y coordinates
.fi

.ti -4
2 /MASK
.ti +4
[CLEAN_\]SUPPORT /MASK    or  [ADVANCED_\]MASK USE

Use the mask defined by READ MASK or by the MASK command as the clean 
support. This does not suppress the current polygon: it can be 
re-instated by a simple SUPPORT command with no argument.

The Mask can be a 3-D array: CLEAN will find out which mask 
plane must be used for each spectral channel. 

Caution: [CLEAN_\]READ MASK and [ADVANCED_\]MASK command do not perform an 
implicit SUPPORT /MASK command. Only the ADVANCED_\MASK USE command
does it explicitely.


.ti -4
2 /PLOT
.ti +4
[CLEAN_\]SUPPORT [Name] /PLOT

Plot the current (or specified) polygon, or plot the current mask
(if it is 2-D only).

For 3-D masks, use the VIEW MASK command instead.

.ti -4
2 /RESET
.ti +4
[CLEAN_\]SUPPORT /RESET

Reset any support to default. This deletes the current polygon support.
This does not unload any mask defined  by READ MASK. Such a mask can be 
re-instated by SUPPORT /MASK.

.ti -4
2 /THRESHOLD
.ti +4
[CLEAN_\]SUPPORT /THRESHOLD [Raw Smooth [Length [Guard]]

*** Obsolete - see  [ADVANCED_\]MASK THRESHOLD instead ***
 
.ti -4
2 /VARIABLE
.ti +4
[CLEAN_\]SUPPORT VarName /VARIABLE

Load the support from the Sic variable VarName. VarName can be an 
array of the form:
.br
         VarName[NXY,2]  Real or Double

or a structure of the form (i.e. same as output):
.br
         VarName%NXY             Integer or Long
         VarName%X[VarName%NXY]  Real or Double
         VarName%Y[VarName%NXY]  Real or Double


.ti -4
1 UV__BASELINE
.ti +4
[CLEAN_\]UV__BASELINE [Degree] [/CHANNELS Channel__List]
  [/FREQUENCY List Of Frequencies] [/RANGE Min Max [TYPE]]
  [/VELOCITY List of Velocities] [/WIDTH Width [TYPE]]
  [/FILE FileIn [FileOut]]

Subtract a continuum from a line UV data set, by fitting  a baseline
for each visibility.  The channels to be ignored in this process
(i.e. the ones including the line emission) can be specified 
either by the /FREQUENCY or /VELOCITY options
in combination with the /WIDTH option, or by a channel list with
/CHANNELS or a range (of channels, frequencies or velocities) with
/RANGE.

By default, the command works on the current UV data, unless the
option /FILE is specified.

With no options (or with only /FILE), the command behaves as
UV__BASELINE /CHANNELS Preview_%Channels. See UV__PREVIEW for details.

.ti -4
2 /CHANNELS
.ti +4
[CLEAN_\]UV__BASELINE /CHANNELS Channel__List

Channel__List must be a 1-D SIC variable containing the list of channels
to filter out.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__BASELINE [Degree] [/CHANNELS Channel__List]
  [/FREQUENCY List Of Frequencies] [/RANGE Min Max [TYPE]]
  [/VELOCITY List of Velocities] [/WIDTH Width [TYPE]]
  /FILE FileIn [FileOut]
  
Use the UV data in the file FileIn, and write the continuum-free
visibilities in the file FileOut.  If FileOut is not specified,
"-line" is appended to the name indicated by FileIn.  

.ti -4
2 /FREQUENCY
.ti +4
[CLEAN_\]UV__BASELINE /FREQUENCY F1 [... [Fn]] [/WIDTH Width [TYPE]]

Specify around which frequencies the line emission should be filtered.
Frequencies F1 to Fn must be in MHz. The full width of the filtering
window around every frequency can be set by option /WIDTH.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

Tip: it can be convenient to have a list of SIC variables containing
the frequencies of the most intense spectral lines, e.g.
.ti +8
HCO10 = 89188.52
.br to be used as argument to the /FREQUENCY option.

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__BASELINE /FREQUENCY F1 [... [Fn]] /RANGE Min Max [TYPE]

Indicate that channels between the First and Last
defined by Min Max and Type contain line emission and should
be ignored in the baseline fitting.  Type can be
CHANNEL, VELOCITY or FREQUENCY.

For type CHANNEL, Min and Max indicate offsets from
Channel 1 and Channel Nchan (the number of channels
in the data set). Thus Max can be negative: it then
indicates Last = Nchan-Max. Also Min=0 and Max=0 implies
loading all the channels.

.ti -4
2 /VELOCITY
.ti +4
[CLEAN_\]UV__BASELINE /VELOCITY V1 [... [Vn]] [/WIDTH Width [TYPE]]

Specify around which velocities the line emission should be filtered.
Velocities V1 to Vn must be in km/s. The full width of the filtering
window around every frequency can be set by option /WIDTH.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

.ti -4
2 /WIDTH
.ti +4
[CLEAN_\]UV__BASELINE /FREQUENCY F1 [... [Fn]] /WIDTH Width [TYPE]

Specify the full width of the
window around every frequency given in the /FREQUENCY option.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.
The default width is the current channel width.

.ti -4
1 UV__CHECK
.ti +4
[CLEAN_\]UV__CHECK  Beams|Nulls|Integration [/FILE FileIn]

  Check current UV data for weight consistency, or the UV data in
the specified file if the /FILE option is present.

  BEAMS
.br
  List which channel range can be processed with the same synthesized beam.
See HELP UV__CHECK BEAM__RANGE for further details.

  NULLS
.br
  Check if there are null visibilities with non-zero weights, and flag
  them if found.

  INTEGRATION
.br
  Attempt to estimate the integration time. This is done by comparing
  the time stamps of consecutive observations, unless an INTEGRATION
  column is present.
  
.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__CHECK  Beams|Nulls|Integration /FILE FileIn

  Check the UV data in the specified file. 
  
.ti -4
2 BEAM__RANGES

  UV__CHECK BEAMS returns a variable named BEAM__RANGES[3,Nbeam] where
  Nbeam is the number of different synthesized beams found in the UV 
  data (based on the visibility weights). 

.nf
  BEAM__RANGES[1,i]  is the first channel of Beam number i
  BEAM__RANGES[1,2]  is the last channel of Beam number i
  BEAM__RANGES[1,3]  is the total weight of visibilities of Beam number i
.fi

  BEAM__RANGES is later used by UV__PREVIEW to discard edge channels
  that often do not have the same weights as the bulk of channels.

  Variable NBEAM__RANGES indicates the number of beam ranges. It is -1 
  if UV__CHECK has not yet been used.
  
  Most automatic imaging processes will assume BEAM__RANGES is relatively
  simple (2 edges and a dominant main range) and simply discard the edges
  if any, or complain if is too complex.   
    
  For complex datasets with NBEAM__RANGES greater than 2 or 3, 
  BEAM__RANGES could be used to segment the imaging and deconvolution
  process into ranges having a common beam. Setting MAP__BEAM__STEP
  to 1 is another possibility, but that creates 1 beam per channel,
  thus doubling the used space._
  
.ti -4
1 UV__COMPRESS
.ti +4
[CLEAN_\]UV__COMPRESS [Nc]  [/CONTINUUM] [/FILE FileIn FileOut]

Resample the UV data by averaging NC adjacent channels. 

With no /FILE option, the current UV table obtained by READ UV is resampled.
All further UV commands work on the "Resampled" UV table.
The "Resampled" UV table is a simple copy of the original one after a READ UV
command, or after a UV__RESAMPLE or UV__COMPRESS commands with
no arguments and no options.

With the /FILE option, the UV data is read from file FileIn and the resampled
output is written in file FileOut.

With the /CONTINUUM option, the argument can be omitted, and the
best value for Nc is derived from the current field of view,
to avoid bandwidth smearing.

.ti -4
2 /CONTINUUM 
.ti +4
[CLEAN_\]UV__COMPRESS  /CONTINUUM  [/FILE FileIn FileOut] 

Resample the UV data by averaging Nc adjacent channels. 
The value for Nc is derived from the current field of view,
to avoid bandwidth smearing. This command is intended to provide
a compact form of UV data for continuum-only imaging, through
the UV__MAP /CONTINUUM command. Contrary to the output of
the UV__CONTINUUM command, it is also suitable for Self-Calibration
(and it is more compact).

With no /FILE option, the current UV table obtained by READ UV is resampled.

With the /FILE option, the UV data is read from file FileIn and the resampled
output is written in file FileOut.

Caution: /CONTINUUM may not work with the /FILE option if the
Minimun and Maximum baselines are not available in the FileIn header.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__COMPRESS Nc  /FILE FileIn FileOut
  
Use the UV data in the file FileIn, and write the data after
averaging by NC adjacent channels in the file FileOut.  


.ti -4
1 UV__CONTINUUM
.ti +4
[CLEAN_\]UV__CONTINUUM [Naver] [/INDEX Value [Frequency]]
  [/RANGE Min Max TYPE]

Transform the (presumably spectral line) UV data set loaded by READ UV
into a "continuum" data set.

The transformation selects line channels defined by the /RANGE option,
average them by groups of Naver contiguous channels,
and concatenate the resulting visibilities into a "continuum" UV table.
If not present, Naver is derived from the current field of view
MAP__FIELD and required precision, MAP__PRECIS to avoid bandwidth
smearing at field egdes.

For each output channel, and for all visibilities,
the U and V coordinates are rescaled to the mean observing frequency,
and the resulting (single-channel) visibilities are concatenated into
the "continuum" UV data set. The continuum dataset becomes the current
UV data. Flagged channels are ignored: this allows to mask channels
containing spectral lines (see UV__FILTER).

If no /RANGE option is defined, all channels are selected.

.ti -4 
2 /INDEX
.ti +4
[CLEAN_\]UV__CONTINUUM Naver [First Last] /INDEX Value [Frequency]

Specify which spectral index to be used when scaling the visibilities
as a function of frequency. 

TO BE IMPLEMENTED:  Frequency, if specified, will be used
as a reference frequency instead of the mean observing frequency.

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__CONTINUUM Naver  /RANGE Min Max TYPE 
  [/INDEX Value [Frequency]]

Indicate that channels between the First and Last
defined by Min Max and Type should be considered to produce
the output continuum UV table. Type can be
CHANNEL, VELOCITY or FREQUENCY.

For type CHANNEL, Min and Max indicate offsets from
Channel 1 and Channel Nchan (the number of channels
in the data set). Thus Max can be negative: it then
indicates Last = Nchan-Max. Also Min=0 and Max=0 implies
all the channels.

.ti -4
1 UV__EXTRACT 
.ti +4
[CLEAN_\]UV__EXTRACT /RANGE Min Max [TYPE]  [/FILE FileIn [FileOut]]

  Extract a subset of all available channels. The command
works on the current UV buffer, unless the /FILE option is
specified

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__EXTRACT /RANGE Min Max [TYPE] /FILE FileIn [FileOut]
  
Extract the specified range from the UV data in the file FileIn, and 
write the resulting visibilities in the file FileOut. If FileOut is not 
specified, "-ext" is appended to the name indicated by FileIn.  

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__EXTRACT /RANGE Min Max [TYPE]  [/FILE FileIn [FileOut]]

Indicate that channels between the First and Last
defined by Min Max and Type contain line emission and should
be filtered out.  Type can be
CHANNEL, VELOCITY or FREQUENCY.

For type CHANNEL, Min and Max indicate offsets from
Channel 1 and Channel Nchan (the number of channels
in the data set). Thus Max can be negative: it then
indicates Last = Nchan-Max. Also Min=0 and Max=0 implies
all the channels.

.ti -4
1 UV__FIELDS
.ti +4
[CLEAN_\]UV__FIELDS RaVar DecVar [Unit] [/CENTER Ra Dec] /FILE File

    Replace fields ID by Fields offsets in a Mosaic UV Table.
This can only work for a Mosaic UV table with Fields offsets,
or Phase center offsets. It cannot operate on a UV table with
Pointing center offsets.

For files imported from UVFITS, the Fields offsets are found in 
the AIPS SU Table which is not decoded by the FITS command, 
but only through the DEFINE FITS command.

The UV__FIELDS command allows to convert the Field IDs column of the UV table
into Phase Offsets columns, and insert the proper coordinates.
Unit specifies the unit of the RaVar and DecVar variables. It
can be DEGREE, MINUTE, SECONDS, RADIAN or ABSOLUTE. 

If ABSOLUTE, RaVar and DecVar are assumed to character variable
arrays handling the Right Ascension
and Declinations of the fields expressed in sexagesimal format.

The typical use is after a DEFINE FITS A File.uvfits command, which gives
the (Ra,Dec) positions of the field centers in Degrees
in A%aips__su%col%raepo and A%aips__su%col%decepo variables:
.nf

    fits File.uvfits to File.uvt
    define fits A File.uvfits
    define double ra dec
    define char*16 cra cdec
    let cra ra /sexag d H
    let cdec dec /sexag d d
    compute ra mean a%aips__su%col%raepo
    compute dec mean a%aips__su%col%decepo
    !
    uv__fields a%aips__su%col%raepo a%aips__su%col%decepo DEGREE -
      /FILE File.uvt /CENTER 'CRa' 'CDec'
    !
.fi
This command is used in the fits__to__uvt.ima script. Note that
a proper use also requires to set the reference coordinate
to Ra and Dec consistently in the UV Table.

.ti -4
2 /CENTER
.ti +4
[CLEAN_\]UV__FIELDS RaVar DecVar [Unit] /CENTER Ra Dec /FILE File

Specify the reference center (Pointing and Phase) of the Mosaic
UV table with Fields ID.  In this case, RaVar and DecVar are
true Ra and Dec (angles in the specified Unit), not Offsets.
The Offsets are computed from the projection information in
the UV table. 

Ra and Dec should be in usual sexagesimal notation.

Without /CENTER, RaVar and DecVar are Offsets from the Phase and
Pointing center of the Mosaic, as given in the UV data header, unless
Unit is ABSOLUTE. 

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__FIELDS RaVar DecVar [Unit] [/CENTER Ra Dec] /FILE File

  Modify the specified File.uvt handling the UV table.
  
If the option is not present, it would instead modify
the current UV data in IMAGER. However, the READ command prevents
to load UV tables that require the action of the UV__FIELDS command,
so in practice, the /FILE option becomes mandatory.

.ti -4
1 UV__FILTER
.ti +4
[CLEAN_\]UV__FILTER [/ZERO] [/CHANNELS Channel__List] 
  [/FREQUENCY List Of Frequencies] [/RANGE Min Max [TYPE]]
  [/VELOCITY List of Velocities] [/WIDTH Width [TYPE]]
  [/FILE FileIn [FileOut]]

"Filter" line emission, by flagging the corresponding channels. The channels
can be specified either by the /FREQUENCY or /VELOCITY options
in combination with the /WIDTH option, or by a channel list with
/CHANNELS or a range (of channels, frequencies or velocities) with
/RANGE.

By default, channels to be filtered are flagged (weights becoming negative).
Option /ZERO can be used to erase them: weights and visibilities are
set to zero, see HELP UV__FILTER /ZERO.

The command works on the current UV data, unless the option /FILE is specified.

With no options (except possibly /FILE and /ZERO), the command behaves as
UV__FILTER /CHANNELS Preview_%Channels. See UV__PREVIEW for details.

.ti -4
2 /CHANNELS
.ti +4
[CLEAN_\]UV__FILTER [/ZERO] /CHANNELS Channel__List

Channel__List must be a 1-D SIC variable containing the list of channels
to filter out.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__FILTER [/ZERO] [/CHANNELS Channel__List]
  [/FREQUENCY List Of Frequencies] [/RANGE Min Max [TYPE]]
  [/VELOCITY List of Velocities] [/WIDTH Width [TYPE]]
  /FILE FileIn [FileOut]
  
Use the UV data in the file FileIn, and write the line-free
visibilities in the file FileOut.  If FileOut is not specified,
"-cont" is appended to the name indicated by FileIn.  

.ti -4
2 /FREQUENCY
.ti +4
[CLEAN_\]UV__FILTER [/ZERO] /FREQUENCY F1 [... [Fn]] [/WIDTH Width]

Specify around which frequencies the line emission should be filtered.
Frequencies F1 to Fn must be in MHz. The full width of the filtering
window around every frequency can be set by option /WIDTH.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

Tip: it can be convenient to have a list of SIC variables containing
the frequencies of the most intense spectral lines, e.g.
.ti +8
HCO10 = 89188.52
.br to be used as argument to the /FREQUENCY option.

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__FILTER [/ZERO] /RANGE Min Max [TYPE]

Indicate that channels between the First and Last
defined by Min Max and Type contain line emission and should
be filtered out.  Type can be
CHANNEL, VELOCITY or FREQUENCY.

For type CHANNEL, Min and Max indicate offsets from
Channel 1 and Channel Nchan (the number of channels
in the data set). Thus Max can be negative: it then
indicates Last = Nchan-Max. Also Min=0 and Max=0 implies
loading all the channels.

.ti -4
2 /VELOCITY
.ti +4
[CLEAN_\]UV__FILTER /VELOCITY V1 [... [Vn]] [/WIDTH Width [TYPE]]

Specify around which velocities the line emission should be filtered.
Velocities V1 to Vn must be in km/s. The full width of the filtering
window around every frequency can be set by option /WIDTH.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

.ti -4
2 /WIDTH
.ti +4
[CLEAN_\]UV__FILTER [/ZERO] /FREQUENCY F1 [... [Fn]] /WIDTH Width [TYPE]

.ti +4
[CLEAN_\]UV__FILTER [/ZERO] /VELOCITY V1 [... [Vn]] /WIDTH Width [TYPE]

Specify the full width of the filtering
window around every frequency given in the /FREQUENCY option or
any velocity given in the /VELOCITY option.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

.ti -4
2 /ZERO
.ti +4
[CLEAN_\]UV__FILTER /ZERO [/CHANNELS Channel__List]
  [/FREQUENCY F1 [... [Fn]] [/VELOCITY V1 [... [Vn]]
  [/RANGE Min Max [TYPE]] [/WIDTH Width [TYPE]]

Erase filtered channels (set weight and visibilities to zero) rather than
simply flagging them (weight set to negative value). This can be more
convenient for further display, but is not reversible.

By default, channels to be filtered are flagged (weights becoming 
negative, and data can be unflagged by UV__FLAG).  Flagged channels are 
ignored in the averaging process, such as UV__RESAMPLE or UV__CONT. 
However, as UV__MAP (in general) uses only one channel to define the 
weights for all others, these flagged channels will nevertheless appear 
in the imaged data cube.

See UV__CHECK for information about handling flagged channels and
different beams in a single UV table.


.ti -4
1 UV__FLAG
.ti +4
[CLEAN_\]UV__FLAG [/ANTENNA Iant] [/DATE ...] [/FILE FileIn [FileOut]] 
  [/RESET]  

Without the /FILE option, display the current UV data and calls the 
cursor to interactively select a region where UV data will be flagged
or unflagged (sign of weight is made negative or positive). The /RESET 
option is used to unflag the data. 

UV data flagged using command UV__FLAG can be saved on file with 
command WRITE UV File. Detailed information about the display control
of the UV data may be found in the SHOW UV help.

See HELP UV__FLAG /FILE for direct operation on a UV data file.

Subsequent mapping with UV__MAP will ignore flagged data. However, for
multi-channel imaging, the weight column is (by default) taken from
one channel, so that channel-based flagging is will not be recognized in the
default mode, but only in the "One Beam per Channel" mode.

.ti -4
2 /ANTENNA
.ti +4
[CLEAN_\]UV__FLAG /ANTENNA Iant [/DATE ...] [/FILE FileIn [FileOut]] 
  [/RESET]  

Restrict the flagging/unflagging to the specified antenna. Only
one antenna at a time can be specified so far. If /ANTENNA is
not present, the action concerns all antennas. 

.ti -4
2 /DATE
.ti -4
[CLEAN_\]UV__FLAG [/ANTENNA Iant] /DATE Date  [/RESET]  
  
Restrict the interactive flagging/unflagging to the specified Date.

.ti -4
[CLEAN_\]UV__FLAG /DATE StartDate [StartUT [EndDate [EndUT]]] 
  /FILE FileIn [FileOut]] [/ANTENNA Iant] [/RESET]  

With the /FILE option, the /DATE option has a more flexible syntax.
It understands any of the following
.nf
  /DATE StartDate                         The whole date is flagged 
                from UT=0 to UT=24 h
  /DATE StartDate EndDate                 The whole range of dates  
                from StartDate to EndDate is flagged
  /DATE StartDate StartUT EndUT           Time range from StartUT
                to EndUT in StartDate is flagged
  /DATE StartDate StartUT EndDare EndUT   Time range from StartUT  
                in StartDate to EndUT in EndDate is flagged
.fi
Date format is DD-MMM-YYYY, and Time is in hours, sexagesimal notation
(hh:mm:ss.ss)  allowed.

.ti -4
2 /FILE
.ti +4 
[CLEAN_\]UV__FLAG /FILE FileIn [FileOut] [/ANTENNA Iant] [/DATE ...]
  [/RESET]  

Flag data found in FileIn, and store the result in FileOut, or in
place if FileOut is not specified.  Note that the UV__FLAG command 
has no memory: it caannot restore the flagging to a previous state, 
but only flag or unflag from the current flag state.

.ti -4
2 /RESET
.ti +4 
[CLEAN_\]UV__FLAG /RESET [/FILE FileIn [FileOut]] [/ANTENNA Iant] [/DATE ...]


Unflag the specified range, instead for flagging it.
Note that the UV__FLAG command has no memory: it cannot restore 
the flagging to a previous state, but only flag or unflag from
the current flag state.

.ti -4
2 CHANNEL

Channel range to be flagged/unflagged.

.ti -4
1 UV__MAP
.ti +4
[CLEAN_\]UV__MAP [CenterX CenterY Unit] [ANGLE AngleValue] 
[/FIELDS FieldList] [/TRUNCATE Percent] [/RANGE Min Max Type]
[/CONT [Naver]] [/INDEX Alpha]

Compute a dirty map and beam from a UV data. UV data must have been loaded
from a UV table by command "READ UV File". UV__MAP processes
single fields as well as Mosaics.

The user can control the algorithm through SIC variables. New values 
can be given using "LET VARIABLE value". For ease of use, and whenever 
it is possible, a sensible value of each parameter will automatically 
be computed from the context if the value of the corresponding variable 
is set to its default value, i.e. zero value and empty string. A few 
variables are initialized to "reasonable" values.

The arguments define the Map center and orientation (Projection system).
Unit can be any of DEGREE, MINUTE, SECOND and RADIAN, or ABSOLUTE.
In the latter case, CenterX should be the Right Ascension and CenterY
the Declination in sexagesimal notation. Otherwise, they are offsets
from the current projection center in the specified Unit. 

AngleValue is the ** absolute ** rotation of the projection (counted East 
from North as usual), which means the angle between the Celestial North
and the Y axis in the resulting image. 

If no argument is given, UV__MAP uses the variable MAP__CENTER to
derive the projection system. If it is empty, it does not change it.

.ti +4
[CLEAN_\]UV__MAP ?
.br 
Will list all MAP__* variables controlling the UV__MAP parameters

.ti -4 
2 Mosaics
.ti +4
[CLEAN_\]UV__MAP [[CenterX CenterY Unit] [ANGLE AngleValue]
  /FIELDS FieldList [/TRUNCATE Percent]

The UV data can be a Mosaic UV table. In this case, UV__MAP will image
the Mosaic, using appropriate primary beam size and truncation level.

By default, the primary beam size is taken from the telescope parameters, either as
found in the telescope section of the UV table and the observing frequency
(e.g. for ALMA it uses 1.13 Lambda/D). If absent, the telescope section
information can be added by command SPECIFY TELESCOPE.  

The truncation level for individual pointings is taken from variable 
MAP__TRUNCATE or from the /TRUNCATE option argument. It should be 0 for 
high dynamic range. Non zero values may be used with caution in case of 
large pointing errors.

.ti -4
2 /CONT
.ti +4
[CLEAN_\]UV__MAP [CenterX CenterY Unit] [ANGLE AngleValue]
/CONT [Naver] [/INDEX Alpha] [/RANGE Min Max Type]

Produce a Continuum image (from all channels, or those
selected  by the specified Velocity, Frequency or Channel range (depending
on Type) between Min Max when the option /RANGE is present), using
a Multi-Frequency Synthesis, where (u,v) coordinates are scaled
with Frequencies to produce an optimal beam. 

  Naver is the number
of initial channels that will share the same (u,v) coordinates. If
not present, it is computed from MAP__FIELD and MAP__CELL to
limit bandwidth smearing.

In essence, UV__MAP /CONT behaves as the combination of
UV__CONTINUUM  followed by UV__MAP, but the pseudo-continuum
UV Table created by UV__CONTINUUM is not kept by UV__MAP /CONT.

A spectral index can be specified using option /INDEX.

.ti -4
2 /FIELDS
.ti +4
[CLEAN_\]UV__MAP [CenterX CenterY Unit] [ANGLE AngleValue]
  /FIELDS FieldList [/TRUNCATE Percent]

For a Mosaic, only image the fields specified in a 1-D Integer variable
FieldList, or in the explicit list given as argument to the /FIELDS
option.  SHOW FIELDS will highlight the list of fields selected
 by this command.

.ti -4
2 /INDEX
.ti +4
[CLEAN_\]UV__MAP [CenterX CenterY Unit] [ANGLE AngleValue]
/CONT [Naver] /INDEX Alpha [/RANGE Min Max Type]

Specify the spectral index to be used for Continuum imaging
using a Multi-Frequency Synthesis method. This option is only
valid with the /CONT option.

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__MAP [CenterX CenterY Unit] [ANGLE AngleValue]
  /RANGE Min Max Type [/FIELDS FieldList] [/TRUNCATE Percent] 
  [/CONT [Naver]] [/INDEX Alpha]

Indicate that only channels between the First and Last
defined by Min Max and Type should be considered to produce
the image. Type can be CHANNEL, VELOCITY or FREQUENCY.

For type CHANNEL, Min and Max indicate offsets from Channel 1 and 
Channel Nchan (the number of channels in the data set). Thus Max can be 
negative: it then indicates Last = Nchan-Max. Also Min=0 and Max=0 
implies all the channels.

This is a more convenient replacement of the deprecated MCOL variable.
.ti -4 
2 /TRUNCATE
.ti +4
[CLEAN_\]UV__MAP [CenterX CenterY Unit] [ANGLE AngleValue] 
  /FIELDS FieldList /TRUNCATE Percent

For a Mosaic, truncate the individual pointings to the specified level
(in percent). The default is to use MAP__TRUNCATE.

.ti -4 
2 Variables:
.ti +4
        [CLEAN\]UV__MAP ?
.br
    Will list all MAP__* variables controlling the UV__MAP parameters.
.br
.so imager-help-clean-uvmap-list.nroff

See HELP UV__MAP Old__names:  for deprecated variable names.

.so imager-help-clean-uvmap-desc.nroff

.ti -4
1 UV__RESAMPLE
.ti +4
[CLEAN_\]UV__RESAMPLE [Nc Ref Val Inc] [/FILE FileIn FileOut] [/LIKE Mold]

With no option, resample the UV data loaded by READ UV on a different 
velocity scale.  All other UV commands except UV__COMPRESS work on the 
"Resampled" UV table. The output spectral sampling is defined by
.nf
     Nc   new number of channels
     Ref  New reference pixel
     Val  New velocity at reference pixel
     Inc  Velocity increment
.fi
Any argument can be set to * for an automatic determination based on
the values of the other arguments. The automatic determination of
NC preserves the velocity coverage.

The "Resampled" UV table is a simple copy of the original one after a READ UV
command, or after a UV__RESAMPLE or UV__COMPRESS command without arguments.

With the /FILE option, the internal buffers are not used: the UV data 
is read from file FileIn and the resampled output is written in file 
FileOut. In this case, the /LIKE option can be used to define
the spectral sampling as identical to the Mold file.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__RESAMPLE [Nc Ref Val Inc] /FILE FileIn FileOut [/LIKE Mold]
  
Use the UV data in the file FileIn, and write the spectrally resampled
UV data in the file FileOut.  

In this case, the /LIKE option can be used to define the spectral sampling 
as identical to the Mold file, instead of specifying it as arguments
to the command.


.ti -4
2 /LIKE
.ti +4
[CLEAN_\]UV__RESAMPLE  /FILE FileIn FileOut /LIKE Mold
  
Use the UV data in the file FileIn, and write the spectrally resampled
UV data in the file FileOut.  The resampled FileOut will spectrally
conform the Mold UV table specified in the /LIKE argument.


.ti -4
1 UV__RESIDUAL
.ti +4
[CLEAN_\]UV__RESIDUAL [MODE] [Arg1 ... ArgN] [/FIELDS List]

  This command subtract Clean components OR fit results from the last UV__FIT
command, depending on specified argument MODE if present (can be CLEAN or UV__FIT), or
on whether CLEAN (or its specialized versions HOGBOM, CLARK,
etc...) or UV__FIT was done last if not. The residual UV data are available
in SIC structure UV__RESIDUAL, and can be written by WRITE UV__RESIDUAL command.

  The UV__RESIDUAL data can also be selected for further imaging by UV__MAP
(and thus UV__RESTORE) or displayed by SHOW UV using command 
UV__SELECT.  MODEL and UV__RESIDUAL are complementary commands 
(UV__DATA = UV__MODEL + UV__RESIDUAL); see HELP UV__RESIDUAL Note however.

For the Clean component the syntax is
.ti +4
[CLEAN_\]UV__RESIDUAL [CLEAN] [Niter]
.br
that subtracts the Niter first (default all) Clean Components from the UV data.

For the UV__FIT results, Clean component the syntax is
.ti +4
[CLEAN_\]UV__RESIDUAL [UV__FIT] [F1 .. Fn]
.br
that subtracts the F1 to Fn fitted functions (default all) from the UV data.

.ti -4
2 Note
.ti +4

  UV__RESIDUAL does not yet have the /MINVAL option of command MODEL.

.ti -4
1 UV__RESTORE
.ti +4
[CLEAN_\]UV__RESTORE [/COPY] [/SPEED Mode]

Create a Clean image from the current UV data set and the Clean Component list.
The Clean Components are subtracted from the UV data set, and these residuals
are gridded and Fourier transformed to compute the Residual image. This
Residual image is added to the Gaussian beam convolved image of the sum of
Clean components. The results are similar to those of MX, since only the
residual are aliased.

This command can be used with all methods (HOGBOM, CLARK, MULTI, SDI)
except for MRC which has no notion of Clean Components.

.ti -4
2 /COPY
.ti +4
[CLEAN_\]UV__RESTORE /COPY [/SPEED Mode]

--- Obsolescent ---  Reserved for debugging ---

The /COPY option controls whether array copys or pointers are used
for some internal buffers. The option may be removed without further
notice.

.ti -4
2 /SPEED
.ti +4
[CLEAN_\]UV__RESTORE /SPEED Mode [/COPY]

Create a Clean image from the current UV data set and the Clean Component list,
using the specified Mode to remove the Clean Components before
imaging the residuals.

The argument Mode may be one of the following keyword:
.nf
AUTO    Automatically select the "fastest" method, according to the
      current number of Visibilities and Clean components.
FFT     Subtract Clean Components by FFT and interpolation onto 
      individual visibilities. 
PRECIS  Subtract the Clean Components by simple Sin/Cos phase terms
      for each visibility
.fi
The PRECIS mode is faster for a small number of visibilities and Clean 
components, while the FFT mode is faster for large ones. 

Instead of the above keywords, Mode may also be a number which 
specifies when the AUTO mode should switch from PRECIS mode to FFT 
mode.   The default number to control the AUTO mode is 200 Millions 
(product of the number of visibilities and average number of Clean 
components per channel). This value is "sticky": if changed by /SPEED, 
the new values is retained until next change.


.ti -4
1 UV__REWEIGHT
.ti +4
[CLEAN_\]UV__REWEIGHT MODE [Args...] [/RANGE Min Max Type] 
  [/FLAG Threshold]

Compute and/or Apply a scale factor to the weights of the current
UV data. Can be used to patch e.g. JVLA data files which may
have only relative weights, not absolute values indicating the
noise.

MODE can be APPLY, DO, ESTIMATE or TIME.

.ti -4
2 APPLY
.ti +4
[CLEAN_\]UV__REWEIGHT APPLY Factor

Apply the specified scale Factor to the weights. Factor can be *
to used the last derived scale factor from command UV__REWEIGHT ESTIMATE.
This factor is set to 1.0 by command UV__REWEIGHT APPLY, so that
repetitive use of the APPLY * mode no longer affects the data.

.ti -4
2 DO
.ti +4
[CLEAN_\]UV__REWEIGHT DO [Tolerance [Printout]] [/RANGE Min Max Type] 
  [/FLAG Threshold]

Derive the scale factor from the noise statistics over the channels,
and use it to rescale the weights.
The noise statistic is derived from the real and imaginary parts 
separately, taking mean value,  or the minimum of the twos when the
mean/min ratio is smaller than specified Tolerance (default is 1.2).

The /FLAG option indicates whether data with highly deviating weights
should be flagged. UV__REWEIGHT DO combines the two actions of 
UV__REWEIGHT ESTIMATE (or TIME) and UV__REWEIGHT APPLY, but with a 
control over these outliers (that are not identified by APPLY).

Mode DO uses the ESTIMATE method if the number of channels is > 16,
the TIME method if not.

Printout is a number indicating to print some correction factors
every Printout visibility (no print if 0, the default) (for ESTIMATE
method only).

.ti -4
2 ESTIMATE
.ti +4
[CLEAN_\]UV__REWEIGHT ESTIMATE [Tolerance [Printout]] [/RANGE Min Max Type] 

Derive the scale factor from the noise statistics derived from
the rms individual visibilities over the specified channels.
The noise statistic is derived from the real and imaginary parts 
separately, taking mean value,  or the minimum of the twos when the
mean/min ratio is smaller than specified Tolerance (default is 1.2).

Printout is a number indicating to print some correction factors
every Printout visibility (no print if 0, the default).

.ti -4
2 TIME
.ti +4
[CLEAN_\]UV__REWEIGHT TIME [Tolerance] [/RANGE Min Max Type] 

Derive the scale factor from the noise statistics derived from
consecutive visibilities, considering the specified channel range.
The noise statistic is derived from the real and imaginary parts 
separately, taking mean value,  or the minimum of the twos when the
mean/min ratio is smaller than specified Tolerance (default is 1.2).

The UV data is first baseline-time sorted to ensure that all UV data points
of the UV track for any antenna pair are consecutive. 


.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__REWEIGHT DO|ESTIMATE|TIME [Tolerance [Printout]] [/FLAG Threshold]
  /RANGE Min Max [Min Max [...]] Type
  
Specify the spectral range(s) defining the channels to use in the
noise estimates. More than 1 range can be specified if the Mode is not TIME.

/RANGE can not be used with keyword APPLY.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__REWEIGHT DO|ESTIMATE|TIME [Tolerance [Printout]] [/FLAG Threshold]
  /RANGE Min Max [Min Max [...]] Type

.ti -4
2 /FLAG
.ti +4
[CLEAN_\]UV__REWEIGHT DO [Tolerance [Printout]] /FLAG Threshold
  [/RANGE Min Max Type] 
  
The /FLAG option indicates whether data with highly deviating weights
should be flagged. UV__REWEIGHT DO combines the two actions of 
UV__REWEIGHT ESTIMATE and UV__REWEIGHT APPLY, but with a 
control over these outliers (that are not identified by APPLY).

Default Threshold is 3, i.e. data are considered as outliers
if their re-scale factor is more than 3 times above (or below)
the median value.  This is adequate to spot bad data.

/FLAG is only valid for keyword DO.

.ti -4
1 UV__SHIFT
.ti +4
[CLEAN_\]UV__SHIFT  [CenterX CenterY UNIT] [ANGLE Angle] [/FILE FileInOut]

Shift the current (if no /FILE option is present) or specified
(if the /FILE option is here) UV table (single field or mosaic) to a common phase 
center and/or rotate it.

Angle is desired position angle of the Celestial North from the Y axis
(counted positive towards East, i.e. counter-clockwise in usual
astronomical images), in Degree. It is thus an absolute value.

If UNIT is ABSOLUTE, CenterX and CenterY are absolute coordinates
in usual sexagesimal notation.

If not, CenterX and CenterY are offsets in the specified angular unit
(SECOND, MINUTE, DEGREE or RADIAN).



Although UV__MAP also provides a direct possibility to re-center the 
image on a specified projection (phase) center cmobined with a
rotation of the main axes, the modified 
visibilities cannot be saved on file. It is sometimes required to do 
this for specific use. UV__SHIFT provides this possibility, and the 
shifted UV table can be written using command WRITE UV.

UV__DEPROJECT includes the UV__SHIFT capabilities, but
also has additional functions, and a different syntax.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__SHIFT  [CenterX CenterY UNIT] [ANGLE Angle] /FILE FileInOut

Shift and/or rotate the UV table specified in the /FILE option 
(single field or mosaic) to a common phase center and given orientation. 

Warning: Rotated Mosaics cannot yet be saved. IRAM has not decided
upon a convention for storing this information.

.ti -4 
1 UV__SMOOTH
.ti +4
[CLEAN_\]UV__SMOOTH Nc [/ASYMMETRIC] [/FILE FileIn FileOut]


Smooth by NC channels a UV data set. UV__SMOOTH differs from UV__COMPRESS 
because it keeps the original spectral sampling. The resulting UV data is 
thus oversampled by NC channels.

Unless the /ASYMMETRIC option is present, the smoothing is symmetric,
to ensure that the spectral sampling is preserved. This is implicit when
Nc is odd, but for even values of Nc, it is done by smoothing by Nc+1 channels, 
and giving the edge channels of the smoothing kernel a half-weight. The effective 
bandwidth of each smoothed channel is still Nc times the original one.

As a result, UV__SMOOTH 2 is equivalent to a Hanning smoothing.

With no /FILE option, the current UV table obtained by READ UV is resampled.
All further UV commands work on the "Resampled" UV table.
The "Resampled" UV table is a simple copy of the original one after a READ UV
command, or after a UV__RESAMPLE or UV__COMPRESS commands with
no arguments and no options.

With the /FILE option, the UV data is read from file FileIn and the resampled
output is written in file FileOut.

.ti -4
2 /ASYMMETRIC
.ti +4 
[CLEAN_\]UV__SMOOTH Nc /ASYMMETRIC [/FILE FileIn FileOut]

Make no attempt to preserve the spectral sampling when Nc is even: the 
reference channel is then shifted by half the channel spacing.

For odd Nc, the smoothing is naturally symmetric, so the option has no impact.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__SMOOTH Nc  /FILE FileIn FileOut [/ASYMMETRIC]
  
Read the UV data in the file FileIn, and write the data after
averaging by NC adjacent channels in the file FileOut.  



.ti -4
1 UV__SPLIT
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
  [/CHANNELS Channel__List] 
  [/FREQUENCY List Of Frequencies] [/RANGE Min Max [TYPE]]
  [/VELOCITY List of Velocities] [/WIDTH Width [TYPE]]

"Split" the UV table found in file FileIn into a Continuum-free one 
(FileLine) and a Line-free continuum one (FileCont), using the ranges
specified by one of the other options to indicate where the line
emission is (see UV__BASELINE and UV__FILTER for details). 
The channels can be specified either by the /FREQUENCY or /VELOCITY 
options in combination with the /WIDTH option, or by a channel list 
with /CHANNELS or a range (of channels, frequencies or velocities) with 
/RANGE.

Degree is the baseline fit degree (0 or at most 1).
Compress is the number of line channels averaged together while producing
the pure continuum (Line-free) visibilities. 

The command only works with files: option /FILE is mandatory.

With only /FILE as option, the command behaves as
UV__SPLIT /FILE FileIn [FileLine [FileCont]] /CHANNELS Preview%Channels. 
See UV__PREVIEW for details about Preview%Channels.

.ti -4
2 /CHANNELS
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
  /CHANNELS Channel__List

Channel__List must be a 1-D SIC variable containing the list of channels
where line emission is assumed to be.

.ti -4
2 /FILE
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
  [/FREQUENCY List Of Frequencies] [/RANGE Min Max [TYPE]]
  [/VELOCITY List of Velocities] [/WIDTH Width [TYPE]]
  /FILE FileIn [FileOut]
  
Use the UV data in the file FileIn, and write the continuum-free
visibilities in the file FileLine, and the line-free visibilities in
FileCont. If not specified, FileLine (resp FileCont) is derived
from FileIn by appending "-line" (resp "-cont") to the filename.

.ti -4
2 /FREQUENCY
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
    /FREQUENCY F1 [... [Fn]] [/WIDTH Width]

Specify around which frequencies the line emission should be found.
Frequencies F1 to Fn must be in MHz. The full width of the 
window around every frequency can be set by option /WIDTH.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

Tip: it can be convenient to have a list of SIC variables containing
the frequencies of the most intense spectral lines, e.g.
.ti +8
HCO10 = 89188.52
.br to be used as argument to the /FREQUENCY option.

.ti -4
2 /RANGE
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
    /RANGE Min Max [TYPE]

Indicate that channels between the First and Last
defined by Min Max and Type contain line emission.
Type can be
CHANNEL, VELOCITY or FREQUENCY.

For type CHANNEL, Min and Max indicate offsets from
Channel 1 and Channel Nchan (the number of channels
in the data set). Thus Max can be negative: it then
indicates Last = Nchan-Max. Also Min=0 and Max=0 implies
loading all the channels.

.ti -4
2 /VELOCITY
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
  /VELOCITY V1 [... [Vn]] [/WIDTH Width [TYPE]]

Specify around which velocities the line emission should be found. 
Velocities V1 to Vn must be in km/s. The full width of the 
window around every frequency can be set by option /WIDTH.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.

.ti -4
2 /WIDTH
.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
  /FREQUENCY F1 [... [Fn]] /WIDTH Width [TYPE]

.ti +4
[CLEAN_\]UV__SPLIT [Degree [Compress]] /FILE FileIn [FileLine [FileCont]]
  /VELOCITY V1 [... [Vn]] /WIDTH Width [TYPE]

Specify the full width of the window around every frequency given in 
the /FREQUENCY option or any velocity given in the /VELOCITY option.
The optional argument TYPE indicates the type of width: FREQUENCY
(in MHz), VELOCITY (in km/s) or CHANNEL (no unit), the default
being FREQUENCY.  The default width is the current channel width.


.ti -4
1 UV__STAT
.ti +4
[CLEAN_\]UV__STAT Mode [Step Start]

UV__STAT allows the astronomer to select the best weighting
and imaging parameters according to its personal trade off between
angular resolution, sensitivity and field of view.

Argument Mode describes the action. Default is ALL, equivalent to 
HEADER+ADVISE. See HELP UV__STAT Argument for details.

.ti -4
2 Casa
.ti +4

CASA and GILDAS handle the weighting scheme slightly differently and
with different conventions for the Robust parameter values.

CASA uses only Briggs weighting, while IMAGER offers the Briggs
weighting scheme (obtained for MAP__ROBUST < 0) and a different,
more progressive, weighting (obtained for MAP__ROBUST > 0).

For MAP__ROBUST < 0, the corresponding CASA Briggs value can be obtained
by adding 2. 

In addition, CASA apparently uses a default value for the size of
the UV cell in Briggs weighting which is about the dish diameter(*).
If MAP__UVCELL is 0, IMAGER will use the same default value.
Otherwise, IMAGER will use the specified user input.

(*) This default value quoted before is valid for a single field. 
However, the documentation is unclear in this respect and suggests that
the UV cell size depends on the imaged field size. This would 
be strange, though. What happens for mosaics is even less clear.

.ti -4
2 Mosaics
.ti +4

UV__STAT handles Mosaic like Single-Field for the weighting (BEAM, BRIGGS,
TAPER and WEIGHT arguments): all
visibilities are considered, instead of those of just one among the
various fields.  Accordingly, the predicted beam sizes are often
underestimated compared to what UV__MAP and FIT commands would yield.

For a fine adjustment of the beam shape and size, it is recommended
to verify using UV__MAP and FIT commands and iterate if needed. 

.ti -4 
2 Arguments:
.ti +4
[CLEAN_\]UV__STAT Mode [Step Start]

Argument Mode describes the action. Possible values are 
.nf
ADVISE     Suggest values for Map size, Map field and Pixel size
ALL        As HEADER + ADVISE
BEAM       Evaluate (and optionally display) the synthesized beam
BRIGGS     Estimate beam size as function of Briggs robust parameter
CELL       Estimate beam size as function of UV cell size
DEFAULT    Reset UV__MAP parameters to Default values
HEADER     Display detailed UV header
RESET      Reset UV__MAP parameters to previous Values
SETUP      Take suggested values for Map size, Map field and Pixel size
TAPER      Estimate beam size as function of UV Taper 
WEIGHT     Estimate beam size as function of Gildas robust parameter
.fi

The default value is ALL, which makes the same action as HEADER + ADVISE
combined.

.ti -4
2 ADVISE
.ti +4

[CLEAN_\]UV__STAT ADVISE

  Display the recommended image and pixel sizes, independently of the 
current values of MAP__FIELD, MAP__SIZE and MAP__CELL. 

.ti -4
2 ALL
.ti +4

[CLEAN_\]UV__STAT ALL

  Display the UV header and a few more associated values, like the
recommended image and pixel sizes. Equivalent to HEADER + ADVISE 

.ti -4
2 BEAM
.ti +4

[CLEAN_\]UV__STAT BEAM [Show]

  Evaluate the expected synthesized beam size and orientation, based
on current imaging parameters MAP__UVCELL, MAP__ROBUST, MAP__UVTAPER.

  If argument Show is present, the synthesized beam is also displayed.
A fast gridding is used for this command to minimize computing time, 
so the actual synthesized beam produced by UV__MAP will be (very 
slightly) different. This does not significantly affect the beam size.

.ti -4
2 BRIGGS
.ti +4

[CLEAN_\]UV__STAT BRIGGS  [Step Start]


Beam sizes and noise level (in flux and brightness) will be
computed for 9 different "robust" weighting parameters using
the Briggs method.  The Briggs parameters range from
-4 (nearly uniform weighting) to 0 (natural weighting) (values
are shifted by -2 compared to the Briggs parameters in CASA).
The taper is taken from variable UV__TAPER.
The UV cell size is specified by MAP__UVCELL in m.

See HELP UV__STAT Casa for details about Briggs parameter vs Robust
parameter.

.ti -4
2 CELL
.ti +4
[CLEAN_\]UV__STAT CELL [Step Start]

Predict the synthesized beam, expected noise level, and recommended pixel
size for different values of  the uv cell size for current robust
weighting and taper parameters. 

.ti -4
2 DEFAULT
.ti +4
[CLEAN_\]UV__STAT DEFAULT

Reset MAP__SIZE, MAP__CELL, MAP__FIELD and MAP__UVCELL to their Default 
values (all 0). Robust parameter and Tapers are not changed. Command
UV__STAT RESET does a slightly different job.

.ti -4
2 HEADER
.ti +4
[CLEAN_\]UV__STAT HEADER

Display a brief summary of the UV data: number of antennas,
observing dates, baseline ranges,  spectroscopic information.

.ti -4
2 RESET
.ti +4
[CLEAN_\]UV__STAT RESET 

  Reset MAP__SIZE, MAP__FIELD and MAP__CELL to their previous values
after a UV__STAT SETUP. This is different from the UV__STAT DEFAULT
command.

.ti -4
2 SETUP
.ti +4
[CLEAN_\]UV__STAT SETUP

Compute the recommended values for the imaging: image size,
pixel size, field of view, largest angular scale, etc...,
and set the corresponding MAP__variables (MAP__SIZE, MAP__FIELD
and MAP__CELL) to these values if they were not previously
specified.

.ti -4
2 TAPER
.ti +4
[CLEAN_\]UV__STAT TAPER [Step Start]

For TAPER, beam sizes and noise level (in flux and brightness) will be
computed for 9 different tapers (from Start to Start*Step^9).
Default value for Step is sqrt(2), Default value for Start
is 50 m. Weighting mode, UV cell size and "robust" parameter
are taken from variable MAP__UVCELL and MAP__ROBUST (i.e. one can combine
Robust weighting and Tapering).

.ti -4
2 WEIGHT
.ti +4
[CLEAN_\]UV__STAT WEIGHT [Step Start]

For WEIGHT, beam sizes and noise level (in flux and brightness) will be
computed for 9 different "robust" weighting parameters (from Start to
Start*Step^9). Default value for Step is sqrt(10), and default value
for Start is derived to center the "robust" parameter values around 1.
UV cell size is taken from variable MAP__UVCELL, and Taper is taken
from variable UV__TAPER.

.ti -4
1 UV__TIME
.ti +4
[CLEAN]UV__TIME [?|Time] [/Weight Wcol] [/FILE FileIn]

Average in time the current UV data set to reduce the number of visibilities.
Time must be in seconds. If not specified, an automatic guess
is performed based on Nyquist criterium using the 
antenna size and baseline lengths.

With a ? as argument, return the longest reasonable time.
This time depends on the field of view (that can be controlled by
MAP__FIELD) and the requested precision (controlled by MAP__PRECIS).
It is also limited by the UV cell size for beam forming (MAP__UVCELL).

.ti -4
2 /WEIGHT
.ti +4
[CLEAN]UV__TIME Time /WEIGHT Wcol

Select the weight column. Default is 0.

.ti -4
2 /FILE
.ti +4
[CLEAN]UV__TIME [?|Time] /FILE FileIn [FileOut] [/Weight Wcol]

Work on the specified input (FileIn) and ouput (FileOut) for
the time compression instead of the UV buffer. FileIn must exists.

.ti -4
1 UV__TRIM
.ti +4
[CLEAN\]UV__TRIM Action [/FILE FileIn [FileOut]]

  Trim the UV data of useless information, according to the Action keyword.
Action can be
.nf
ANY      Remove visibilities that have at least one channel flagged
FLAG     Remove visibilities where all channels at flagged
TRAIL    Remove trailing columns
.fi
  
  The command works on the current UV data set, unless the /FILE option
is present.

.ti -4
2 /FILE
.ti +4
[CLEAN]UV__TRIM Action /FILE FileIn [FileOut] 

  Trim the UV data of useless information, according to the Action keyword.
The UV data is taken from file FileIn and written on FileOut (default:
overwrite FileIn).

.ti -4
1 UV__TRUNCATE
.ti +4
[CLEAN]UV__TRUNCATE Max [Min]

Truncate the UV data, by removing baselines out of
the specified range Min (default 0) and Max (in meter).


.ti -4
1 WRITE
.ti +4
[CLEAN_\]WRITE Name File [Format] [/APPEND] [/RANGE Start End Kind] [/REPLACE] [/TRIM [Any]]

WRITE the buffer specified by Name (UV, CGAINS, and BEAM, PRIMARY, DIRTY, CLEAN, RESIDUAL,
SUPPORT, CCT, SKY) onto a File. Default extensions are .uvt for UV and CGAINS
and .beam, .lmv, .lobe, .lmv-clean, .lmv-res, .pol, .cct, and lmv-sky respectively
for the next ones. If Name does not refer to a known buffer, but to a
SIC Image variable, this variable is written. The default extension is then .gdf.

Format is an optional argument indicating the output file data format. It can take
the value GILDAS (the default) or FITS. FITS format is allowed for UV data and
images, but not for tables like the Clean Component, or self-calibration results.
Options /APPEND and /REPLACE are not useable for FITS format.

For UV data, the flagged data are written by default. They may
be omitted using the /TRIM option.

WRITE * File can be used to write all modified image-like buffers (not the
UV tables) under a common File name. This typically include .beam, .lmv 
and .lmv-clean, but also the .lmv-sky file if the PRIMARY command has been
used after deconvolution.


Options /APPEND and /REPLACE are mutually exclusive, and in general
used with the /RANGE option.

.ti -4
2 Format
.ti +4
[CLEAN_\]WRITE Name File FITS|GILDAS [/RANGE Start End Kind] [/TRIM [Any]]

The 3rd argument of the WRITE command is an optional keyword indicating the output file 
data format. It can take the value GILDAS (the default) or FITS. 

FITS format is allowed for UV data and Images (n-D hypercubes), but not for Tables 
like the Clean Component Tables, or self-calibration results.

Options /APPEND and /REPLACE are not useable for FITS format.

.ti -4 
2 /RANGE
.ti +4
[CLEAN_\]WRITE Buffer File [Format] /RANGE Start End Kind [/APPEND] [/REPLACE]

A range of planes can be specified through /RANGE option. Kind
is the unit of the Start-End values: CHANNEL, VELOCITY, or FREQUENCY.
This is also possible for UV data, except for FITS output format.

The Buffer name must be specified (* is not valid here). 


.ti -4
2 /APPEND
.ti +4 
[CLEAN_\]WRITE Buffer File /APPEND [/RANGE Start End Kind] 

The selected channels are appended to an existing file. 

This is not valid for UV tables, neither for FITS output format.

The Buffer name must be specified (* is not valid here). 

.ti -4
2 /REPLACE
.ti +4 
[CLEAN_\]WRITE Buffer File /REPLACE [/RANGE Start End Kind] 

The selected channels are replaced in an existing file. 

This is not valid for UV tables, neither for FITS output format.

The Buffer name must be specified (* is not valid here).

.ti -4
2 /TRIM
.ti +4
[CLEAN_\]WRITE UV File /TRIM [ANY]

Remove the flagged visibilities while writing. A visibility
is declared "flagged" if all channels in it are flagged, unless
the keyword ANY is present. In this later case, if a single
channel is flagged, the whole visibility is declared flagged.

.ti -4
1 ENDOFHELP
