Skip to content

Fit

Interactive curve fitting for Linux, Windows and macOS

User guide

Model

The model

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

The model is what the program fits to the profile: curves of a chosen shape, placed at positions and fitted over intervals.

It is built from three parts:

A module included in the build may add parts of its own - a background under the curves, for one - and its chapter of this guide says what they are.

Once the model has at least one curve position and at least one fit interval bound, the program builds a curve at every position and draws it, with the computed profile and its difference from the data, before any fit. The curves are listed in the Model tab on the right and their parameters in the Curve Attributes table.

Each part can be picked by hand on the chart or proposed by the program - the Compute Automatically entries of the Model menu and the Auto buttons of the Tools tab. A fit also proposes what is missing: Fit > Minimize Difference computes the fit intervals when fewer than two bounds are set, and the curve positions when there are none.

The curve positions and the fit intervals are saved with the project, together with the settings that shape them.

Limitations

See also: Choosing a curve type · Curve positions · Fit intervals · Building the model from the Tools tab · The profile

Choosing a curve type

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

The curve type is the shape every curve placed from a position takes, and is chosen from Model > Curve Type or from the list at the top of the Tools tab.

Model > Curve Type opens a submenu of groups, one for each module included in the build that brings curve types - its chapter of this guide says what they are. The type in use is ticked.

The same types are listed at the top of the Tools tab on the left, under the same group names. Click a type to select it; clicking a group name selects the first type under it.

Every curve type explains itself. Rest the pointer on a type in the Tools list to read a one-line summary of it. When you select a type, the Explain pane under the Model tab on the right shows its full explanation - what its formula means, what each parameter controls, where the shape is used and what it does not cover - and every type can also be found under Help > Explain Everything.

A type can be chosen before any data is loaded. While the axis rules are Automatic and the model is empty, choosing a type also sets the axes, when the data does not say what they are.

A model is made of the curve types of ONE module. Standard is one; a curve pack included in the build is another. While the model is empty any type can be chosen - that is how a model gets its module. Once it holds a pick or a curve, the types of every other module stay listed but greyed, in the menu and in the Tools list, and choosing one says why: each module covers its own kind of task, and curves of two of them fit nothing either understands. To change module, start a new project with File > New Project, or empty the model with Model > Clear Model.

Limitations

See also: The model · Argument axes and units

Building the model from the Tools tab

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

The Tools tab on the left carries the model-building commands as buttons, so a round of picking, fitting and adjusting needs no trip through the menus.

At the top is the list of curve types. Below it the buttons are grouped in the order the work is done:

A button runs exactly the command of its menu entry, shows the same hint, and is greyed whenever that entry is. A Pick button stays pressed while its picking mode runs; pressing it again ends the mode.

Each heading counts what the model holds - Positions (3) means three curve positions. A zero is shown rather than hidden.

A curve pack included in the build may add buttons of its own, under its own heading. The bar between the list and the buttons can be dragged to give either more room.

Limitations

See also: Choosing a curve type · Picking points on the chart · The model

Picking points on the chart

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

In a picking mode each left click on the chart adds the data point nearest the pointer to the set being built, and a click on a point already in the set takes it out.

Several commands start a picking mode: the Start Manual Selection entries for curve positions, fit intervals, the data range and any other set a module picks, and the Pick buttons of the Tools tab. Only one mode runs at a time: starting another ends the first, and choosing the same entry or button again ends it.

The entries for curve positions and fit intervals say whether their mode is on. They read Start Visual Position Selection or Start Visual Selection, and Stop Visual Position Selection or Stop Visual Selection while it runs; the matching Pick button stays pressed. The other picking entries are ticked instead.

A pick is made with the left button, and only if the mouse does not move between press and release; a drag zooms the chart instead. The pick goes to the data point nearest the pointer, measured on the screen in both directions, so every pick is a real point of the profile. A click that lands on a curve or another series drawn over the data is taken as a click on the data beneath it.

Clicking a point already in the set removes it. For curve positions this also removes the curve placed there. In a mode that takes a set number of picks - two ends of a range, three points of a peak - clicks after the last one are ignored.

The right button never picks: it opens the chart's menu of axis rules. The status line at the bottom of the window says what to pick next.

A curve position or a fit interval bound can also be moved, by typing its new position into the Curve Positions or the Fit Intervals table. A moved position keeps what a fit found for its curve; taking a position out with a click and picking another places a new curve, which starts again from the data.

