NRAO Home > CASA > CASA Cookbook and User Reference Manual

6.7 Computing image statistics (imstat)

The imstat task will calculate statistics on a region of an image, and return the results as a return value in a Python dictionary.

The inputs are:

#  imstat :: Displays statistical information from an image or image region  
imagename           =         ’’        #  Name of the input image  
axes                =         -1        #  List of axes to evaluate statistics over.  
                                        #   Default is all axes.  
region              =         ’’        #  Image Region or name. Use Viewer  
box                 =         ’’        #  Select one or more box regions  
chans               =         ’’        #  Select the channel(spectral) range  
stokes              =         ’’        #  Stokes params to image (I,IV,IQU,IQUV).  
                                        #   Default "" => include all  
listit              =       True        #  Print stats and bounding box to logger?  
verbose             =       True        #  Print additional messages to logger?  
mask                =         ’’        #  Mask to use. See help par.mask. Default is  
                                        #   none.  
logfile             =         ’’        #  Name of file to write fit results.  
async               =      False        #  If true the taskname must be started using  

Area selection using region and mask is detailed in § 6.1.5 and (§ 5.3.6) respectively.

Plane selection is controlled by chans and stokes. See § 6.1.2 for details on plane selection.

The parameter axes will select the dimensions that the statistics is calculated over. Typical data cubes have axes like: RA axis 0, DEC axis 1, Velocity axis 2. So, e.g. axes=[0,1] would be the most common setting to calculate statistics per spectral channel.

A typical output of imstat on a cube with axes=[0,1] looks like:

No region specified. Using full positional plane.  
Using all spectral channels.  
Using polarizations ALL  
Determining stats for image IRC10216_HC3N.cube_r0.5.image  
Set region from supplied region record  
Regions ---  
         -- bottom-left corner (pixel) [blc]:  [0, 0, 0, 0]  
         -- top-right corner (pixel) [trc]:    [299, 299, 0, 63]  
         -- bottom-left corner (world) [blcf]: 09:48:01.492, +13.15.40.658, I, 3.63994e+10Hz  
         -- top-right corner (world) [trcf]:   09:47:53.299, +13.17.40.258, I, 3.63915e+10Hz  
No region specified. Using full positional plane.  
Using all spectral channels.  
Using polarizations ALL  
Selected bounding box :  
    [0, 0, 0, 0] to [299, 299, 0, 63]  (09:48:01.492, +13.15.40.658, I, 3.63994e+10Hz to 09:47:53.299, +13.17.40.258, I, 3.63915e+10Hz)  
#        Frequency  Frequency(Plane) Npts          Sum           Mean          Rms           Std dev       Minimum       Maximum  
  3.63993552e+10                  0  9.000000e+04  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  
  3.63992302e+10                  1  9.000000e+04  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  
  3.63991052e+10                  2  9.000000e+04  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  
  3.63989802e+10                  3  9.000000e+04  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  
  3.63988551e+10                  4  9.000000e+04  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  
  3.63987301e+10                  5  9.000000e+04  6.069948e-01  6.744386e-06  1.534640e-03  1.534634e-03 -6.355108e-03  6.166496e-03  
  3.63986051e+10                  6  9.000000e+04  2.711720e-01  3.013023e-06  1.538071e-03  1.538077e-03 -6.165663e-03  5.862981e-03  
  3.63984801e+10                  7  9.000000e+04  2.501259e-01  2.779177e-06  1.578049e-03  1.578056e-03 -6.771976e-03  6.272645e-03  
  3.63983551e+10                  8  9.000000e+04 -3.706732e-01 -4.118591e-06  1.607191e-03  1.607194e-03 -8.871284e-03  6.591001e-03

where the header information provides the specifications of the data that were selected followed by the table with the frequency values of the lanes, the plane numbers, Npts the number of pixels per plane, and the Sum, Median, RMS, Standard deviations, Minimum, and Maximum of the pixel values for each plane. Similar output is provided when the data is averaged over different axes. The logger output can also be written into a log file for further processing elsewhere (logfile parameter).

  6.7.1 Using the task return value
  6.7.2 Examples for imstat


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