Computing for Science

The Computing for Science (CS) group supports ILL scientists, students and visitors in a number of activities including data analysis, instrument simulation and sample simulation.

Back to ILL Homepage

All Software

Profit Essentials
General tof and Backscattering fitting program

1.0 Starting the program

1.1 data type (t or b) ?

The default is t for time-of-flight. If data are from a backscattering instrument enter "b" otherwise hit return.


1.2 Number of Gaussians or Lorentzians?

Either Gaussian or Lorentzian peakshapes can be fitted - even a combination of the two. Blank fields count as zero: if you type just 2 then two Gaussian functions will be initialised, 0 2 for two Lorentzians, 1 2 for one Gaussian and 2 Lorentzians... etc.


1.3 Parameter filename.

Profit allows you to read in the parameters from a previous fitting session if required. By default it looks for the file "profit.par". You can either enter the desired parameter filename or hit return. If the file is not found the parameters are initialised to zero.

To top

2.0 Resolution & Data spectra

2 1 Resolution file

Profit requests the name of the file containing the resolution function. Normally this will be the file from the vanadium run but any other data can be used if you believe that its elastic peak represents the instrumental resolution function. As the file is read in the characteristics of each spectrum is output.


2 2 Data file

Profit also requests the data filename. Again basic characteristics of the spectra are output. If the resolution and data files contain different numbers of points or the elastic peaks arise in significantly different channels you can anticipate problems!

For spectroscopy you can often extract the resolution function from the data-file - you can give the same filename for sample and resolution. If profit seems to have problems fitting anything it is worth inspecting the characteristics of the data which are printed during reading: check that elastic peaks are close to zero energy-transfer, and that data and resolution spectra contain the same number of points etc.


2 3 Spectrum number

Select a spectrum number to fit.


2.4 Resolution limits.

Enter the energy minimum and maximum of the resolution function. The range should be large enough to describe the resolution function correctly but not so wide as to include too much background. Profit insists on at least 6 points in the resolution function. A flat and sloping background are automatically removed from the resolution function. The resulting function is normalised to unity.

To top

3.0 Data plotting and limits.

3.1 inspecting data.

To view your data click on plot. Profit will use the x and y plot limits found in the parameter file which was read in at the start. If no parameter file was found the x and y plot limits default to full scale. This may look a bit odd for time-of-flight data.


3.2 Plot limits

Enter "x-min and x-max" to set the x-scale plot limits: e.g. x-min=-1.2 x-max=1.2 will limit the plot to x values between -1.2 and 1.2.
Enter "y-min and y-max" to set the y-scale limits: e.g. y-min=0 ymax=10.3 will limit the plot to y values between 0 and 10.3.


3.3 Fitting limits.

Normally you will want to fit data within a specific region. This region is specified by filling-in the min and max fields. For example:
min1=-1.0 and max1=1.0 Only fit data between x=-l .0 and 1.0
Do not confuse the plotting limits and the fitting limits. These are often the same, but you can end up fitting regions which are not within the plotting limits with unpredictable results. You can exclude regions by entering several fitting zones.

To top

4.0 Parameters

4.1 Viewing parameter values

Parameter values are initially set to those found in the parameter file read in at start-up. If no parameter file was found, all parameters are initialised to zero. The (Old Value) is the value of the parameter before the last fitting command (see below).


4.2 Parameter steps.

The Step is important. Each parameter has its own step and there is also a global step. When profit begins a fitting cycle it estimates the effect of each parameter by applying a fractional shift to each parameter which is given by the product of the individual step and the global step. The global step is initially 0.1 and the individual steps are either the values from the parameter file or zero. If the product of the individual and global steps is zero then the parameter will not change during fitting. A good guess at the step is 1.0.
If the steps are too large the fitting will not minimise, whilst if the step is too small fitting will be slow. Try starting with individual steps of 1.0 and global at 0.1. When the best fit is obtained set the global step to 0.01 and fit again. Some parameters may need very small individual steps when many peaks are fitted together. Watch for sudden jumps in the residual printed after each cycle. Usually the peak positions, particularly the elastic peak (delta function) position need small individual steps.


