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.2.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.2.0
File Size Uploaded
scientificfitting-0.2.0.tar.gz 47.5 kB Details

Built distribution (wheel)

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

Total release size: 77.8 kB

Release files / scientificfitting-0.2.0.tar.gz

Download URL scientificfitting-0.2.0.tar.gz
Size 47.5 kB
Tags Source
SHA-256 checksum
How to use checksums
16d07a3d4cc2fad9ac46e68c74a1192b38e75defc341eb2cc4f57d6495ab9a5a
BLAKE2b-256 checksum
How to use checksums
cd1c44af0f8eec1724ac0a0a91a6879af4fc792cb9e8f5b0a6d9bed5c567f690
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 10, 2026.

Transparency log

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

Download URL scientificfitting-0.2.0-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ea350b8851d2bc527123a2e6542cbc6f0b9ed9467387fb0af1e6a8eb0d9b18b
BLAKE2b-256 checksum
How to use checksums
00e4c60c50851c94d69072d5276f5cd9f9578579910458618ac072b55dd635af
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 10, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.0 This release

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