Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Documentation

http://symfit.readthedocs.org

Project Goals

The goal of this project is simple: to make fitting in Python sexy and pythonic. What does pythonic fitting look like? Well, there’s a simple test. If I can give you pieces of example code and don’t have to use any additional words to explain what it does, it’s pythonic.

from symfit import parameters, variables, Fit

xdata = [1.0, 2.0, 3.0, 4.0, 5.0]
ydata = [2.3, 3.3, 4.1, 5.5, 6.7]
yerr = [0.1, 0.1, 0.1, 0.1, 0.1]

a, b = parameters('a, b')
x, y = variables('x, y')
model = {y: a * x + b}

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

Cool right? So now that we have done a fit, how do can we use the results?

import matplotlib.pyplot as plt

y = model(x=xdata, **fit_result.params)
plt.plot(xdata, y)
plt.show()
Linear Fit

Need I say more? How about I let another code example do the talking?

from symfit import parameters, Maximize, Equality, GreaterThan

x, y = parameters('x, y')
model = 2 * x * y + 2 * x - x**2 - 2 * y**2
constraints = [
    Equality(x**3, y),
    GreaterThan(y, 1),
]

fit = Maximize(model, constraints=constraints)
fit_result = fit.execute()

“But what if I need to fit to an ODE?”

from symfit import variables, Parameter, ODEModel, Fit, D

tdata = np.array([10, 26, 44, 70, 120])
adata = 10e-4 * np.array([44, 34, 27, 20, 14])

a, b, t = variables('a, b, t')
k = Parameter(0.1)

model_dict = {
    D(a, t): - k * a**2,
    D(b, t): k * a**2,
}

ode_model = ODEModel(model_dict, initial={t: 0.0, a: 54 * 10e-4, b: 0.0})

fit = Fit(ode_model, t=tdata, a=adata, b=None)
fit_result = fit.execute()

For more fitting delight, check the docs at http://symfit.readthedocs.org.

Metadata

Release files for symfit 0.3.3.dev155

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for symfit 0.3.3.dev155
File Size Uploaded Provenance Actions
symfit-0.3.3.dev155.tar.gz 867.0 kB Without provenance Details for symfit-0.3.3.dev155.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for symfit 0.3.3.dev155
File Interpreter ABI Platform Actions
symfit-0.3.3.dev155-py2.py3-none-any.whl Python 3, Python 2 none any Details for symfit-0.3.3.dev155-py2.py3-none-any.whl

Total release size: 904.9 kB

Release files / symfit-0.3.3.dev155.tar.gz

Download URL symfit-0.3.3.dev155.tar.gz
Size 867.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ee7de03170a3a5987d3d20aa035166492462f98b99123c0496eeb354da877148
BLAKE2b-256 checksum
How to use checksums
902841260c3cbbc63e7bbcc9ba13ad9e8b8cf9951db5723feeb376aa186e0cf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / symfit-0.3.3.dev155-py2.py3-none-any.whl

Download URL symfit-0.3.3.dev155-py2.py3-none-any.whl
Size 37.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
672f1e8b8f078dec2db5a9db2db7d536c3c8593dc182e624486b30d8609552fb
BLAKE2b-256 checksum
How to use checksums
efab8d1f93ce9af1211307b1582624743388368ebc7856f4c0a7300c0d6014f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for symfit 0.3.3.dev155

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page