Getting started
- What Fit is
- The window and the compute server
- The main window at a glance
- A first fit
- Fitting by hand, step by step
- The Explain pane
- Explain Everything
- How much authority an explanation has
- About Fit
What Fit is
This software's choice — A 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
- Fit finds the curves that best match the data for the curve type and settings you chose. Whether those curves mean something physically is a judgement the program cannot make for you.
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 choice — A 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
- A profile imported while no server answered stays in the window only. Naming a server that answers, through Fit > Compute Server, hands the profile over to it.
See also: Log files · Command-line options
The main window at a glance
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 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 menu bar: File, Data, Edit, View, Model, Fit and Help, and a menu of its own for any analysis module the build contains. The menus hold every command the program has.
- The toolbar: Import Profile, Zoom In, Zoom Out and Fit > Automatically, as buttons.
- On the left, the Tools tab, with the curve types and the everyday commands as buttons, and the Data tab, with the profile as a table of numbers.
- In the middle, the chart: the profile, the curves of the model, their sum and the difference between data and model. While a fit runs, this area shows how far the fit has got.
- On the right, the Graphs tab, listing the series on the chart, and the Model tab, listing the curves of the model, with the Explain pane below them.
- Along the bottom, the tables: Background Points, Fit Intervals, Curve Positions, Curve Attributes (the parameters of every curve) and Summary (data, model and difference at every point).
- The status bar: how long the last operation took, how good the fit is, and a hint about whatever the pointer is over.
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 choice — A 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.
- Import a profile with File > Import Profile (F2, or the first toolbar button). The sample files that come with Fit are a good start: Data/2.dat holds two overlapping peaks in about fifty points. The profile appears on the chart and in the Data tab.
- Choose a curve type in the list at the top of the Tools tab, or under Model > Curve Type. Pseudo-Voigt is a common choice for diffraction peaks. The choice is remembered for the next session.
- Run Fit > Automatically, or press its toolbar button. Fit subtracts the background unless that has already been done, places curves, marks a fit interval around each peak and then removes curves for as long as the fit stays good enough. While it works, the chart shows how far it has got; Fit > Stop ends it and keeps what it has reached.
- Read the result. The curves are drawn over the data, and the Difference series shows what the model does not explain: a systematic bump in it is a peak the model has missed. The Curve Attributes table lists the parameters of every curve, the Summary table lists data, model and difference point by point, and the status bar shows how long the fit took and figures of how good it is.
- Keep the work with File > Save Project, which writes everything needed to carry on later. To take the numbers to a spreadsheet, use File > Export > Curve Parameters or File > Export > Summary Table.
Fit > Automatically is greyed out until a profile has been imported or a project opened, and while another fit is running.
Limitations
- How many curves Fit > Automatically keeps is decided by one setting, Fit > Set Max Acceptable Difference, 0.01 percent by default. Your own data may need another value.
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 choice — A 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.
- Background. Under Model > Background, either let the program find background points (Points > Compute Automatically) or pick them on the chart yourself (Points > Start Manual Selection), then subtract the background (Subtract > Automatically or Subtract > By Selected Points).
- Fit intervals. A fit interval is a stretch of the profile fitted as one problem. Under Model > Fit Intervals, compute them or pick their bounds on the chart. With no interval, the whole profile is one interval.
- Curve positions. Under Model > Curve Positions, compute them, put one at every point, or pick them on the chart - usually one at each peak.
- Curve type. Choose it under Model > Curve Type or in the Tools tab.
- Fit. Fit > Minimize Difference (F5) adjusts the curves you placed until their sum matches the data as well as it can. Fit > Minimize Number of Curves (F4) instead also removes curves that are not needed.
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
- While a fit runs, the commands that change the model are greyed out; only Fit > Stop is offered.
See also: A first fit · The main window at a glance
The Explain pane
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 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
- On macOS the system does not tell a program which menu entry the pointer rests on, so there the pane follows the curve type and the model list only.
See also: Explain Everything · How much authority an explanation has
Explain Everything
This software's choice — A 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
- The list shows what this build contains. A curve type or module that is not in your build is not listed.
See also: The Explain pane · How much authority an explanation has
How much authority an explanation has
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 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:
- Canonical: stated by the field's authoritative sources. The explanation quotes the source word for word and names where to read it.
- Convention: common practice or a guideline in the field, not a rule its sources require.
- This software's choice: a decision made by this program rather than by the field's sources - a default, a bound, a way of showing something. The explanation says why it was made. Most of this guide has this label, because it describes how the program behaves.
- Not settled by the sources: the sources disagree or are silent, so nothing treats it as a rule. An explanation that states no label at all is shown with this one, never as canonical.
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
- The label is the program's own claim about its text. For a canonical explanation, check the quoted source yourself when it matters.
See also: The Explain pane · Explain Everything
About Fit
This software's choice — A 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
- On macOS the entry is not in the Help menu: it is About Fit in the application menu, where macOS programs keep it.
See also: What Fit is · Projects