4.3 Changing parameters and steps.

Use the Show/Modify parameters button.


4.4 Overall step

The global step pre-multiplies all individual steps. The maximum useful value is about 0.1 and the minimum is about 0.0001.


4.5 Constraining parameters.

This simplest parameter constraint is to fix its value during refinement by setting its step to zero. Parameters can also be tied together so that the fractional shifts calculated for one parameter are applied to one (or more) others. This is achieved by setting the step to the negative value of the number of the controlling parameter.
If you set parameter 3 and 6 to the same initial values then the fitting will alter parameters 3 and 6 but keep their values identical.
Because tying parameters together only forces equal fractional shifts during refinement, you can insist that two inelastic peaks be kept symmetric about the elastic peak. In the early stages of fitting an inelastic spectrum it is often worth tying all the peak-widths together.

To top

5.0 Fitting

5.1 Viewing the fit.

The fit button will cause the data and the fitted function to be plotted. The total fitted function is plotted as a solid line and the subfunctions as broken lines. It evaluates the calculated spectrum using the present values for the parameters. The calculated spectrum is only shown within the fitting limits. 


5.2 Improving the fit.

In order to minimise the difference between the observed and calculated spectra the parameters need to be adjusted. This is achieved by fitting for several cycles
The percentage difference (residual) between the observed and calculated spectra is output after each cycle of refinement The best fit is always retained. Normally you require about n2 cycles of refinement, where n is the number of parameters being varied. Because of the way the fitting algorithm works you can often benefit by launching several groups of fitting cycles:
e.g 20 cycles repeated 10 times.
Profit will stop fitting if a group fails to make any improvement. It is often better to do several fits for a small number of cycles rather than one fit of a large number of cycles. Do not be afraid of changing the step to obtain a better fit. If profit seems to behave oddly try varying some parameters "by hand" and check the result.
If different starting parameters lead to different final fits then the data are probably not described by the form of the fitting function.


To top

6.0 Saving and output

6.1 Hardcopy

will create a postscript file of the observed and calculated spectra . The file will be called "pgplot.ps" and is overwritten each time you use the command.


6.2 Dump

will dump the observed and calculated functions into ASCII files suitable for reading with Kaleida graph et al. These files are overwritten each time you use the command.


6.3 Group them

collects the output of calculated peaks into a single file.


6.4 List

Outputs details of the fit into an ASCII file.

To top

7.0 What are the parameters?

7.1 Delta function (elastic peak)

The first two parameters are always the delta function position and intensity. These are normally used to fit the elastic peak. NOTE the delta function position is in channels - not energy. The position of the elastic peak in the sample and vanadium runs are rarely identical. To refine this you must move the d-position slightly off zero - otherwise it will never refine. Note that the step for the d-position should always be small.


7.2 Peaks

Each peak has an intensity, a width, and a position. The width is the half-width at full height. Negative values for widths and intensities are possible but not usually meaningful. When the form of the fitted function cannot describe the observed function negative intensities and widths can occur. Profit issues a warning of impending doom when this occurs but it does not stop!


7 3 Backgrounds

Two background parameters follow the peak parameters: a flat background and a sloping background. The sloping background is in units of intensity/energy.
You may need a negative flat background plus a sloping background in some cases. Be careful that you do not fit a broad function with the flat background.


7.4 Temperature.

The calculated spectrum can be corrected for the detailed balance correction if the value of the temperature is set to be non-zero. If the correction is the wrong way around you will need to enter a negative temperature (conventions of sign for energykansfer are not yet standard). Do not use the temperature parameter unless the energy range is comparable with kT. Refining the temperature is often the best way of obtaining the true sample temperature for samples at lowtemperature. Beware of tunnelling spectra with incomplete spin-conversion.

To top

8.0 Getting another spectrum or data set

Go back to the top of the interface to read in new data, change spectrum or select a new parameter file.

To top