CLsqFit:GetPtStatus


The GetPtStatus method returns an integer representing the status of a sample point. To get a string representation, use GetPtStatusStr .

Syntax

nStatus = CLsqFit:GetPtStatus( nIndex )

nStatus = CLsqFit:GetPtStatus( nIndex, nChannel )

bullet.gif    nIndex is the index of the point in the sample, beginning at index 1.

bullet.gif    nChannel is the optional channel to select for multi-channel data.

bullet.gif    nStatus is an integer giving the status of the point.

Remarks

The point status has three states: 0 ("use"), 1 ("rej"), or 2 ("del") for used, rejected, or deleted. When a point is added to the sample it acquires a status value of 0 (used). If data rejection is enabled and the point is rejected, it acquires a status of 1 (rejected) and is not used in the fit. Likewise, if you explicitly delete a point so it is not used in the fit, the status will become 2 (deleted). A deleted or rejected point's status may be changed to 0 (used) by SetPtStatus and UndeletePt .

The GetPtStatus method uses the index of the target point. The point's index must either be known from the order that points were added to the sample, or determined by matching the target point's values using FindPt or a more complicated procedure involving GetResid or other method.

Two forms are provided. If the data have a single channel, as in typical numeric data, then you may specify only the point index. If you fit multi-channel data, as for an RGB array, then the channel must be specified as 1 through 4 to return the point status for that channel.

Example

The following example illustrates how to change the status of a sample point. In this case, the target point's index is found by matching its values:

L = new_lsqfit()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefficients to fit a line

L:AddPt( 3.5, 5.15 )

-- add a point for x = 3.5, y = 5.15, weight = 1

-- add more points to the fit

 

L:DoRejection()

-- enable bad data rejection using default values

L:Fit()

-- Fit the line

-- do something with the fit results

 

n = L:FindPt( 3.5, 5.15 )

-- find the point (if we don't know it has index 1)

nStat = L:GetPtStatus( n )

-- get the status (assume it was deleted)

Printf("status= '%d'\n", nStat )

-- result: Status= 1 (rejected)

Related Topics

CLsqFit class, GetPtStatusStr , SetPtStatus , AddPt , FindPt , DeletePt


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