makemask manages Boolean masks in an image, converts and regrids Boolean to value-based masks (and vice versa), stretches single-plane masks to cubes, and generates masks from CASA region files. Detailed background information on masks, and examples on how to create them, can be found in the CASA Docs Chapter pages on image masks (image analysis) and masks for deconvolution (synthesis imaging).


Parameter descriptions


Mask method to use by makemask task. Below are the allowed values: 

  • list: list internal Boolean masks in inpimage to the log (default value)
  • copy: copy/merge masks and regrid if necessary to a new or existing mask
  • expand: expand a mask from one range of frequencies to another range
  • delete: delete an internal mask from an image; if the deleted mask was a default mask, the task chooses the first one in the remaining internal mask list as default (as appears in the log when do listing with mode='list')
  • setdefaultmask: set a specified internal mask as a default internal mask

In all cases (for output mask is expected), if the output image has a different coordinate system from the result of input and processing, the mask will be re-gridded to the output coordinate system.


Name of input image to use as a reference for the output coordinates (if output does not exist). Also used as a reference image when regions are specified in inpmask for mode='copy'. If output is a new image specified with an internal True/False mask, the pixel values in the input image are copied to the output image and the regions specified in inpmask are merged (if multiple regions specified) and treated as a valid region, therefore will be UNMASKED in output.


Expandable parameters for mode='copy', 'expand', 'delete' and 'setdefaultmask':


Name(s) of input mask(s). The default is set to inpmask='', for when no mask is given. To specify an image (zero/non-zero) mask, just give a image name (e.g. To specify an internal (True/False) mask, you must give a parent image name and the internal mask name separated by a colon. (e.g. The internal mask names can be found by running the makemask task in mode='list'. For mode='expand', use the inpimage values to make a mask (zero/non-zero). Non-zero values are normalized to one in the process. For mode='copy', a list of strings can be used to merge specific image mask(s), True/False mask(s), and region(s). The regions can be specified directly in the CASA region format or in the text file(s) contains the regions.


Name of output image (no default value). If the output is a plain image name, the resultant mask is written as an image (zero/one) mask. If the output name is the form of 'imagename:maskname', the resultant mask is written as an internal (True/False) mask. To re-grid a mask to a different coordinate system, give an image with the target coordinate system in inpimage, or make a copy of an image with the target coordinate system and specified the name of the copy in output. If output is specified as a plain image (if it exists), it will regrid the mask to the new coordinate system and modify output (if overwrite=True). If output is specified as an image with an internal mask (if the internal mask exists), it will regrid the mask to the new coordinate system and modify the internal mask only (if overwrite=True). If output does not exist, it will only copy inpimage. If output == inpimage, makemask will not regrid but only modify in-place.

NOTE: The term 'mask' is used in the image analysis and clean tasks in opposite sense. In the image analysis, the masked region is a region to be excluded, while clean's input mask defines the region to be used as a clean box/region. In the makemask task, since the most common use case of output image mask is to use as an input mask in clean, when it converts an internal mask to the image mask, the 'masked' region (where the pixels are masked and have the Boolean value False) of the internal mask is translated to the pixels with value of 0 in output image mask.


Overwrite the mask specified in output (see also the output rules above). The default value is False.

NOTE: For a cube mask, overwrite=True generally overwrites in the specified channel planes only and so any pre-existed masks in other channels will be remain untouched.


Additional expandable parameters for mode='expand'


Input channel/frequency/velocity range. Specify channels in a list of integers. For frequency/velocity, a range is specified in a string with '~', e.g. '1.5MHz~1.6MHz', '-8km/s~-14km/s' (for a cube with ascending frequencies/velocities). The default is all channels.

NOTE: The range in frequency or velocity needs to be specified as the same order as in the template cube specified in inpimage. E.g., if a template cube has descending frequencies, then the range will be, e.g. '1.6MHz~1.5MHz' or '-14km/s~-8km/s'.


Output channel/frequency/velocity range. Specify same way as inpfreqs. The default is all channels.