|
|||
NRAO Home > CASA > CASA Cookbook and User Reference Manual |
|
6.7.1 Using the task return value
The contents of the return value of imstat are in a Python dictionary of key-value sets. For example,
will assign this to the Python variable xstat.
The keys for xstat are then:
blc - absolute PIXEL coordinate of the bottom left corner of
the bounding box surrounding the selected region
blcf - Same as blc, but uses WORLD coordinates instead of pixels
trc - the absolute PIXEL coordinate of the top right corner
of the bounding box surrounding the selected region
trcf - Same as trc, but uses WORLD coordinates instead of pixels
flux - the integrated flux density if the beam is defined and
the if brightness units are $Jy/beam$
npts - the number of unmasked points used
max - the maximum pixel value
min - minimum pixel value
maxpos - absolute PIXEL coordinate of maximum pixel value
maxposf - Same as maxpos, but uses WORLD coordinates instead of pixels
minpos - absolute pixel coordinate of minimum pixel value
minposf - Same as minpos, but uses WORLD coordinates instead of pixels
sum - the sum of the pixel values: $\sum I_i$
sumsq - the sum of the squares of the pixel values: $\sum I_i^2$
mean - the mean of pixel values:
$ar{I} = \sum I_i / n$
sigma - the standard deviation about the mean:
$\sigma^2 = (\sum I_i -ar{I})^2 / (n-1)$
rms - the root mean square:
$\sqrt {\sum I_i^2 / n}$
median - the median pixel value (if robust=T)
medabsdevmed - the median of the absolute deviations from the
median (if robust=T)
quartile - the inter-quartile range (if robust=T). Find the points
which are 25% largest and 75% largest (the median is
50% largest), find their difference and divide that
difference by 2.
For example, an imstat call might be
imagename = ’ngc5921.demo.cleanimg.image’ # The NGC5921 image cube
box = ’108,108,148,148’ # 20 pixels around the center
chans = ’21’ # channel 21
xstat = imstat()
In the terminal window, imstat reports:
Region ---
-- bottom-left corner (pixel) [blc]: [108, 108, 0, 21]
-- top-right corner (pixel) [trc]: [148, 148, 0, 21]
-- bottom-left corner (world) [blcf]: 15:22:20.076, +04.58.59.981, I, 1.41332e+09Hz
-- top-right corner( world) [trcf]: 15:21:39.919, +05.08.59.981, I, 1.41332e+09Hz
Values --
-- flux [flux]: 0.111799236126
-- number of points [npts]: 1681.0
-- maximum value [max]: 0.029451508075
-- minimum value [min]: -0.00612453464419
-- position of max value (pixel) [maxpos]: [124, 131, 0, 21]
-- position of min value (pixel) [minpos]: [142, 110, 0, 21]
-- position of max value (world) [maxposf]: 15:22:04.016, +05.04.44.999, I, 1.41332e+09Hz
-- position of min value (world) [minposf]: 15:21:45.947, +04.59.29.990, I, 1.41332e+09Hz
-- Sum of pixel values [sum]: 1.32267159822
-- Sum of squared pixel values [sumsq]: 0.0284534543692
Statistics ---
-- Mean of the pixel values [mean]: 0.000786836167885
-- Standard deviation of the Mean [sigma]: 0.00403944306904
-- Root mean square [rms]: 0.00411418313161
-- Median of the pixel values [median]: 0.000137259965413
-- Median of the deviations [medabsdevmed]: 0.00152346317191
-- Quartile [quartile]: 0.00305395200849
The return value in xstat is
Out[152]:
{’blc’: array([108, 108, 0, 21]),
’blcf’: ’15:22:20.076, +04.58.59.981, I, 1.41332e+09Hz’,
’flux’: array([ 0.11179924]),
’max’: array([ 0.02945151]),
’maxpos’: array([124, 131, 0, 21]),
’maxposf’: ’15:22:04.016, +05.04.44.999, I, 1.41332e+09Hz’,
’mean’: array([ 0.00078684]),
’medabsdevmed’: array([ 0.00152346]),
’median’: array([ 0.00013726]),
’min’: array([-0.00612453]),
’minpos’: array([142, 110, 0, 21]),
’minposf’: ’15:21:45.947, +04.59.29.990, I, 1.41332e+09Hz’,
’npts’: array([ 1681.]),
’quartile’: array([ 0.00305395]),
’rms’: array([ 0.00411418]),
’sigma’: array([ 0.00403944]),
’sum’: array([ 1.3226716]),
’sumsq’: array([ 0.02845345]),
’trc’: array([148, 148, 0, 21]),
’trcf’: ’15:21:39.919, +05.08.59.981, I, 1.41332e+09Hz’}
ALERT: The return dictionary currently includes NumPy array values, which have to be accessed by an array index to get the array value. To access these dictionary elements, use the standard Python dictionary syntax, e.g.
For example, to extract the standard deviation as a number
print ’Sigma = ’+str(xstat[’sigma’][0])
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