NRAO Home > CASA > CASA Cookbook and User Reference Manual

5.3 Deconvolution using CLEAN (clean)

To create an image and then deconvolve it with the CLEAN algorithm, use the clean task. This task will work for single-field data, or for multi-field mosaics (§ 5.3.15), in both narrow and wide-field imaging modes. ALERT: There is now an experimental feature to image data taken with “heterogeneous” arrays with non-identical dish sizes (§ 5.3.16).

Toolkit Note: MEM is not included in clean, but is available in the toolkit.

clean will use the CORRECTED_DATA column from your measurement set if it exists. If that column is not available, it will use DATA. The clean task utilizes many of the common imaging parameters. These are described above in § 5.2. There are also a number of parameters specific to clean. These are listed and described below.

The default inputs to clean are:

#  clean :: Deconvolve an image with selected algorithm  
vis                 =         ’’   #  name of input visibility file  
imagename           =       [’’]   #  Pre-name of output images  
outlierfile         =         ’’   #  Text file with image names, sizes, centers  
field               =         ’’   #  Field Name  
spw                 =         ’’   #  Spectral windows:channels: ’’ is all  
selectdata          =      False   #  Other data selection parameters  
mode                =      ’mfs’   #   Type of selection (mfs, channel, velocity,frequency)  
     nterms         =          1   #  Number of taylor terms to use for modeling the sky frequency dependence  
     reffreq        =         ’’   #  Reference frequency for MFS (relevant only if nterms > 1)  
 
gridmode            =         ’’   #  The kind gridding kernel to be used for FFT-based transforms  
niter               =        500   #  Maximum number of iterations  
gain                =        0.1   #  Loop gain for cleaning  
threshold           =   ’0.0mJy’   #  Flux level to stop cleaning.  Must include units  
psfmode             =    ’clark’   #  method of PSF calculation to use during minor cycles  
imagermode          =         ’’   #   Use csclean or mosaic.  If ’’, use psfmode  
multiscale          =         []   #  deconvolution scales (pixels); [] = default standard clean  
interactive         =      False   #  use interactive clean (with GUI viewer)  
mask                =         []   #  cleanbox(es), mask image(s), and/or region(s)  used in cleaning  
imsize              = [256, 256]   #  x and y image size in pixels, symmetric for single value  
cell                = [’1.0arcsec’, ’1.0arcsec’] #  x and y cell size. default unit arcsec  
phasecenter         =         ’’   #  Image phase center: position or field index  
restfreq            =         ’’   #  rest frequency to assign to image (see help)  
stokes              =        ’I’   #  Stokes params to image (eg I,IV, QU,IQUV)  
weighting           =  ’natural’   #  Weighting of uv (natural, uniform, briggs, ...)  
uvtaper             =      False   #  Apply additional uv tapering of  visibilities.  
modelimage          =         ’’   #  Name of model image(s) to initialize cleaning  
restoringbeam       =       [’’]   #  Output Gaussian restoring beam for CLEAN image  
pbcor               =      False   #  Output primary beam-corrected image  
minpb               =        0.1   #  Minimum PB level to use  
calready            =       True   #  Create scratch columns and store model visibilities for selfcal  
async               =      False   #  If true the taskname must be started using clean(...)

The clean task will produce a number of output images based on the root name given in imagename. These include:

   <imagename>.clean.image                # the restored image  
   <imagename>.clean.flux                 # the effective response (e.g. for pbcor)  
   <imagename>.clean.flux.pbcoverage      # the PB coverage (ftmachine=’mosaic’ only)  
   <imagename>.clean.model                # the model image  
   <imagename>.clean.residual             # the residual image  
   <imagename>.clean.psf                  # the synthesized (dirty) beam

ALERT: The <imagename>.clean.flux.pbcoverage image is new in Patch 4 version 2.4.0 and reflects the unweighted primary beam coverage (without weighting or gridding kernel factors) used for the minpb cutoff (§ 5.3.7). This is produced only for imagermode=’mosaic’ with ftmachine=’mosaic’.

The mode, psfmode, imagermode, and weighting parameters open up other sub-parameters. These are detailed in the common imaging task parameters section (§ 5.2). The gridmode parameter (§ 5.3.13) is available to select more advanced imaging options such as widefield imaging and beam squint correction.

A typical setup for clean on the NGC5921 dataset, after setting parameter values, might look like:

vis             = ’ngc5921.usecase.ms.contsub’ #  Name of input visibility file  
imagename       = ’ngc5921.usecase.clean’ #  Pre-name of output images  
field           =        ’0’ # Field Name  
spw             =         ’’ # Spectral windows:channels: ’’ is all  
selectdata      =      False # Other data selection parameters  
mode            =  ’channel’ # Type of selection (mfs, channel, velocity, frequency)  
     nchan      =         46 # Number of channels (planes) in output image  
     start      =          5 # first input channel to use  
     width      =          1 # Number of input channels to average  
 interpolation  =  ’linear’ # Spectral interpolation (nearest, linear, cubic)  
 
