#### Implementation

In IMAGER, the variants of the CLEAN algorithms discussed above are coded as the following commands: HOGBOM, CLARK, MX, SDI, MULTI and MRC. All those commands work on two internal buffers containing the dirty beam and dirty image. Both buffers are created directly from uv table through the UV_MAP command, or they can be loaded from files through the READ BEAM and READ DIRTY commands. The behavior of those commands is controlled through the following common SIC variables:

Iterative search
  CLEAN_POSITIVE
    Number of positive clean components to be found before enabling the search for negative components. Default is 0.
  CLEAN_GAIN
    Loop gain. Default is 0.2, good compromise between stability and speed.

Stopping criteria
  CLEAN_STOP
    Compact way to specify the stopping criterium. Defaut is currently empty, but might be set to 2 SIGMA as a good general default.
  CLEAN_NITER
    Maximum number of clean components. Default is 0.
  CLEAN_FRES
    Maximum amplitude of the absolute value of the residual image. This maximum is expressed as a fraction of the peak intensity of the dirty image. Default value is 0.
  CLEAN_ARES
    Maximum amplitude of the absolute value of the residual image. This maximum is expressed in the image units (Jy/Beam). Default value is 0.
  CLEAN_NKEEP
    Minimum number of Clean components be- fore testing if Cleaning has converged. Default value is 70.

Support
  BLC and TRC
    Bottom Left Corner and Top Right Corner of a square support in pixel units. Default is 0, which means using only the inner quarter if no other support is defined.
  SUPPORT
    A command that defines the support where to search for clean components. The support can be a Mask, or a Polygon. For a Polygon, the definition can be interactive, using the GREG cursor. This definition can be stored in a file through the WRITE SUPPORT command and read back in memory from the file with the SUPPORT command. The polygon support definition is stored in the SUPPORT% structure. Command SUPPORT /MASK instructs IMAGER to use the Mask instead of the polygon for the Clean support.
  MASK
    Command MASK is used to define a Mask-like support. This can be interactive, or automatic using a thresholding technique in command MASK THRESHOLD. The computed Mask can be saved by command WRITE MASK. The Mask can also be read by command READ MASK. Command MASK USE is equivalent to command SUPPORT /MASK, and instructs IMAGER to use the Mask instead of the polygon for the Clean support.

Clean beam parameters
  BEAM_SIZE
    is a 3-element array that gives the FWHM size of the major and minor axes (in arcsec) and position angle (in degree) of the Gaussian used to restore the clean image from the clean component list. Default is all parameters at 0, meaning use the fit of the main lobe of the dirty image. Changing the default value of those parameters is dangerous. The beam size effectively used is available in BEAM_FITTED.

Other variables control specific aspects of a subclass of the CLEAN algorithm:

CLEAN_NCYCLE
  Maximum number of major cycles in all algorithms using this notion ( CLARK, MX, SDI). Default is 50.
BEAM_PATCH
  Size (in pixel units) of the dirty beam used to deconvolve the residual image in minor cycles. It is used in CLARK and MRC algorithms only. Default value is 0. This is for development only.
CLEAN_SMOOTH
  Smoothing factor between different scales in the MULTISCALE methods. Default value is sqrt(3).
CLEAN_RATIO
  Smoothing factor between different scales in the MRC method. Default value is 0, for which the code automatically derives the best power of 2 adequate for the current problem.