CStats:SigmaClipMean
The SigmaClipMean method computes the mean value of a data sample using iterative sigma rejection to exclude deviant values from the statistic. The sample may be a Lua table or a class object of type CImage, CArray, or CMatrix. For CImage and CMatrix objects, an optional CRect object can be used to define the points used in the calculation.
nMean, nStdDev = CStats:SigmaClipMean( table, nHigh, nLow ) nMean, nStdDev = CStats:SigmaClipMean( CImage, nHigh, nLow ) nMean, nStdDev = CStats:SigmaClipMean( CImage, nHigh, nLow, CRect ) nMean, nStdDev = CStats:SigmaClipMean( CArray, nHigh, nLow ) nMean, nStdDev = CStats:SigmaClipMean( CArray, nHigh, nLow, CRect ) nMean, nStdDev = CStats:SigmaClipMean( CMatrix, nHigh, nLow ) where |
table is a lua table containing the data.
CImage, CArray, and CMatrix are class objects containing the data to measure,
CRect is a CRect rectangle object that defines the region to measure.
nHigh and nLow specify the sigma values to reject from the upper and lower ends of the sample distribution.
nMean and nStdDev are the clipped mean value and standard deviation, respectively. On failure, 0,0 is returned.
The calculated statistic trims bad data away from the mean value using the standard deviation to identify and exclude deviant values in an iterative fashion. Use this method to reduce the biased result when the region contains a moderate percentage of deviant pixel values.
This method uses the same algorithm as the SigmaClip method of the CImCombine class.
Suppose a CImage I and a CRectR exist. The following script returns the clipped mean value inside a rectangle on the image. The clipping is done at 3 sigmas above the mean and 5 sigmas below the mean:
|
-- create a CStats object |
|
-- clips 3 sigmas above and 5 sigmas below |
|
-- list the results |
The following script returns the Sigma-clipped mean value for a table of data. Clipping is done at 3 sigmas above the mean and 5 sigmas below the mean:
|
-- create a CStats object |
|
-- create some data in a table |
|
-- list the result |