|
| __init__ (self, func, method='auto') |
|
| __del__ (self) |
|
| set_data (self, wks, x, y, yerr='', xerr='', z='') |
|
| set_mdata (self, ms, z) |
|
| set_range (self, rg) |
|
| fix_param (self, p, val) |
|
| set_param (self, p, val) |
|
| set_lbound (self, p, ctrl='>', val=None) |
|
| set_ubound (self, p, ctrl='<', val=None) |
|
| param_box (self) |
|
| fit (self, iter='') |
|
| result (self) |
|
| report (self, autoupdate=False) |
|
|
| func = func |
|
str | _odr = 'odr': |
|
|
| _get_tree_name (self) |
|
| _set (self, property, value) |
|
| _get (self, property) |
|
| _func_section (self, section) |
|
| _general_info (self, key) |
|
| _set_bound (self, lu, p, ctrl, val, ctrlonx, ctrlon) |
|
|
str | _tree_name = '' |
|
bool | _ended = False |
|
| _trfdf = ET.fromstring(po.LT_get_str(f'GetFDFAsXML("{self.func}")$')) |
|
str | _implicit = 'Implicit' |
|
bool | _odr = False |
|
int | _numDeps = int(self._general_info('NumberOfDependentVariables').text) |
|
int | _numIndeps = int(self._general_info('NumberOfIndependentVariables').text) |
|
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()
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()
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()
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()
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()
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()
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_lbound()
originpro.analysis.NLFit.set_lbound |
( |
| self, |
|
|
| p, |
|
|
| ctrl = '>', |
|
|
| val = None ) |
set parameter lower bounds in NLFit.
Parameters:
p(str): name of a parameter
ctrl(str): '>' or '>='
val(float): lower bound value
Returns:
none
Examples:
import originpro as op
wks = op.new_sheet()
fn=op.path('e') + r'Samples\Curve Fitting\Gaussian.dat'
wks.from_file(fn, False)
model2 = op.NLFit('Gauss')
model2.set_data(wks, 0, 1)
model2.set_lbound('y0','>','6')
model2.set_ubound('A','<','800')
model2.fit()
r, c = model2.report()
◆ set_mdata()
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()
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()
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()
◆ set_ubound()
originpro.analysis.NLFit.set_ubound |
( |
| self, |
|
|
| p, |
|
|
| ctrl = '<', |
|
|
| val = None ) |
set parameter upper bounds in NLFit.
Parameters:
p(str): name of a parameter
ctrl(str): '<' or '<='
val(float): upper bound value
Returns:
none
Examples:
import originpro as op
wks = op.new_sheet()
fn=op.path('e') + r'Samples\Curve Fitting\Gaussian.dat'
wks.from_file(fn, False)
model2 = op.NLFit('Gauss')
model2.set_data(wks, 0, 1)
model2.set_lbound('y0','>','6')
model2.set_ubound('A','<','800')
model2.fit()
r, c = model2.report()
The documentation for this class was generated from the following file:
- src/originpro/analysis.py