Getting Started

Graphical Interface

That’s how the GUI looks like:

_images/fityk-with-tooltip.png

The input field with the output window provide a console-like interface to the program. All important operation performed using the GUI are translated to textual commands and displayed in the output windows.

The main plot can display data points, model that is to be fitted to the data and component functions of the model. Use the pop-up menu (click right button on the plot) to configure it. Some properties of the plot (e.g. colors of data points) can be changed from the sidebar.

The helper plot below can show various statistics. The default one one is the difference between the data and the model. The plot can be configured from a pop-up menu. If you do not find it useful you may hide it (GUI ‣ Show).

Configuration of the GUI (visible windows, colors, etc.) can be saved using GUI ‣ Save current config.

On the main plot, the meaning of the left and right mouse button depends on current mode. There are hints on the status bar. In normal mode, the left button is used for zooming and the right invokes the pop-up menu.

On the helper plot, selecting a horizontal range with the left button will show this range, automatically adjusting vertical range. The middle button shows the whole dataset (like Zoom All in the toolbar). The right button displays a menu.

Minimal Example

Let us analyze a diffraction pattern of NaCl. Our goal is to determine the position of the center of the highest peak. It is needed for calculating the pressure under which the sample was measured, but this later detail in the processing is irrelevent for the time being.

The data file used in this example is distributed with the program and can be found in the samples directory.

First load data from file nacl01.dat. You can do this by typing:

@0 < nacl01.dat

The CLI version of the program is all about typing commands. From time to time it is also handy to type a command in the GUI, but usually the GUI provides more intuitive, mouse-driven way to perform the same operation – it is mentioned in the the grey boxes below.

In the GUI

select Data ‣ Load File from the menu (or Load Data from the toolbar) and choose the file.

If you use the GUI, you can zoom-in to the biggest peak using left mouse button on the residual plot (the plot below the main plot). To zoom out, press the View whole toolbar button.

Now all data points are active. Because only the biggest peak is of interest for the sake of this example, the remaining points can be deactivated:

A = (x > 23.0 and x < 26.0)

In the GUI

change to the range mode (toolbar: Data-Range Mode) and deactivate not needed points with the right mouse button.

As our example data has no background to worry about, our next step is to define a peak with reasonable initial values and fit it to the data. We will use Gaussian. To see its formula, type: info Gaussian (or i Gaussian) or look for it in the section Built-In Functions.

To add a peak, either set the initial parameters manually:

F += Gaussian(~60000, ~24.6, ~0.2)

In the GUI

it is also possible to set the initial parameters with the mouse: change the GUI mode to Add-Peak Mode, click on the plot and drag the mouse to select the position, height and width of a new peak.

or let the program guess it:

guess Gaussian

In the GUI

select Gaussian from the list of functions on the toolbar and press Auto Add.

If the functions are not named explicitely (like in this example), they get automatic names %_1, %_2, etc.

Now let us fit the function. Type: fit.

In the GUI

select Fit ‣ Run from the menu or press Fit.

Important

Fitting minimizes the weighted sum of squared residuals (see Nonlinear Optimization). The default weights of points are not equal.

To see the peak parameters, type: info prop %_1.

In the GUI

move the cursor to the top of the peak and try out the context menu (the right mouse button), or check the parameters on the sidebar.

That’s it!

You can save all the issued commands to a file:

info history > myscript.fit

and later use it as a macro:

exec myscript.fit

In the GUI

use Session ‣ Save History and Session ‣ Execute script, correspondingly.