Limitations

See also: Curve positions · Fit intervals · Working on part of the profile

Curve positions

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

A curve position is the argument where one curve of the model is placed; positions can be picked on the chart, proposed by the program or put at every data point.

Each position seeds one curve: the curve is placed there, and its height is taken from the data at that point. The Model > Curve Positions submenu offers four ways to set them:

The positions are listed in the Curve Positions table (Position and Amplitude) and drawn as the Curve positions series. After a fit a second series, Fitted positions, shows where each curve ended up; your picks never move. When nothing was picked - a model placed from a curve type's own markup - the table lists where the model's curves are instead.

The submenu and the Positions buttons are greyed until a profile is loaded, and while a fit runs.

Limitations

See also: Picking points on the chart · Deleting a curve · Fit intervals

Fit intervals

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

A fit interval is a stretch of the profile fitted as a problem of its own, marked by a pair of bounds.

Bounds come in pairs, and each pair encloses one interval. Splitting a profile into intervals keeps each fit small, and lets a stretch with no peaks in it be left out.

The intervals are listed in the Fit Intervals table (Starting Position and Final Position) and drawn as the Fit intervals series. An interval with only one bound picked so far shows its second cell empty.

A fit started with fewer than two bounds computes the intervals itself, as Compute Automatically does.

Each interval is fitted on its own - nothing in one reads another - so the intervals are fitted side by side, at most one per processor of the machine running the compute server. The model they reach is exactly the one fitting them one after another would reach; only the time differs. An engine running in another process (the Python one, or a remote compute server) is given one interval at a time, as before.

Limitations

See also: Picking points on the chart · Curve positions

The Model tab

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

The Model tab on the right lists the curves of the model, one row per curve with where it sits, and is where one curve is chosen to be explained or deleted.

Each row names a curve and its position. Curves a curve pack placed from its own markup are shown the way that pack describes them instead - a pattern with the patterns nested in it beneath it, as a tree you can collapse and expand. That does not depend on the curve type selected in the Tools list, which only says what you place next. Any other curves of the model follow, one row each.

Once the model holds anything, the tab's title names the module the model belongs to - "Model: Standard" for the framework's own curve types, or the name of the curve pack. A model holds one module's curves only, so the other modules' curve types are greyed until the model is cleared; the title is why. An empty model is just "Model": every curve type is open to it.

When there is nothing to list, the tab says why: no data file is open, no curve has been placed yet, or the selected curve type is placed from its own markup and none has been made.

Selecting a row shows the explanation of that curve's type in the Explain pane below the list. Right-clicking a row selects it and opens the commands that act on one curve, such as Delete curve.

See also: Deleting a curve · Choosing a curve type · The Curve Attributes table

The Curve Attributes table

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

The Curve Attributes tab at the bottom of the window lists every curve of the model with the value of each of its parameters.

There is one row per curve and one column per parameter name. When curves of different types share the model, the columns cover every parameter any of them has, and a cell is blank where a curve has no such parameter.

Values are shown with four decimals. Where the engine estimated an uncertainty it follows the value after a plus-minus sign; the built-in engine does not estimate one. Positions are shown on the argument axis in force, as on the chart.

Colour shows how each value is treated, and the row under the table names the colours: Fitted, Shared, Fixed and Computed. Rest the pointer on one to read what it means.

Select whole rows and choose Edit > Delete to remove those curves. A button above the table copies what is selected to the clipboard.

A value the fit varies can be typed over: click the cell, type the number and leave it. The engine rebuilds the model with it and the table and the chart are redrawn, so the next fit starts from there. A value shown in the table's units - an angle, for instance - is typed in those units.

A value outside the range its parameter allows - a width wider than the fit interval, say - is held at the nearest one allowed, and a message says so (see Limits on parameter values).

Limitations

See also: Limits on parameter values · Parameter kinds: fitted, shared, fixed and computed · Deleting a curve · The Model tab

Parameter kinds: fitted, shared, fixed and computed

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

Each parameter value in the Curve Attributes table is one of four kinds, which say whether and how the fit moves it.

The engine tells more kinds apart - which parameter is the amplitude, which the width, which the position - but to a reader of the table those differ only in how the fit starts them, so they are all shown as Fitted.

For the program's own curve types the kinds are part of the type. For a type whose shape is a formula you write, you choose them yourself when you define it.

See also: The Curve Attributes table

Limits on parameter values

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

