CFwhm:Calc


The Calc method computes the FWHM, Peak, Background and, optionally, the x and y centroid coordinates in the image. The starting coordinate (x,y) is passed as arguments of this method. The other parameters are stored in the CFwhm class.

Syntax

nFwhm, bSuccess = CFwhm:Calc( CImage, nX0, nY0 )

bullet.gif    CImage is the image object to measure.

bullet.gif    nX0 and nY0 are initial guesses for the centroid coordinate (x,y), in pixels coordinates.

bullet.gif    The returned values nX and nY are the actual pixel coordinates that were used (may be centroid coordinates).

bullet.gif    On successful calculation, this method returns the FWHM and true.

bullet.gif    On failure, nFwhm=0 and false are returned.

Remarks

This method returns a boolean success flag, followed by the FWHM value. Since the success flag is returned first, you can test for successful return value by testing the first return value as shown in the example below. Upon a successful calculation, the FWHM, Peak, Background, X, and Y values are stored in class properties that can be retrieved using various class methods.

Example

Assume that an image exists as the CImage objectI. The example below shows calculation of the FWHM. The results returned by the functional call and those saved in class members should be identical.

 

F = new_fwhm()

-- create a CFwhm object

x0 = 192 ; y0 = 440

-- point near the centroid position

F:SetSign(true)

-- calculate using peaks, not valleys

FWHM, bSuccess = F:Calc( I, x0, y0 )

-- calculate the FWHM

if bSuccess then

-- if successful, print the result

 Printf("returned %lg", FWHM )

-- returned by the method

 Printf("class FWHM = %lg", F:Fwhm())

-- stored in the class, should be same

end

 

F:delete()

-- clean up memory

Related Topics

CFwhm, Fwhm, Peak, Bg, X, Y, CCentroid, Image Coordinate System, Subpixel Coordinate Definition


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