Skip to main content

ScientificFitting for Python

Fit NumPy models to measurement data with Gaussian errors, Poisson counts, or your own likelihood. Bounds, shared parameters, profiles, and diagnostic reports use the same numerical core as ScientificFitting.jl. Optional plots are ordinary, editable Matplotlib figures, not Julia/Makie objects.

Installation

In a Python 3.10+ environment:

python -m pip install 'scientificfitting[plot]'

JuliaCall installs a compatible Julia runtime and dependencies automatically. First use requires internet access and compilation; subsequent fits reuse that installation. The wheel is small, but Julia and its dependencies are separate downloads and take additional disk space. No manual Julia setup is required. Matplotlib and SciPy are optional (plot and sparse extras).

import numpy as np
from scientificfitting import fit_model, plot_fit

def line(x, slope, offset):
    return slope * x + offset

x = np.array([0., 1., 2., 3.])
y = np.array([0.1, 1.2, 1.9, 3.2])
fit = fit_model(line, x, y, p0={"slope": 1., "offset": 0.}, sigma_y=0.2)
print(fit.report())
fig, ax = plot_fit(fit, xlabel="x / mm", ylabel="U / V")
ax.axvline(1.5, color="black", linestyle="--")
fig.savefig("calibration.pdf")

Measurement errors are inputs. Reported parameter errors are local covariance approximations; profiles help examine asymmetry and non-quadratic behavior. This is likelihood optimization, not posterior sampling. Python callbacks use finite derivatives or supplied analytic Jacobians, not Julia dual numbers.

See the Python guide for likelihoods, covariance, diagnostics, and native Matplotlib composition. Bug reports and scientific use cases are welcome. MIT licensed, copyright Amin El Sayed.

Development

To use a source checkout instead of the registered Julia core:

python -m pip install -e './python[plot,test]'
python python/develop.py
python -m pytest python/tests

Metadata

Release files for scientificfitting 0.3.0

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

Source distribution (sdist)

Source distribution for scientificfitting 0.3.0
File Size Uploaded
scientificfitting-0.3.0.tar.gz 47.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scientificfitting 0.3.0
File Interpreter ABI Platform
scientificfitting-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 77.3 kB

Release files / scientificfitting-0.3.0.tar.gz

Download URL scientificfitting-0.3.0.tar.gz
Size 47.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dab8ba3d4e3b5a2a9380b8f083fda73e0a760c28cc401f377a69ae213a37b458
BLAKE2b-256 checksum
How to use checksums
e8ba8f1aef2e932b627589ab8279a82c039d73df72aad2847f29f9335c2d7343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / scientificfitting-0.3.0-py3-none-any.whl

Download URL scientificfitting-0.3.0-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbfb0105a05eea4c666f8dd43863ebcb936b53550d4ad454356e9b88e51fbaae
BLAKE2b-256 checksum
How to use checksums
b076c858ed2ce27682e441ec1a04591e7cf5fa9320cff98f7e642466ba77b029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

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