Every parameter keeps to a range of its own, and a value outside it - proposed by a fit, typed into the table or read from a saved project - is held at the nearest one the range allows.

The ranges are these:

The limit is on the shape drawn, not on the number, because a width means different things in different curve types: each type says what its own width is, and its module's chapter lists them.

A curve type's own limits - how a module's background keeps above zero, what a formula's parameters may take - are in that module's chapter.

The same limits hold whichever engine fits: the Python engine and a compute server are handed each range, told which curves may not go below zero, and return a lifted background at the level it is drawn at. A limit that follows the shape is handed to the Python engine for the shape the fit starts from; when the fit reaches one where it no longer holds, it is fitted again with the limits of that shape, three times at most.

When a value is held at another, you are told: a value typed into the Curve Attributes table, with a message as you leave the cell; a project, or a model from its History, saved before a limit existed, with a message naming each value as it is put back. A program writing a value over the REST interface is answered with the value held and the same reason.

Limitations

See also: The Curve Attributes table · Fit intervals · Parameter kinds: fitted, shared, fixed and computed

Deleting a curve

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

Right-click a curve in the Model tab and choose Delete curve to remove it, together with the position it was placed from.

In the Model tab on the right, right-click the curve's row - the click also selects it - and choose Delete curve. The entry is greyed when the row does not stand for a curve, and while a fit runs.

There is no Model > Delete Curve entry in the menu bar: deleting one curve needs a curve to act on, and the selected row of the Model tab is what names it.

The position the curve was placed from goes with it - the model is rebuilt from the positions, so a position left behind would put the curve straight back. The other curves keep what the last fit found for them.

There are two other ways to remove curves: select whole rows of the Curve Attributes table and choose Edit > Delete, or, while picking curve positions, click a curve's position on the chart.

If the engine cannot remove a curve on its own - one a curve pack placed from its markup, for example - it refuses, and the message says why.

Limitations

See also: Clearing the model · The Model tab · Curve positions

Clearing the model

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

Model > Clear Model removes every curve from the model at once, after asking.

It is the last entry of the Model menu. It asks whether to remove all the curves, naming how many, says that their picks go with them and that this cannot be undone, and does nothing unless you answer Yes.

Each curve is removed as Delete curve removes one, its position included, so you start again from an empty model on the same data. The fit intervals, the background points and the curve type are kept.

The entry is greyed while the model holds no curve, until a profile is loaded, and while a fit runs.

A curve the engine keeps stays where it is: one that the curve type builds per fit interval rather than from a position is rebuilt at once, and a curve pack may decline to give one up. A single message then says how many curves stayed and why.

Limitations

See also: Deleting a curve · The model · The model history

The model history

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

Every run that ends records the model it reached, so you can go back to any of them, compare them and carry on from the best.

A model is recorded when Fit > Minimize Difference, Fit > Minimize Number of Curves or Fit > Automatically ends - also when Stop cut it short, because what a stopped run reached is the model from then on. A run that the engine refused records nothing, and so does a run that left the model exactly as it was, so pressing Fit on a converged model does not add a row.

What is recorded is the whole model, as a project file holds one: the curve type and the settings, the fit intervals, the background, the curve positions, the fitted values of every curve, what any analysis module keeps about it, and the profile it was fitted to. The R-factor and the statistics it reached are recorded with it.

Make Current - a right-click on the row in the History tab, its button, a double-click on the row, or Enter - puts the selected model back exactly as it was recorded, on the profile it was fitted to, and measures it so that its R-factor shows again. The next fit starts from it, and the model that fit reaches is recorded as fitted from it, which is how a branch starts.

Making a model current never loses work. If the current model holds changes no recorded model has - a position moved or a value typed since the last fit - it is recorded first, as "Edited, not fitted", and you can come back to it like any other.

Rename..., on the same right-click menu, gives the selected model a name of your own, shown first in its row. Delete... removes it after asking; the current model is not changed, and the models fitted from the one deleted are shown as fitted from the one before it. If the deleted model was the current one, the next model recorded from the window - by a fit, or as "Edited, not fitted" - is shown as fitted from the one before it too. All three are greyed while a fit runs, and Make Current is greyed for the model that is already current.

The history is saved in the project and comes back when it is opened. New Project starts with none. Importing another profile keeps it: each model carries its own profile, so making one current puts that profile back too.

Limitations

See also: The History tab · Clearing the model · What a project file holds