Fit

Interactive curve fitting for Linux, Windows and macOS

An interactive curve-fitting application. You load a data set, place curves on it, and the app fits them — one peak or a hundred, by hand or fully automatically.

Written in Free Pascal with Lazarus. It runs on Linux, Windows and macOS.

Automatic decomposition

One command, Fit → Automatically, turns a raw profile into a small set of curves. It subtracts the background and seeds a curve on every point of every peak. It then removes curves one at a time for as long as the fit stays within the accuracy you set, the maximum acceptable R-factor. What is left is the fewest curves that accuracy allows. You don't guess the number of curves or tune a penalty weight. On the two-peak sample that ships with Fit, 32 starting curves come down to 3 in well under a minute.

How many curves does the profile need? — the rule, and how it compares with AICc, BIC and the other published methods.

Download

Built by CI from the sources in this repository. On macOS, build it yourself: one script produces Fit.app and installs it.

PlatformDownload
Linux (x86-64)Fit-linux.tar.gz — portable archive
Debian, Ubuntu (x86-64)Fit-linux.debsudo apt install ./Fit-linux.deb
Fedora, RHEL, openSUSE (x86-64)Fit-linux.rpmsudo dnf install ./Fit-linux.rpm
Windows (x86-64)Fit-windows-setup.exe — installer
macOS (Apple Silicon, Intel)./scripts/build-app.ps1 -Task all -Install

Each link above serves the latest release · all releases

Fit is two programs: the desktop client, which has no fitting engine of its own, and the compute server it talks to over HTTP. Every installed Fit starts the server itself — the Windows shortcut, the Linux fit command and Fit.app all launch through a wrapper that starts a server on port 8787 when nothing answers there, and reuses one that does. The portable Linux archive is the exception: start fit_server before the client.

Building from source covers the script, the macOS bundle and a Lazarus IDE walkthrough with exact versions.

Watch it work

A fitted profile, with the curve list and parameters beside it

Where it stands

Capability State Detail
Curve typesImplemented13 registered, including user-defined formulas
Data loadersPartial2 formats read (Diffraction profile, Price data, OHLC). 1 loader class declared but not registered — a stub that raises ENotImplemented.
Data exportPlannedNo export at all yet
Compute backendsImplementedDownhill Simplex (native), Levenberg-Marquardt (Python/lmfit). A remote fit_server is a transport choice of the native engine, not a separate engine.
ObjectivesImplemented4, with curve-type compatibility derived from capabilities
REST APIImplemented14 verbs. Self-describing: the running server assembles its own OpenAPI 3.0.3 document at /openapi.json and renders it at /docs. Not committed anywhere - what a build serves is what that build does.
Module registrationImplemented11 seams; the framework ships no module
Argument axesImplementedDisplay-only: an axis never alters stored data or the fit
Charting componentPlannedBlocks per-point labels and point dragging
Scripting and batch runsPlannedNo way to drive a fit without the window
Parallel and GPU computePlannedFit intervals are not run in parallel yet
Native installers and signingPartialArchives and .deb/.rpm are built; signing is off by default

Using it

Extending it

Fit is a framework as much as an application. A new curve type, data loader, optimiser, objective, REST verb or whole analysis vertical is added by registration — a directory plus one entry on a project's unit search path. No framework file changes.

These pages are generated from the registries this build actually contains, every time the site is published:

The prose that goes with them lives in the repository: writing a module · a complete working module in six files · AGENTS.md, the invariants, for AI agents working on the code.

Command line

OptionEffect
/PROJECT=file_nameopens a saved project at start-up
/INFILE=file_namestarts a new project with this data file, even over /PROJECT
/LOG_LEVEL=levelfatal, warning, notification, debug or trace — only ever turns the log down
/WRITE_PARAMS_LOGlogs every variable parameter during a fit

The client and the server keep separate logs — fit_client.log and fit_server_log.txt — in $HOME/Fit/ on Linux and macOS, or C:\Users\<user>\AppData\Roaming\Fit\ on Windows. Each rotates at 32 MB, keeping one previous generation as <name>.1.

Test data

A sample data set ships inside every download, under Data/. Separately: test_data.zip.

Contributing

This repository is published as a snapshot: each publication replaces main with a single commit, so a pull request cannot be merged directly. Open an issue or attach a patch — see CONTRIBUTING.md.

GPLv3-or-later. Documentation CC BY 4.0.