GNU Astronomy Utilities



6.2.4.6 Statistical operators

The operators in this section take a single dataset as input, and will return the desired statistic as a single value.

minvalue

Minimum value in the first popped operand, so “a.fits minvalue” will push the minimum pixel value in this image onto the stack. When this operator acts on a single image, the output (operand that is put back on the stack) will no longer be an image, but a number. The output of this operand is in the same type as the input. This operator is mainly intended for multi-element datasets (for example, images or data cubes), if the popped operand is a number, it will just return it without any change.

Note that when the final remaining/output operand is a single number, it is printed onto the standard output. For example, with the command below the minimum pixel value in image.fits will be printed in the terminal:

$ astarithmetic image.fits minvalue

However, the output above also includes a lot of extra information that are not relevant in this context. If you just want the final number, run Arithmetic in quiet mode:

$ astarithmetic image.fits minvalue -q

Also see the description of sqrt for other example usages of this operator.

maxvalue

Maximum value of first operand in the same type, similar to minvalue, see the description there for more. For example

$ astarithmetic image.fits maxvalue -q
numbervalue

Number of non-blank elements in first operand in the uint64 type (since it is always a positive integer, see Numeric data types). Its usage is similar to minvalue, for example

$ astarithmetic image.fits numbervalue -q
sumvalue

Sum of non-blank elements in first operand in the float32 type. Its usage is similar to minvalue, for example

$ astarithmetic image.fits sumvalue -q
meanvalue

Mean value of non-blank elements in first operand in the float32 type. Its usage is similar to minvalue, for example

$ astarithmetic image.fits meanvalue -q
stdvalue

Standard deviation of non-blank elements in first operand in the float32 type. Its usage is similar to minvalue, for example

$ astarithmetic image.fits stdvalue -q
medianvalue

Median of non-blank elements in first operand with the same type. Its usage is similar to minvalue, for example

$ astarithmetic image.fits medianvalue -q
unique

Remove all duplicate (and blank) elements from the first popped operand. The unique elements of the dataset will be stored in a single-dimensional dataset.

Recall that by default, single-dimensional datasets are stored as a table column in the output. But you can use --onedasimage or --onedonstdout to respectively store them as a single-dimensional FITS array/image, or to print them on the standard output.

Although you can use this operator on the floating point dataset, due to floating-point errors it may give non-reasonable values: because the tenth digit of the decimal point is also considered although it may be statistically meaningless, see Numeric data types. It is therefore better/recommended to use it on the integer dataset like the labeled images of Segment output where each pixel has the integer label of the object/clump it is associated with. For example, let’s assume you have cropped a region of a larger labeled image and want to find the labels/objects that are within the crop. With this operator, this job is trivial:

$ astarithmetic seg-crop.fits unique
noblank

Remove all blank elements from the first popped operand. Since the blank pixels are being removed, the output dataset will always be single-dimensional, independent of the dimensionality of the input.

Recall that by default, single-dimensional datasets are stored as a table column in the output. But you can use --onedasimage or --onedonstdout to respectively store them as a single-dimensional FITS array/image, or to print them on the standard output.

For example, with the command below, the non-blank pixel values of cropped.fits are printed on the command-line (the --quiet option is used to remove the extra information that Arithmetic prints as it reads the inputs, its version and its running time).

$ astarithmetic cropped.fits noblank --onedonstdout --quiet