Data Plotter & Curve Fitter: a GUI for lmfit
Project description
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.
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, Bose, Fermi, and more. 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
- 10 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
.clwfiles - Jupyter support -- full-featured
CurveLabWidgetwith ipywidgets
Quick Start
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
- Installation Guide -- prerequisites, setup, optional dependencies, troubleshooting
- User Manual -- comprehensive guide covering all features, workflows, and references
- AI-Assisted Coding Experiment -- background on how this project was built
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.
| Module | Role |
|---|---|
app.py |
Main Tkinter application, central coordinator |
notebook.py |
Jupyter notebook widget (ipywidgets) |
fit_manager.py |
Composite model building, auto-guess, fitting, GOF metrics |
data_manager.py |
Tabular data loading with auto-detection |
models.py |
Registry of 34+ built-in lmfit models |
plot_manager.py |
Matplotlib figure management (dual-axis, error bars, bands) |
preprocessing.py |
Data cleaning (mask, range filter, NaN/inf, sort) |
session.py |
Dataclasses: SeriesRecord, FitSession, FitResult |
workspace.py |
JSON serialization for save/load |
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) |
Dependencies
Core: numpy, pandas, matplotlib, lmfit
Optional: ipywidgets/ipympl (notebook), openpyxl (Excel), odfpy (ODS), tables (HDF5), odrpack (ODR)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file curvelab-0.9.3.tar.gz.
File metadata
- Download URL: curvelab-0.9.3.tar.gz
- Upload date:
- Size: 131.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee6528123eb52d9f40a5204070b1d26ec788f641bf2d62833473f101ab6db593
|
|
| MD5 |
1cbb80ce01be9d1086a368a8227ef5bf
|
|
| BLAKE2b-256 |
3ccb0b41fa577a34c8f8d202c72db4ee68a0de98f8af549f381d43663154f696
|
File details
Details for the file curvelab-0.9.3-py3-none-any.whl.
File metadata
- Download URL: curvelab-0.9.3-py3-none-any.whl
- Upload date:
- Size: 128.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83692966e8d62559b85f4b291b028bd5c2a121956f4f57a894576c4509fa0236
|
|
| MD5 |
8a29e7a576928e46031246fe251142f2
|
|
| BLAKE2b-256 |
1b0190b393bf9ffa6ae257491f9b3f5bc4d14862fbeead640e1b5299701a1d9f
|