Fit

Interactive curve fitting for Linux, Windows and macOS

User guide

Data

The profile

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

The profile is the measured data a model is fitted to: a list of points, each an argument and the amplitude measured at it.

When you import a data file (File > Import Profile) or open a project, its points become the profile. Each point has two numbers: the argument, which runs along the horizontal axis - an angle, an energy, a time or any other position - and the amplitude, the value measured there.

The profile is drawn on the chart and listed in the Data tab on the left, beside the Tools tab. Everything the program proposes or fits is computed from it: the curve positions it finds, the fit intervals, the background, and the difference between the model and the data.

The argument is stored exactly as it was read. What the horizontal axis shows - its name, its unit and its numbers - is chosen separately under Data > Argument Transformation, and changing it never changes the stored values or the fit.

The Data menu works on the profile itself: it chooses how the argument is shown, narrows the work to a stretch of the profile (Data > Range) and smooths the amplitudes (Data > Smooth Profile). The tables at the bottom of the window - Background Points, Fit Intervals, Curve Positions and Curve Attributes - describe the model rather than the data.

Almost every command of the Data and Model menus is greyed until a profile is loaded, and while a fit or another calculation is running.

Limitations

See also: The Data table · Argument axes and units · Working on part of the profile · The model · Import Profile · Reload Profile

The Data table

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

The Data tab on the left lists every point of the profile, or of the data interval in force, and lets you correct a value by typing over it.

The table has two columns: Position, the argument, and Amplitude, the value measured there. While a data interval is selected (Data > Range) it lists only the points of that interval.

To correct a point, click its cell, type the new number and leave the cell. The point is replaced in the profile the engine fits, and the chart is redrawn from it.

The tab shares the left panel with the Tools tab; click its tab to bring it forward.

A cell holding anything that is not a number - a typo, a stray letter, a unit typed after the value - is refused: a message beside the table names what was typed, and the point stays where it was.

Limitations

See also: The profile · Working on part of the profile

Argument axes and units

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

The horizontal axis can show the stored argument in several ways - as the curve type suggests, as a plain position, as a diffraction angle or through formulas of your own - without changing the data or the fit.

The program stores the argument of every point exactly as it was loaded. An axis rule is a display transform: it decides the name and unit written under the chart, the numbers along the axis, and how positions read in the Curve Attributes table. The stored data and the fit are the same whichever rule is in force.

Choose a rule under Data > Argument Transformation > Use Rule, or right-click the chart and choose it from the menu that opens there. Both offer the same six entries, and the one in force is ticked in both:

Until you pick a rule yourself the program uses From Curve Type, so the axis follows the curve type you select. Once you pick any rule, the choice is yours: it is remembered between sessions and the curve type no longer changes it. Choose From Curve Type to hand the axis back to the model.

Use Rule is greyed while nothing is drawn on the chart. The axis label always reads as the name followed by the unit in square brackets, or the name alone when the rule has no unit.

Limitations

See also: Diffraction angles: Theta, 2 Theta and sin(Theta)/lambda · Wavelength · A custom argument axis · Choosing a curve type

Diffraction angles: Theta, 2 Theta and sin(Theta)/lambda

ConventionCommon practice or a guideline in the field, not a rule its sources require.

For a diffraction pattern the stored argument is read as the scattering angle 2 Theta in degrees, and the axis can show it as 2 Theta, as Theta, or as sin(Theta)/lambda.

Diffraction patterns are usually recorded against the scattering angle 2 Theta, and the program takes the stored argument to be 2 Theta in degrees whenever one of these three rules is in force:

By Bragg's law, lambda = 2 d sin(Theta), the value sin(Theta)/lambda equals 1/(2d), where d is the spacing of the diffracting planes. Peaks recorded at different wavelengths therefore line up on this axis, which is why it is common in crystallography.

Only Sin Theta / Lambda needs a wavelength. The first time you choose it with no wavelength known, the program asks for one before switching; Theta and 2 * Theta need none.

