scipy_residual_to_lmfit¶
- class utilipy.data_utils.fitting.scipy_residual_to_lmfit(func: Optional[Callable] = None, var_order: Optional[list] = None)[source]¶
Bases:
ObjectProxydecorator to make scipy residual functions compatible with lmfit.
(see https://lmfit.github.io/lmfit-py/fitting.html)
- Parameters
- var_orderlist of strs
the variable order used by lmfit the strings are the names of the lmfit parameters must be in the same order as the scipy residual function
- Returns
- scipy_residual_to_lmfitclass
internally constructed class
Notes
the function can be called as normal add a .lmfit function for use in lmfit minimizations see https://lmfit.github.io/lmfit-py/fitting.html
>>> @scipy_residual_to_lmfit(var_order=['amp', 'phase', 'freq', 'decay']) ... def residual(vars, x, data, eps_data): ... amp, phase, freq, decay = vars ... # calculate residual here ... return res
Initialize Proxy.
Methods Summary
decorator(var_order)Decorator.
lmfit(params, *args, **kwargs)lmfitversion of function.Methods Documentation