CLsqFit:GetWt
The GetWt method returns a table containing the weights for all points in the data sample. If multichannel data are fit, the function returns 1 table for each data channel. The returned table contains CLsqFit:GetNumPts() values. To get the weight of a single point, use GetPtWt.
tWt = CLsqFit:GetWt() tWt = CLsqFit:GetWt( nChannel ) tWt1, tWt2, tWt3, tWt4 = CLsqFit:GetWt() where |
nChannel is the optional channel to select for multi-channel data.
tWt is a Lua table containing the weights assigned all points.
tWt1, tWt2, tWt3, tWt4 are tables of weights assigned to points that have multi-channel (e.g., RGB) values. The number of tables returned equals the number of channels.
Two formats are provided with a different number of return values. If the point uses single-channel data (i.e., typical numeric data) or you specify the channel, then a single table is returned. If the point involves multi-channel data, up to 4 tables will be returned. The number of tables returned equals the number of channels of data that were fit.
The following example fitsreturns the number of fit points that had a weight >= 5.0:
|
-- create a CLsqFit object |
|
-- set 2 coefficients to fit a line to single channel data |
|
-- add a point for x = 3.5, obs = 5.15, weight = 10 |
-- add more points |
|
|
-- Fit the line |
|
-- initialize a counter |
|
-- loop over all points k having weight w |
|
-- w is the k-th weight |
|
|
|
--list the results |