|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
image.deviation - Function
1.1.1 Make an image based on a statistic from the input image’s pixel values, which
in some cases can represent a deviation image of the original.
Description
This application creates an image that reflects the statistics of the input
image. The output image has the same dimensions and coordinate system as
the (selected region in) input image. The grid parameter describes how many
pixels apart ”grid” pixels are. Statistics are computed around each grid pixel.
Grid pixels are limited to the direction plane only; independent statistics are
computed for each direction plane (ie at each frequency/stokes pixel should
the input image happen to have such additional axes). Using the xlength and
ylength parameters, one may specify either a rectangular or circular region
around each grid point that defines which surrounding pixels are used in the
statistic computation for individual grid points. If the ylength parameter is the
empty string, then a circle of diameter provided by xlength centered on the
grid point is used. If ylength is not empty, then a rectangular box of
dimensions xlength x ylength centered on the grid pixel is used. These two
parameters may be specified in pixels, using either numerical values or valid
quantities with ”pix” as the unit (eg ”4pix”). Otherwise, they must be
specified as valid angular quantities, with recognized units (eg ”4arcsec”). As
with other region selections in CASA, full pixels are included in the
computation even if the specified region includes only a fraction of that pixel.
BEWARE OF MACHINE PRECISION ISSUES, because you may get a
smaller number of pixels included in a region than you expect if you specify,
eg, an integer number of pixels. In such cases, you probably want to specify
that number plus a small epsilon value (eg ”2.0001pix” rather than ”2pix”) to
mitigate machine precision issues when computing region extents.
The output image is formed by putting the statistics calculated at each grid point at the corresponding grid point in the output image. Interpolation of these output values is then used to compute values at non-grid-point pixels. The user may specify which interpolation algorithm to use for this computation using the interp parameter.
ANCHORING THE GRID
The user may choose at which pixel to ”anchor” the grid. For example, if one specifies grid=[4,4] and anchor=[0,0], grid points will be located at pixels [0,0], [0,4], [0,8] ... [4,0], [4,4], etc. This is exactly the same grid that would be produced if the user specified anchor=[4,4] or anchor=[20,44]. If the user specifies anchor=[1, 2] and grid=[4,4], then the grid points will be at pixels [1,2], [5,2], [9,2]... [5,2], [5,6], etc. and the resulting grid is the same as it would be if the user specified eg anchor=[9,10] or anchor=[21, 18]. The value ”ref”, which is the default, indicates that the reference pixel of the input image should be used to anchor the grid. The x and y values of this pixel will be rounded to the nearest integer if necessary.
SUPPORTED STATISTICS AND STATISTICS ALGORITHMS
One may specify which statistic should be represented using the stattype parameter. The following values are recognized (minimum match supported):
iqr inner quartile range (q3 - q1) max maximum mean mean medabsdevmed,
madm median absolute deviation from the median median median min
minimum npts number of points q1 first quartile q3 third quartile rms rms
sigma, std standard deviation sumsq sum of squares sum sum var variance
xmadm median absolute deviation from the median multipied by x, where x is
the reciprocal of Phi1(3/4), where Phi
1 is the reciprocal of the quantile
function. Numerically, x = 1.482602218505602. See, eg,
https://en.wikipedia.org/wiki/Median_absolute_deviation#Relation_to_standard_deviation
Using the statalg parameter, one may also select whether to use the Classical or Chauvenet/ZScore statistics algorithm to compute the desired statistic (see the help for ia.statistics() or imstat for a full description of these algorithms).
Arguments
Inputs |
| ||
outfile |
| Output image file name. If left blank (the default), no
image is written but a new image tool referencing the
collapsed image is returned.
| |
| allowed: | string |
|
| Default: |
| |
region |
| Region selection. Default is to use the full image.
| |
| allowed: | any |
|
| Default: | variant
|
|
mask |
| Mask to use. Default setting is none.
| |
| allowed: | string |
|
| Default: |
|
|
overwrite |
| Overwrite (unprompted) pre-existing output file?
Ignored if ”outfile” is left blank.
| |
| allowed: | bool | |
| Default: | false |
|
stretch |
| Stretch the mask if necessary and possible? Default value
is False. | |
| allowed: | bool |
|
| Default: | false | |
grid |
| x,y grid spacing. Array of exactly two positive integers.
| |
| allowed: | intarray |
|
| Default: | 11 | |
anchor |
| x,y anchor pixel location. Either ”ref” to use the image
reference pixel, or an array of exactly two integers.
| |
| allowed: | variant | |
| Default: | variant ref |
|
xlength |
| Either x coordinate length of box, or diameter of circle.
Circle is used if ylength is empty string.
| |
| allowed: | variant | |
| Default: | variant 1pix |
|
ylength |
| y coordinate length of box. Use a circle if ylength is
empty string.
| |
| allowed: | variant |
|
| Default: | variant 1pix |
|
interp |
| Interpolation algorithm to use. One of ”nearest”,
”linear”, ”cubic”, or ”lanczos”. Minimum match
supported.
| |
| allowed: | string |
|
| Default: | cubic |
|
stattype |
| Statistic to compute. See full description for supported
statistics.
| |
| allowed: | string |
|
| Default: | sigma |
|
statalg |
| Statistics computation algorithm to use. Supported
values are ”chauvenet” and ”classic”, Minimum match
is supported.
| |
| allowed: | string |
|
| Default: | classic |
|
zscore |
| For chauvenet, this is the target maximum number of
standard deviations data may have to be included. If
negative, use Chauvenet’s criterion. Ignored if algorithm
is not ”chauvenet”.
| |
| allowed: | double |
|
| Default: | -1 |
|
maxiter |
| For chauvenet, this is the maximum number of iterations
to attempt. Iterating will stop when either this limit is
reached, or the zscore criterion is met. If negative, iterate
until the zscore criterion is met. Ignored if algortihm is
not ”chauvenet”.
| |
| allowed: | int |
|
| Default: | -1 |
|
image
Example
# compute standard deviations in circles of diameter 10arcsec around
# grid pixels spaced every 4 x 5 pixels and anchored at pixel [30, 40],
# and use linear interpolation to compute values at non-grid-pixels
ia.open("my.im")
zz = ia.deviation("sigma.im", grid=[4, 5], anchor=[30, 40], xlength="10arcsec", stattype="sigma", interp="lin", statalg="cl")
# compute median of the absolute deviations from the median values using
# the z-score/Chauvenet algorithm, by fixing the maximum z-score to determine outliers to 5.
# Use cubic interpolation to compute values for non-grid-point pixels. Use a rectangular region
# of dimensions 5arcsec x 20arcsec centered on each grid point as the region in which to include
# pixels for the computation of stats for that grid point.
zz = ia.deviation("madm.im", grid=[4, 5], anchor=[30, 40], xlength="5arcsec", ylength="20arcsec, stattype="madm", interp="cub", statalg="ch", zscore=5)
__________________________________________________________________
More information about CASA may be found at the
CASA web page
Copyright © 2016 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