Fitting

Automated peak fitting functions using lmfit. If lmfit is installed, scan objects will automatically contain the scan.fit class with various automated methods.

See: https://lmfit.github.io/lmfit-py/builtin_models.html

from babelscan.fitting import multipeakfit
fit = multipeakfit(xdata, ydata)  # returns lmfit object
print(fit)
fit.plot()
example fitting of multiple profiles to a 1D peak