gridmode        =         ’’ # The kind gridding kernel to be used for FFT-based transforms  
niter           =       6000 # Maximum number of iterations  
gain            =        0.1 # Loop gain for cleaning  
threshold       =        8.0 # Flux level to stop cleaning.  Must include units  
psfmode         =    ’clark’ # method of PSF calculation to use during minor cycles  
imagermode      =         ’’ # Use csclean or mosaic, or image-plane only if ’’  
multiscale      =         [] # set deconvolution scales (pixels)  
interactive     =      False # use interactive clean (with GUI viewer)  
mask            = [108, 108, 148, 148] #  cleanbox(es), mask image(s), and/or region(s)  
imsize          = [256, 256]   #  x and y image size in pixels  
cell            = [15.0, 15.0] #  x and y cell size. default unit arcsec  
phasecenter     =         ’’ # Image phase center: position or field index  
restfreq        =         ’’ # rest frequency to assign to image (see help)  
stokes          =        ’I’ # Stokes params to image (eg I,IV, QU,IQUV)  
weighting       =   ’briggs’ # Weighting to apply to visibilities  
     robust     =        0.5 # Briggs robustness parameter  
     npixels    =          0 # uv-cell size in pixels 0=> field of view  
 
uvtaper         =      False # Apply additional uv tapering of  visibilities.  
modelimage      =         ’’ # Name of model image(s) to initialize cleaning  
restoringbeam   =       [’’] # Output Gaussian restoring beam for CLEAN image  
pbcor           =      False # Output primary beam-corrected image  
minpb           =        0.1 # Minimum PB level to use  
async           =      False

An example of the clean task to create a continuum image from many channels is given below:

clean(vis=’ggtau.1mm.split.ms’, # Use data in ggtau.1mm.split.ms  
      imagename=’ggtau.1mm’,    # Name output images ’ggtau.1mm.*’ on disk  
      psfmode=’clark’,          # Use the Clark CLEAN algorithm  
      imagermode=’’,            # Do not mosaic or use csclean  
      mask=’’,                  # Do not use clean box or mask  
      niter=500, gain=0.1,      # Iterate 500 times using gain of 0.1  
      mode=’mfs’,               # multi-frequency synthesis (combine channels)  
      spw=’0~2:2~57’,           # Combine channels from 3 spectral windows  
      field=’0’,                #  
      stokes=’I’,               # Image stokes I polarization  
      weighting=’briggs’,       # Use Briggs robust weighting  
      rmode=’norm’,robust=0.5,  #    with robustness parameter of 0.5  
      cell=[0.1,0.1],           # Using 0.1 arcsec pixels  
      imsize=[256,256])         # Set image size = 256x256 pixels  

This example will clean the entire inner quarter of the primary beam. However, if you want to limit the region over which you allow the algorithm to find clean components then you can make a deconvolution region (or mask). To use a deconvolution region, box, or mask, set the mask parameter (§ 5.3.6).

Inside the Toolkit:
The im.clean method is used for CLEANing data. There are a number of methods used to set up the clean, including im.setoptions.

For example, you can set up a simple ’cleanbox’ region. To do this, make a first cut at the image and clean the inner quarter. Then use the viewer to look at the image and get an idea of where the emission is located. You can use the viewer adjustment panel to view the image in pixel coordinates and read out the pixel locations of your cursor.

Then, you can use those pixel read-outs you just go to define a clean box region with the CASA region format described in Chapter D. For example, say you have a continuum source near the center of your image between the pixel coordinates [80,80] and [120,120], you may use the rectangular region:

   mask=’box[[80pix,80pix],[120pix,120pix]]’

For more complicated and multiple clean regions, it will be best to user the viewer to create them interactively (but note that as of CASA 3.3. the viewer will still write the old formats - clean will still support those for CASA 3.3) or write a region file (Chapter D) and use that file as an input like:

   mask=’myregions.txt’

The following are the clean specific parameters and their allowed values, followed by a description of carrying out interactive cleaning.

  5.3.1 Parameter psfmode
   5.3.1.1 The clark algorithm
   5.3.1.2 The hogbom algorithm
   5.3.1.3 The clarkstokes algorithm
  5.3.2 The multiscale parameter
  5.3.3 Parameter gain
  5.3.4 Parameter imagermode
   5.3.4.1 Sub-parameter cyclefactor
   5.3.4.2 Sub-parameter cyclespeedup
   5.3.4.3 Sub-parameter ftmachine
   5.3.4.4 Sub-parameter mosweight
   5.3.4.5 Sub-parameter scaletype
   5.3.4.6 The threshold revisited
  5.3.5 Parameter interactive
  5.3.6 Parameter mask
   5.3.6.1 Setting clean boxes
   5.3.6.2 Using clean mask images
  5.3.7 Parameter minpb
  5.3.8 Parameter modelimage
  5.3.9 Parameter niter
  5.3.10 Parameter pbcor
  5.3.11 Parameter restoringbeam
  5.3.12 Parameter threshold
  5.3.13 Parameter gridmode
  5.3.14 Interactive Cleaning — Example
  5.3.15 Mosaic imaging
  5.3.16 Heterogeneous imaging
  5.3.17 Polarization imaging
  5.3.18 Wide-field imaging and deconvolution in clean
   5.3.18.1 Outlier fields
   5.3.18.2 Setting up w-projection
   5.3.18.3 Setting up faceting
   5.3.18.4 Combination of w-projection and faceting


More information about CASA may be found at the CASA web page

Copyright © 2010 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search