CStats:SigmaClipMean and CStats:SigmaClipMeanSdev


The SigmaClipMean method computes the mean value of a sample, using iterative sigma clipping for removing deviant values from the statistic. The clipping is described by 3 parameters nHigh, nLow, and nIter. These specify the number of sigmas above, number of sigmas below, and number of iterations, respectively. Typical values are 3, 3, 3.

Syntax

nMean = CStats:SigmaClipMean( CImage, nHigh, nLow, nIter, CRect )

nMean = CStats:SigmaClipMean( CImage, nHigh, nLow, nIter )

nMean = CStats:SigmaClipMean( table, nHigh, nLow, nIter )

nMean, nSdev = CStats:SigmaClipMeanSdev( CImage, nHigh, nLow, nIter, CRect )

nMean, nSdev = CStats:SigmaClipMeanSdev( CImage, nHigh, nLow, nIter )

nMean, nSdev = CStats:SigmaClipMeanSdev( table, nHigh, nLow, nIter )

bullet.gif    CRect is a bounding rectangle for the CImage object.

bullet.gif    table is a 1-dimensional array containing numeric values.

bullet.gif    CRect is a bounding rectangle for the CImage object.

bullet.gif    nHigh is the number of sigmas at which to clip above the distribution.

bullet.gif    nLow is the number of sigmas at which to clip below the distribution.

bullet.gif    nIter is the number of iterations of clipping, usually 3 to 5.

bullet.gif    On success, this method returns the clipped mean value and sandard deviation.

bullet.gif    On failure, returns 0, 0.

Remarks

The calculated statistic trims bad data away from the mean value using the standard deviation to identify and reject 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.

Example

Suppose a CImageI 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:

S = new_stats()

-- create a CStats object

-- assume CImage and CRect exist

 

nMean, nSdev = S:SigmaClipMeanSdev( I,3,5,2,R )

-- clip 3 sigmas above, 5 sigmas below, 2 iterations

Printf("Mean=%lg +/- %lg\n", nMean, nSdev )

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, CImage class, CRect class, MinMaxClipMean, MtmSigmaClipMean, RankClipMean


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.