Welcome to LabFit
pip install labfit
Python ≥ 3.10
LabFit is a small, student-friendly Python library for least-squares curve fitting, error propagation, and plotting.
It ships with built-in textbook models, convenience wrappers for quick analysis, and a plotting layer that can show residuals and multi-series comparisons.
Core goals:
Reproducible workflows from CSV to fitted curve in minutes.
Reduced χ² (chi-square) analysis returned for every fit so you can immediately assess goodness-of-fit.
Multiple series support - plot and fit many lines on one figure with a shared or individual axis.
Treat correlated and asymmetric errors correctly without rewriting propagation code each time.
Complete reference docs for fitting helpers, built-in model functions, plotting, and utilities.
5-minute quickstart - Get a working fit in 5 minutes: CSV, errors, fit, plot, χ². Quickstart
Concepts - Diagnostics, reduced χ², and error propagation. Concepts: reduced χ² and error propagation
How least-squares works - What residuals, χ² surfaces, and optimisers actually do. How least-squares fitting works
Fitting functions - All fitting entry points and built-in fitting models. Fitting functions
API Reference - API Reference
Utilities - CSV/TXT loading and uncertainty helpers. Utilities and I/O
Example gallery - Simple examples. Gallery
FAQ - Common pitfalls: correlated errors, bad initial guesses, weighting, and more. FAQ