The minimal example

Let us analyze a diffraction pattern of NaCl. Our goal is to determine the position of the center of the biggest peak. It is needed for calculating pressure, under which the sample was measured, but the further processing does not matter in our example.

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

First load data from file nacl01.dat. You can do it by typing d.load 'nacl01.dat' in CLI version (or in GUI version in the input box - at the bottom, just above the status bar). In GUI, you can select Data->Load File from menu and choose proper file, instead. All commands can be abbreviated with letter-dot-letter, eg. you can type: d.l 'nacl01.dat'.

If you use GUI, you can zoom in the biggest peak using left mouse button on the auxiliary plot (the plot below main plot). To zoom out, press either middle button or Shift and left button on the auxiliary plot. Other ways of zooming are described in the section called “Mouse, Modes and Toolbars ”. If you want the data to be drawn using bigger points or line, or if you want to change color of line or background, press right mouse button on main plot and use Data point size or Color menu from pop-up menu.

Now all data points are active. Because only the biggest peak is our interest, the rest of points can be deactivated. Type: d.range 23.0:25.0 or change to range mode (press Data-Range Mode button on toolbar) and select range to be deactivated with right mouse button.

We see that our data has no background, we would have to worry about, so now we only have to define peak with reasonable initial values of peak's parameter and fit it to data. We will use Gaussian. To see it's formula, type: s.info ^G or look for it in the documentation (in Appendix C, List of functions).

To define peak, type: s.add ^G ~60000 ~24.6 ~0.2 or select Gaussian from the list of functions on toolbar and press auto-add toolbar button. There are also other ways to add peak in GUI, try add-peak mode.

Now let us fit the function. Type: f.run or select Fit->Run from menu.

To see position of center, type: s.info ^0 ('^' stands for function and ^0 for first function) or s.info @1 ('@' stands for simple-parameter, @0 is the height and @1 is the center). This will be explained later in this manual. In GUI information about peak is displayed on status bar, when you move mouse over top of peak.

That is all. To do the same second time, you can write all the commands to file, eg. to file nacl01.fit, and use this script: o.include 'nacl01.fit' or select File->Include file from menu, or run program with the name of script: bash$ fityk nacl01.fit