MN: Compute the Mean of the Pixel Values

Form:MN source [NOBL] [BOX=b] [NOZERO] [MASK] [PIX=p] [SILENT] [W=w1,w2]
source
the image or spectrum for which the mean is to be computed
NOBL
ignore baseline (last) column in an image
BOX=b
find the mean in box b
NOZERO
ignore pixels with value zero
MASK
ignore masked pixels
PIX=p
use every p'th pixel (for speed)
W=w1,w2
find the mean in a wavelength calibrated spectrum in the interval from wavelength w1 to w2.
SILENT
do not print the results of the calculation.

The mean of all the pixels in the image contained in buffer 'source' is computed. Use MASK or NOZERO to ignore masked or zero-valued pixels in the computation. PIX=p computes the mean using every p'th pixel in every p'th row, for speed.

The computed mean value is printed at the terminal (unless the SILENT word is given) and is also loaded into the VISTA variable Mn, where 'n' is the image buffer number. (ex: the command MN 1 loads the variable M1. The command MN 31 loads the variable MN31). The value of the mean is also loaded into the variable MEAN.

The mean is used by other commands such as the TV command for a default display range, or the DIVIDE command for rescaling images after flat-field divisions.

See MASK for the operation of the pixel mask.

Examples:

MN 4
finds the mean of buffer 4. The value of the mean is printed on the terminal and is loaded into the variables MEAN and M4.
MN 2 PIX=5
computes the mean using every 5th pixel in every 5th row. This makes the computation go very fast.
MN 5 W=4000,5000
finds the mean of the wavelength- calibrated spectrum in buffer 5 in the interval from 4000 to 5000 Angstroms.
MN $Q MASK
finds the mean of the object in buffer Q (Q a variable), ignoring masked pixels.
MN 4 BOX=6
finds the mean of the object in buffer 4 using those pixels in box 6.