|
def | __init__ (self, func, method='auto') |
|
def | __del__ (self) |
|
def | set_data (self, wks, x, y, yerr='', xerr='', z='') |
|
def | set_mdata (self, ms, z) |
|
def | set_range (self, rg) |
|
def | fix_param (self, p, val) |
|
def | set_param (self, p, val) |
|
def | param_box (self) |
|
def | fit (self, iter='') |
|
def | result (self) |
|
def | report (self, autoupdate=False) |
|
class for performing Non-Linear Curve Fitting with Origin's internal fitting engine
The name of the fitting function already defined inside Origin must be provided to use this class
◆ fit()
def originpro.analysis.NLFit.fit |
( |
|
self, |
|
|
|
iter = '' |
|
) |
| |
iterate the fitting engine
Parameters:
iter (str or int): empty will iterate until converge, otherwise to specify the number of iterations
Returns:
none
Examples:
model = op.NLFit('Gauss')
wks=op.find_sheet()
model.set_data(wks, 0, 1)
model.param_box()
model.fit()
◆ fix_param()
def originpro.analysis.NLFit.fix_param |
( |
|
self, |
|
|
|
p, |
|
|
|
val |
|
) |
| |
fix a parameter to a value or to turn off the fixing
Parameters:
p(str): name of a parameter
val(bool or float): use False to turn off parameter fixing, or specify a value to fix it to
Returns:
none
Examples:
model.fix_param('y0', 0)
model.fix_param('xc', False)
◆ param_box()
def originpro.analysis.NLFit.param_box |
( |
|
self | ) |
|
open a modal dialog box to control fitting parameters and iterations.
You can click the minimize button on the parameters dialog to manipulate the graph like zooming in, or use
screen reader etc. Must still call fit() after.
Parameters:
none
Returns:
none
Examples:
model = op.NLFit('Gauss')
wks=op.find_sheet()
model.set_data(wks, 0, 1)
model.param_box()
◆ report()
def originpro.analysis.NLFit.report |
( |
|
self, |
|
|
|
autoupdate = False |
|
) |
| |
you need to end the fitting by either calling result or report
Parameters:
autoupdate(bool): setup recalculation on the report or not
Returns:
(tuple): range strings of the report sheet and the fitted curves
Example:
model.fit()
r, c = model.report()
Report=op.find_sheet('w', r)
Curves=op.find_sheet('w', c)
print(Report)
print(Curves.shape)
◆ result()
def originpro.analysis.NLFit.result |
( |
|
self | ) |
|
you need to end the fitting by either calling result or report. If you need both, you need to call report first.
Parameters:
none
Return:
(dict) fitting parameters and statistics from the fit
Examples:
model = op.NLFit('Gauss')
wks=op.find_sheet()
model.set_data(wks, 0, 1)
model.param_box()
model.fit()
◆ set_data()
def originpro.analysis.NLFit.set_data |
( |
|
self, |
|
|
|
wks, |
|
|
|
x, |
|
|
|
y, |
|
|
|
yerr = '' , |
|
|
|
xerr = '' , |
|
|
|
z = '' |
|
) |
| |
set the XY data with optional error bar column, or XYZ data
Parameters:
wks(worksheet):
x,y(int or string):column index or name
yerr,xerr,z(int or string):column index or name
Returns:
none
Examples:
model=op.NLFit('Gauss')
wks=op.find_sheet()
model.set_data(wks, 0, 1, xerr='D' )
◆ set_mdata()
def originpro.analysis.NLFit.set_mdata |
( |
|
self, |
|
|
|
ms, |
|
|
|
z |
|
) |
| |
set the Matrix data
Parameters:
ms(matrix sheet):
z(int or string):matrix object index or long name
Returns:
none
Examples:
aa = np.array([ [1, 2, 3.9], [4.1, 5, 6], [7, 8.5, 9] ])
ma=op.new_sheet('m')
ma.from_np(aa)
model = op.NLFit('Plane')
model.set_mdata(ma,1)
◆ set_param()
def originpro.analysis.NLFit.set_param |
( |
|
self, |
|
|
|
p, |
|
|
|
val |
|
) |
| |
set a parameter value before fitting
Parameters:
p(str): name of a parameter
val(float): value for the parameter
Returns:
none
Examples:
model.set_param('xc', 0.5)
◆ set_range()
def originpro.analysis.NLFit.set_range |
( |
|
self, |
|
|
|
rg |
|
) |
| |
set data as range string
Parameters:
rg(string): range string
Returns:
none
Examples:
gl=op.find_graph()[0]
dp=gl.plot_list()[0]
model=op.NLFit('Lorentz')
model.set_range(dp.lt_range())
model.fit()
The documentation for this class was generated from the following file:
- src/originpro/analysis.py