| Home | Trees | Index | Help |
|
|---|
| Package asap :: Module asapfitter :: Class fitter |
|
| Method Summary | |
|---|---|
Create a fitter object. | |
Return a scan where the function is applied to all rows for all Beams/IFs/Pols. | |
Return a new scan where the fits have been commited (subtracted) | |
Execute the actual fitting process. | |
Return the area under the fitted gaussian component. | |
Return chi^2. | |
Return the errors in the parameters. | |
Return the parameter estimates (for non-linear functions). | |
Return the fitted ordinate values. | |
Return the fit paramters. | |
Return the residual of the fit. | |
Plot the last fit. | |
Set the absissa and ordinate for the fit. | |
Set the function to be fit. | |
Set the Parameters of a 'Gaussian' component, set with set_function. | |
Set the parameters to be fitted. | |
Set the 'data' (a scantable) of the fitter. | |
Save the fit parameters. | |
| Method Details |
|---|
__init__(self)
Create a fitter object. No state is set.
|
auto_fit(self, insitu=None, plot=False)Return a scan where the function is applied to all rows for all Beams/IFs/Pols. |
commit(self)Return a new scan where the fits have been commited (subtracted) |
fit(self, row=0, estimate=False)
Execute the actual fitting process. All the state has to be set.
Parameters:
row: specify the row in the scantable
estimate: auto-compute an initial parameter set (default False)
This can be used to compute estimates even if fit was
called before.
Example:
s = scantable('myscan.asap')
s.set_cursor(thepol=1) # select second pol
f = fitter()
f.set_scan(s)
f.set_function(poly=0)
f.fit(row=0) # fit first row
|
get_area(self, component=None)
Return the area under the fitted gaussian component.
Parameters:
component: the gaussian component selection,
default (None) is the sum of all components
Note:
This will only work for gaussian fits.
|
get_chi2(self)Return chi^2. |
get_errors(self, component=None)
Return the errors in the parameters.
Parameters:
component: get the errors for the specified component
only, default is all components
|
get_estimate(self)Return the parameter estimates (for non-linear functions). |
get_fit(self)Return the fitted ordinate values. |
get_parameters(self, component=None, errors=False)
Return the fit paramters.
Parameters:
component: get the parameters for the specified component
only, default is all components
|
get_residual(self)Return the residual of the fit. |
plot(self, residual=False, components=None, plotparms=False, filename=None)
Plot the last fit.
Parameters:
residual: an optional parameter indicating if the residual
should be plotted (default 'False')
components: a list of components to plot, e.g [0,1],
-1 plots the total fit. Default is to only
plot the total fit.
plotparms: Inidicates if the parameter values should be present
on the plot
|
set_data(self, xdat, ydat, mask=None)
Set the absissa and ordinate for the fit. Also set the mask
indicationg valid points.
This can be used for data vectors retrieved from a scantable.
For scantable fitting use 'fitter.set_scan(scan, mask)'.
Parameters:
xdat: the abcissa values
ydat: the ordinate values
mask: an optional mask
|
set_function(self, **kwargs)
Set the function to be fit.
Parameters:
poly: use a polynomial of the order given
gauss: fit the number of gaussian specified
Example:
fitter.set_function(gauss=2) # will fit two gaussians
fitter.set_function(poly=3) # will fit a 3rd order polynomial
|
set_gauss_parameters(self, peak, centre, fwhm, peakfixed=0, centerfixed=0, fwhmfixed=0, component=0)
Set the Parameters of a 'Gaussian' component, set with set_function.
Parameters:
peak, centre, fwhm: The gaussian parameters
peakfixed,
centerfixed,
fwhmfixed: Optional parameters to indicate if
the paramters should be held fixed during
the fitting process. The default is to keep
all parameters flexible.
component: The number of the component (Default is the
component 0)
|
set_parameters(self, *args, **kwargs)
Set the parameters to be fitted.
Parameters:
params: a vector of parameters
fixed: a vector of which parameters are to be held fixed
(default is none)
component: in case of multiple gaussians, the index of the
component
|
set_scan(self, thescan=None, mask=None)
Set the 'data' (a scantable) of the fitter.
Parameters:
thescan: a scantable
mask: a msk retireved from the scantable
|
store_fit(self, filename=None)
Save the fit parameters.
Parameters:
filename: if specified save as an ASCII file, if None (default)
store it in the scnatable
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Wed May 2 14:24:33 2007 | http://epydoc.sf.net |