NRAO Home > CASA > CASA Cookbook and User Reference Manual

6.6 Computing the Moments of an Image Cube (immoments)

For spectral line datasets, the output of the imaging process is an image cube, with a frequency or velocity channel axis in addition to the two sky coordinate axes. This can be most easily thought of as a series of image planes stacked along the spectral dimension.

A useful product to compute is to collapse the cube into a moment image by taking a linear combination of the individual planes:

Mm (xi,yi) =    wm (xi,yi,vk)I (xi,yi,vk)

for pixel i and channel k in the cube I. There are a number of choices to form the m moment, usually approximating some polynomial expansion of the intensity distribution over velocity mean or sum, gradient, dispersion, skew, kurtosis, etc.). There are other possibilities (other than a weighted sum) for calculating the image, such as median filtering, finding minima or maxima along the spectral axis, or absolute mean deviations. And the axis along which to do these calculation need not be the spectral axis (ie. do moments along Dec for a RA-Velocity image). We will treat all of these as generalized instances of a “moment” map.

The immoments task will compute basic moment images from a cube. The default inputs are:

#  immoments :: Compute moments of an image cube:  
imagename    =         ’’   #   Input image name  
moments      =        [0]   #  List of moments you would like to compute  
axis         = ’spectral’   #  The momement axis: ra, dec, lat, long, spectral, or stokes  
region       =         ’’   #  Image Region.  Use viewer  
box          =         ’’   #  Select one or more box regions  
chans        =         ’’   #  Select the channel(spectral) range  
stokes       =         ’’   #  Stokes params to image (I,IV,IQU,IQUV)  
mask         =         ’’   #  mask used for selecting the area of the image to calculate the moments on  
includepix   =         -1   #  Range of pixel values to include  
excludepix   =         -1   #  Range of pixel values to exclude  
outfile      =         ’’   #  Output image file name (or root for multiple moments)  
async        =      False   #  If true the taskname must be started using immoments(...)

This task will operate on the input file given by imagename and produce a new image or set of images based on the name given in outfile.

The moments parameter chooses which moments are calculated. The choices for the operation mode are:

    moments=-1  - mean value of the spectrum  
    moments=0   - integrated value of the spectrum  
    moments=1   - intensity weighted coordinate;traditionally used to get  
                  ’velocity fields’  
    moments=2   - intensity weighted dispersion of the coordinate; traditionally  
                  used to get ’velocity dispersion’  
    moments=3   - median of I  
    moments=4   - median coordinate  
    moments=5   - standard deviation about the mean of the spectrum  
    moments=6   - root mean square of the spectrum  
    moments=7   - absolute mean deviation of the spectrum  
    moments=8   - maximum value of the spectrum  
    moments=9   - coordinate of the maximum value of the spectrum  
    moments=10  - minimum value of the spectrum  
    moments=11  - coordinate of the minimum value of the spectrum

The meaning of these is described in the CASA Reference Manual:

The axis parameter sets the axis along which the moment is “collapsed” or calculated. Choices are: ’ra’, ’dec’, ’lat’, ’long’, ’spectral’, or ’stokes’. A standard moment-0 or moment-1 image of a spectral cube would use the default choice ’spectral’. One could make a position-velocity map by setting ’ra’ or ’dec’.

The includepix and excludepix parameters are used to set ranges for the inclusion and exclusion of pixels based on values. For example, includepix=[0.05,100.0] will include pixels with values from 50 mJy to 1000 Jy, and excludepix=[100.0,1000.0] will exclude pixels with values from 100 to 1000 Jy.

If a single moment is chosen, the outfile specifies the exact name of the output image. If multiple moments are chosen, then outfile will be used as the root of the output filenames, which will get different suffixes for each moment.

  6.6.1 Hints for using (immoments)
  6.6.2 Examples using (immoments)

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