The very difference of adaptive-curvefitting with numpy.polyfit, scipy.optimize.curve_fit or scipy.optimize.least_squares is the hypothesis you don’t know which model to fit. If you already have the expected model, the methods in scipy and numpy are fantastic tools and better than this one. When you explore something unknown, this will be a maybe.
Quick installation with pip:
pip install adaptive-curvefitting
Or from github:
pip install git+https://github.com/longavailable/adaptive-curvefitting
pip install --upgrade adaptive-curvefitting
pip uninstall adaptive-curvefitting
or import the specified function:
from longscurvefitting import oneClickCurveFitting from longscurvefitting import generateFunction from longscurvefitting import generateModels
There are some optional arguments of
curve_fit_m. Note that
p0will take no effect when multi-models.
See the complete example “/tests/curvefitting.py”.
Create a model composited by gaussian and erf function:
funcs = ['gaussian','erf'] myfunc = generateFunction(funcs, functionName='myfunc', operator='+')['model']
See the complete example “/tests/custom_a_model.py”.
See the complete example “/tests/reuse_the_fitted_model.py”.
p0were not supported due to the basic hypothesis.
If this tool is useful to your research, star and cite it as below:
Xiaolong Liu, & Meixiu Yu. (2020, June 14). longavailable/adaptive-curvefitting. Zenodo. http://doi.org/10.5281/zenodo.3893596
Easily, you can import it to Mendeley.
queryModel()to simplify the reuse of a fitted model.
from scipy._lib._util import getargspec_no_self as _getargspecwith
from ._helpers import funcArgsNr