Fit

Interactive curve fitting for Linux, Windows and macOS

User guide

Getting started

What Fit is

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Fit describes a measured profile as a sum of curves and tells you the parameters of each curve.

A profile is a list of points: an argument, such as an angle, an energy or a time, and a measured value at each one. Where several peaks overlap, the profile alone does not say how large each peak is or where exactly it sits. Fit answers that by building a model - a set of curves of a chosen type - and adjusting the curves until their sum matches the data as closely as it can.

This is usually called curve fitting, or profile decomposition. The result is a position, a width, an amplitude and whatever else the curve type has, for every curve, together with how good the whole fit is.

The curve types this build offers are listed under Model > Curve Type and in the Tools tab: Gaussian, Lorentzian, Pseudo-Voigt and others, and curves you define yourself by a formula. You can place the curves by hand, or let Fit > Automatically decide how many curves the profile needs.

Fit is meant for research and for teaching alike. For research, a project file keeps everything needed to reproduce and continue a fit. For teaching, everything the program shows explains itself: the Explain pane and Help > Explain Everything say what a thing is, why it behaves as it does, and how much authority stands behind that.

Limitations

See also: The window and the compute server · A first fit · How much authority an explanation has

The window and the compute server

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Fit is two programs: the window you work in, and a compute server, fit_server, that does every fit.

The window holds your data, draws the chart and the tables, and sends every calculation to the compute server over HTTP. The window has no fitting engine of its own, so without a server it can show a profile but cannot fit anything.

By default the window looks for the server at http://127.0.0.1:8787, that is, on port 8787 of this computer. Fit > Compute Server changes that address; the address is remembered between sessions, and an empty one means the default. If nothing answers at the address you give, the window says so and names the address it tried.

You do not normally start the server yourself. The installed shortcut does not start the window directly but a small launcher: on Windows fit_launcher.exe, on Linux and macOS a launcher script. The launcher asks whether a server already answers on port 8787. If none does, it starts fit_server in the background and waits up to ten seconds for it to say it is listening. Then it starts the window.

The server keeps running after you close the window. The next start finds it and is immediate, and a second window shares the same server instead of taking it away from the first in the middle of a fit.

A server can also run on another machine: start fit_server there with --host and --port, and give its address in Fit > Compute Server. Help > Compute Backends explains the engines the server can fit with, including the optional Python one.

The environment variable FIT_PORT moves the server to another port: the launchers start it there, and the window looks for it there unless Fit > Compute Server names another address.

Limitations

See also: Log files · Command-line options

The main window at a glance

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

The window has a chart in the middle, tools on the left, the model on the right and tables of numbers along the bottom.

From top to bottom and left to right:

The same command is often reachable in several ways - a menu entry, a toolbar button, a button in the Tools tab - and they all do the same thing.

See also: A first fit · The Explain pane

A first fit

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Import a profile, choose a curve type, run Fit > Automatically and read the result in the tables below the chart.

Fit > Automatically is greyed out until a profile has been imported or a project opened, and while another fit is running.

Limitations

See also: Automatic decomposition · Import Profile · Sample data · Fitting by hand, step by step · Export Curve Parameters · Save Project · Fit progress

Fitting by hand, step by step

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Instead of letting the program decide, you can say where the background is, what to fit and where the curves go, and then fit.

Doing it by hand takes longer and gives you control. The steps below are an overview; each command has its own explanation.

Then look at the Difference series, add or delete curves where it says something is missing or superfluous, and fit again: each fit starts from where the last one finished.

The Tools tab carries the same commands as buttons, which is quicker when you go round this loop many times.

Limitations

See also: A first fit · The main window at a glance

The Explain pane

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

A pane below the model list that explains whatever you are looking at, as you look at it.

The pane sits at the bottom of the Model tab, on the right of the window. It follows your attention: the curve type you chose, the row you selected in the model list, or a menu entry the pointer rests on while its menu is open, when that entry has an explanation.

Each explanation has a title, a one-sentence summary, a label saying how much authority stands behind it, the explanation itself, and where they apply its limitations, its references and related topics. A related topic is a link: following it shows that topic in the pane. A link to a web page opens in your browser.

When nothing explainable is in focus, the pane is empty. To browse everything instead, use Help > Explain Everything.

Limitations

See also: Explain Everything · How much authority an explanation has

Explain Everything

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Help > Explain Everything opens a window listing every explanation this build can give, including this user guide.

The list on the left is grouped under headings: the chapters of this guide first, in the order they are meant to be read, then what the curve types and any analysis modules explain about themselves. Within a heading the entries are in alphabetical order, so you can find one by eye.

Click an entry to read it on the right. Links to related topics open those topics in the same window; links to web pages open in your browser.

The window stays open beside the main window while you work, so you can keep an explanation in view while you try what it describes.

The same explanations are published as the user guide on the web, generated from what the program itself carries, so the two say the same thing.

Limitations

See also: The Explain pane · How much authority an explanation has

How much authority an explanation has

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Every explanation carries one of four labels saying whether it rests on the field's sources, on common practice, or on a choice this program made.

A program that teaches has to say not only what it does but on what grounds. The label under each explanation's title does that:

The difference matters when you report a result: a canonical rule can be cited, while a choice of this program should be named as such.

Limitations

See also: The Explain pane · Explain Everything

About Fit

This software's choiceA decision made by this software rather than by the field's sources; the explanation says why it was made.

Help > About shows which version of Fit you are running.

The dialog shows the program's name and icon, the version number read from the running program itself, its author, and a View at GitHub link that opens the author's GitHub page in your browser. OK closes it.

Quote the version when you report a problem or describe how a result was obtained. A project file records the version that wrote it as well.

Limitations

See also: What Fit is · Projects