Limitations

See also: Argument axes and units · Wavelength

Wavelength

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

The wavelength of the radiation, in angstrom, is the number the Sin Theta / Lambda axis divides by.

Set it with Data > Argument Transformation > Set Rule Parameters > Wavelength. A dialog titled Wavelength asks for Wavelength (angstrom). It accepts only a positive number - 1.5406, for example - and keeps asking until it gets one or you cancel. On OK the wavelength is stored and the axis switches to Sin Theta / Lambda.

Set Rule Parameters is greyed unless the axis in force is a diffraction angle - Theta, 2 * Theta or Sin Theta / Lambda, or From Curve Type while the selected curve type defines one. To give a wavelength for the first time you can also choose Data > Argument Transformation > Use Rule > Sin Theta / Lambda: with none known, it asks for one first.

The wavelength is saved with the project.

Limitations

See also: Diffraction angles: Theta, 2 Theta and sin(Theta)/lambda · Argument axes and units

A custom argument axis

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

Data > Argument Transformation > Use Rule > Custom Position shows the argument through a formula of your own, given together with its inverse.

The entry opens the Custom Argument Axis dialog, which has four fields:

For a natural-logarithm axis, write ln(x) as f(x) and exp(x) as g(x). The formulas are written as for a user-defined curve: ln is the natural logarithm, log is base 10, and exp, sqrt, abs, sin, cos and the operators + - * / ^ can be used with brackets.

The first time, the dialog is filled in with the name Custom, no unit, and x for both formulas - the axis you already have - so pressing OK unchanged changes nothing. After that it opens on the definition you last gave, which is remembered between sessions.

If either formula is left empty, a message says both are required and the axis stays as it was.

Limitations

See also: Argument axes and units · User-defined curves

Working on part of the profile

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

Data > Range narrows the program's work to the stretch of the profile between two points you pick, and brings the whole profile back.

Choose Data > Range > Start Manual Selection and click two points of the profile on the chart, one at each end of the stretch you want. The entry is ticked while this picking mode runs, the status line says which click comes next, and the picks are drawn as the Area Limits series. Until the second pick, clicking the first again takes it back; once both are picked, further clicks are ignored.

Then choose Data > Range > Select Data Interval. It is greyed until exactly two points are picked. The profile is cut to the points between them, both ends included; the chart and the Data table show only that stretch, and the picking mode ends.

From then on the automatic commands - proposing curve positions, fit intervals and background points, and subtracting the background - work on that interval only, and so does the fit.

Data > Range > Select Entire Profile goes back to the whole profile. It is offered only while an interval is in force and no picking mode is running.

A selected interval is saved with the project, as the numbers of its first and last points.

Selecting another interval while one is in force replaces it: the fit runs over the new one.

See also: Picking points on the chart · Smoothing the profile · The profile

Smoothing the profile

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

Data > Smooth Profile replaces each amplitude by the mean of itself and its two neighbours, keeping the total of all amplitudes the same.

Each point's amplitude becomes the mean of three values: the point before it, the point itself and the point after it. At either end the missing neighbour is replaced by the end point itself. The smoothed amplitudes are then scaled so that their sum equals the sum before smoothing: the area under the profile is kept, and the highest peaks come down a little.

Use it on noisy data before the automatic commands, which look for local maxima and are easily misled by noise. It can be applied more than once; each application smooths further.

The entry is offered whenever a profile is loaded and no fit is running. The chart and the Data table show the smoothed profile at once.

Limitations

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

Price data

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

Data > Price Data chooses which column of a price-data (.csv) file becomes the value, and what its argument is.

Under Value:

Under Argument:

The choice applies to the next File > Import Profile or File > Reload Profile of a price-data file - the profile already loaded is not read again by itself - and it is kept between sessions. It has no effect on .dat files.

Limitations

See also: The profile