Skip to main content

CurveLab

Interactive curve fitting application for 1D experimental data, built on lmfit.

CurveLab provides a desktop GUI (Tkinter) and a Jupyter notebook widget for loading data, building composite models, fitting curves, and analyzing results -- all without writing code.

curvelab

This project is also an experiment in AI-assisted coding.

Features

  • 34 built-in models -- Gaussian, Lorentzian, Voigt, PseudoVoigt, exponential, polynomial (up to degree 7), spline, step, sine, and more, plus Bose and Fermi when lmfit >= 1.3 is installed. Custom expressions supported.
  • Composite models -- combine components with +, *, -, / operators
  • 14 fitting methods -- Trust Region Reflective (default), Levenberg-Marquardt, Nelder-Mead, differential evolution, basin-hopping, MCMC (emcee), brute-force grid search, ODR, and more
  • 9 file formats -- CSV, TSV, TXT/DAT, Excel, ODS, JSON, Parquet, HDF5, SQLite, plus clipboard paste
  • Multi-series / multi-session -- plot multiple datasets, run multiple fit sessions per series, batch fit across all series
  • Statistical analysis -- confidence intervals, correlation/covariance matrices, diagnostic plots, bootstrap CI, profile likelihood, F-test, model comparison (AIC/BIC), uncertainty propagation, 2D confidence contours
  • Data tools -- auto peak detection, derivative/integral, Savitzky-Golay smoothing, outlier detection (MAD-based sigma-clipping), point exclusion, column calculator, data simulation
  • Export -- parameters (CSV), fit reports, curve data, plots (PNG/PDF/SVG), lmfit ModelResult (.sav)
  • Workspace persistence -- save/load entire sessions as .clw files
  • Jupyter support -- full-featured CurveLabWidget with ipywidgets

Quick Start

pip install curvelab
curvelab

Or from a clone, for development:

git clone https://github.com/cosine-eu/curvelab.git
cd curvelab
pip install -e .
curvelab

In a Jupyter notebook:

%matplotlib widget
from curvelab.notebook import CurveLabWidget
CurveLabWidget()

See the Installation Guide for detailed instructions, optional dependencies, and troubleshooting.

Documentation

Architecture

DataManager --> SeriesRecord --> PlotManager (display)
                            --> FitManager --> lmfit.Model --> FitResult

Core logic is GUI-agnostic. The two frontends (app.py for Tkinter, notebook.py for Jupyter) coordinate between the core modules. See the User Manual for details.

GUI-agnostic core:

Module Role
fit_manager.py Composite model building, auto-guess, fitting, GOF metrics
data_manager.py Tabular data loading with auto-detection
models.py Registry of the built-in lmfit models
session.py Dataclasses: SeriesRecord, FitSession, FitResult
preprocessing.py Data cleaning (mask, range filter, NaN/inf, sort)
analysis_tools.py Dialog numerics (peaks, smoothing, outliers, F-test)
workspace.py JSON serialization for save/load
plot_manager.py Matplotlib figure management (dual-axis, error bars, bands)

Desktop application -- CurveLabApp is composed from mixins, one per area of responsibility:

Module Role
app.py CurveLabApp itself: composition, layout, parameter table
app_menu.py Menu bar construction
app_series.py Dataset/series/session lifecycle
app_plotting.py Drawing series, fits, and residuals
app_fit_handlers.py Fit, batch fit, abort, pre-fit validation
app_analysis_handlers.py Analysis-menu dialog wiring
app_data_tools.py Data-tool dialog wiring
app_workspace.py Save/load workspace, exports

User interface and notebook:

Module Role
ui_panels.py Tkinter UI panels (data, fit, plot controls, results)
ui_dialogs_analysis.py Statistical analysis dialogs (CI, contours, bootstrap, etc.)
ui_dialogs_data.py Data tool dialogs (peaks, smooth, derivative, simulate)
ui_common.py Shared widget helpers (BaseDialog, table row tints)
notebook.py Jupyter notebook widget (ipywidgets)

Dependencies

Core: numpy, pandas, matplotlib, scipy, lmfit, asteval, uncertainties, numdifftools, emcee, tqdm

Optional: ipywidgets/ipympl (notebook), openpyxl (Excel), odfpy (ODS), tables (HDF5), pyarrow (Parquet), odrpack (ODR), pytest/pytest-cov (test)

See the Installation Guide for how to install optional dependency groups.

BSD-3-Clause license

Copyright 2026 Giuseppe Vacanti giuseppe@vacanti.org

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Metadata

Release files for curvelab 0.11.3

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

Source distribution (sdist)

Source distribution for curvelab 0.11.3
File Size Uploaded
curvelab-0.11.3.tar.gz 168.4 kB Details

Built distribution (wheel)

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

Total release size: 316.4 kB

Release files / curvelab-0.11.3.tar.gz

Download URL curvelab-0.11.3.tar.gz
Size 168.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8fca875fc3de638e7205a7c09152e0778c096881e590ae7475e4820f42068420
BLAKE2b-256 checksum
How to use checksums
b5d0bc22da842a2c765ac9214d3f12374542e96b58caed5f6934cc0e7f5215e2
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 Aug 3, 2026.

Transparency log

Release files / curvelab-0.11.3-py3-none-any.whl

Download URL curvelab-0.11.3-py3-none-any.whl
Size 148.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0de5dfc27c63b3a8f2aa246477709420d4507d47eb35a997b47675270597735
BLAKE2b-256 checksum
How to use checksums
9e41b7ed4166b40ed1241d176f261bc02408d097fee60a30b352b1118280bb9d
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 Aug 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.11.3 This release

2 release files

0.9.3

2 release files

0.9.2

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