CLsqFit:GetPtStatusStr


The GetPtStatusStr method returns a string describing the status of a sample point, specificaly, "Use", "Rej", and "Del".

Syntax

sStatus = CLsqFit:GetPtStatusStr( nIndex )

sStatus = CLsqFit:GetPtStatusStr( 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    sStatus is a string giving the status string for the point.

Remarks

The point status has three states: Used ("Use"), Rejected ("Rej"), or Deleted ("Del"). When a point is added to the sample it acquires the "Use" status. If data rejection is enabled and the point is rejected, it acquires a "Rej" status 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 "Del". A deleted or rejected point's status may be changed to "Use" by SetPtStatus and UndeletePt .

The GetPtStatusStr 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 with 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)

sStat = L:GetPtStatusStr( n )

-- get the status (assume it was rejected)

Printf("status= '%s'\n", sStat )

-- result: Status= 'Rej'

Related Topics

CLsqFit class, GetPtStatus , SetPtStatus , AddPt, FindPt , DeletePt , DoRejection

 


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