Skip to main content

symfit; data fitting for the practical man.

Project description

Existing fitting modules are not very pythonic in their API and can be difficult for humans to use. This project aims to marry the power of scipy.optimize with the readability of SymPy to create a highly readable and easy to use fitting package which works for projects of any scale.

symfit makes it extremely easy to provide guesses for your parameters and to bound them to a certain range:

a = Parameter(1.0, min=0.0, max=5.0)

To define models to fit to:

x = Variable()
A = Parameter()
sig = Parameter(1.0, min=0.0, max=5.0)
x0 = Parameter(1.0, min=0.0)

# Gaussian distribution
model = A * exp(-(x - x0)**2/(2 * sig**2))

To execute the fit:

fit = Fit(model, xdata, ydata)
fit_result = fit.execute()

And finally, to evaluate the model using the best fit parameters:

y = model(x=xdata, **fit_result.params)
Gaussian Data

For more examples, check out the docs at http://symfit.readthedocs.org/.

New in 0.3.0:

You can now name dependent variables:

x, y = variables('x, y')
model = {y: a * x**2}

Allowing for very clear assignment of data and standard deviations:

fit = Fit(model, x=xdata, y=ydata, sigma_y=sigma)
fit.execute()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for symfit, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size symfit-0.3.0-py3-none-any.whl (32.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size symfit-0.3.0.tar.gz (27.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page