Metadata-Version: 2.5
Name: fitwise
Version: 0.1.1
Summary: Curve fitting made easy: one call, one fit, one report you can trust.
Project-URL: Homepage, https://github.com/maroba/fitwise
Project-URL: Documentation, https://maroba.github.io/fitwise/
Project-URL: Repository, https://github.com/maroba/fitwise
Project-URL: Issues, https://github.com/maroba/fitwise/issues
Project-URL: Changelog, https://github.com/maroba/fitwise/blob/main/CHANGELOG.md
Author-email: Matthias Baer <matthias.r.baer@googlemail.com>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: curve fitting,data analysis,least squares,lmfit,regression,uncertainty
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: lmfit>=1.3
Requires-Dist: numpy>=1.26
Requires-Dist: scipy>=1.12
Provides-Extra: all
Requires-Dist: matplotlib>=3.8; extra == 'all'
Requires-Dist: odrpack>=0.6; extra == 'all'
Requires-Dist: pandas>=2.1; extra == 'all'
Requires-Dist: pint>=0.23; extra == 'all'
Requires-Dist: sympy>=1.12; extra == 'all'
Requires-Dist: uncertainties>=3.2; extra == 'all'
Provides-Extra: batch
Requires-Dist: pandas>=2.1; extra == 'batch'
Provides-Extra: odr
Requires-Dist: odrpack>=0.6; extra == 'odr'
Provides-Extra: plot
Requires-Dist: matplotlib>=3.8; extra == 'plot'
Provides-Extra: symbolic
Requires-Dist: sympy>=1.12; extra == 'symbolic'
Provides-Extra: units
Requires-Dist: pint>=0.23; extra == 'units'
Requires-Dist: uncertainties>=3.2; extra == 'units'
Description-Content-Type: text/markdown

# fitwise

**One call. One fit. One report you can trust.**

[![Tests](https://github.com/maroba/fitwise/actions/workflows/test.yml/badge.svg)](https://github.com/maroba/fitwise/actions/workflows/test.yml)
[![PyPI](https://img.shields.io/pypi/v/fitwise.svg)](https://pypi.org/project/fitwise/)
[![License: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE)

> **Status: alpha (0.1).** Fitting, built-in models, report, plot and export work and are
> tested against the NIST reference data. The API may still change before 1.0.
> **Documentation: https://maroba.github.io/fitwise/**

`fitwise` is an ergonomic layer over [`lmfit`](https://lmfit.github.io/lmfit-py/) and
[`scipy`](https://scipy.org/) for curve fitting in the lab. It brings no new solver of its own.
Instead it makes the existing ones fast to use and hard to misuse:

```python
import fitwise as fw

result = fw.fit(fw.models.gaussian, x, y, yerr=dy)
print(result)              # report: parameters ± errors, χ²/ndf, R², correlations, warnings
result.plot()              # data, fit, confidence band, residuals
result.params["sigma"]     # value, uncertainty, unit
```

## What it does for you

- **Picks the solver:** direct linear least squares when the model is linear in its parameters,
  Levenberg–Marquardt otherwise, and orthogonal distance regression when `xerr` is given.
- **Finds starting values,** including for your own functions, and shows how it found them.
- **Gives honest uncertainties:** a documented covariance convention, confidence and prediction
  bands, and bootstrap or profile likelihood on request.
- **Warns instead of returning wrong numbers:** non-convergence, parameters at a bound, poor
  χ²/ndf and strong correlations all show up in the report.
- **Makes fits reproducible:** `result.to_dict()` captures everything needed to repeat the fit.

## Installation

```bash
pip install fitwise            # core: numpy, scipy, lmfit
pip install "fitwise[all]"     # + plotting, ODR, units, symbolic models, batch fits
```

## Development

```bash
uv sync --all-extras           # create .venv with all extras and dev tools
uv run pre-commit install
uv run pytest                  # fast tests
uv run pytest -m nist          # NIST StRD reference suite
```

## License

BSD-3-Clause
