Data Analysis Example
We can analyze some simulated neutron scattering data to show how to use
PAN in some detail. If you are a non-neutron scatterer, don’t worry…this
is just noisy, peaky data used to illustrate how to use PAN. In particular,
we will load in the test data set, fit an appropriate model to the data,
and extract the group-dependence of some important parameters.
First launch PAN if it is not already running. Next, select
File/Load test data. In a few moments a data set that contains
a large central peak and two small satellite peaks corrupted by noise should
appear. Also, the GROUPS
TO FIT text field should have been updated to read “1-20” indicating
that there are now 20 groups (or Q-values for you neutron scatterers).
You can move the slider control labeled
GROUP SELECTION and the data displayed in the window will change.
As you move to larger detector numbers, the central peak will be accompanied
by two growing satellite peaks (this data simulates a rotational tunneling
spectrum taken on a neutron backscattering instrument). Move the slider
control so that you are viewing group (detector) 7. Click the right
mouse button so that you autoscale. If you wish, you can hold the
left mouse button down and drag a rubberband-type zoom box across the plot
to enlarge a particular portion of the data window. A right mouse click
will always result in zooming out all the way.
We will fit this group first and then fit the remaining groups automatically.
The data looks like it has 4 components. The central peak looks approximately
Gaussian, the two satellite peaks are approximately Lorentzian, and there
is an underlying offset (a background level). Choose background from
the drop-menu called Select function. Move the cursor into the plot
window and hold down the left mouse button. A dashed line should appear
across the extents of the data plot. As you move the cursor up and
down in the data window while holding down the left mouse button, the dashed
line should follow the cursor. This action is used to specify the offset
of the overall model function. Once you are satisfied with the level,
release the left mouse button. Now hold down the left mouse button
again and move the cursor around the data window. You should see the
slope of the line change and pivot about the midpoint of the x-axis.
Once you are satisfied with the slope, release the left mouse button.
For this function, the slope should be quite small.
Next we will add a Gaussian curve to model the central peak. Choose
Gaussian from the Select function menu. Move the cursor over the plot
window and hold down the left mouse button. A Gaussian should follow
your cursor movements both in location and in height. Change the vertical
position to change the Gaussian peak height and change the horizontal position
to change the Gaussian peak center. Once you are satisfied that the
peak has the correct amplitude as that of the central data peak and is located
at the correct position, release the left mouse button. Next hold
down the left mouse button and move the cursor horizontally, thus changing
the width of the curve. Once you are satisfied with the width release
the left mouse button.
Next add a Lorentzian to fit the satellite peak to the left of the central
peak. The method to change the amplitude, center, and width of the
Lorentzian is exactly the same as for the Gaussian. Finally, add another
Lorentzian to model the satellite peak to the right of the central peak.
You have just specified the initial guesses for the fit using the mouse
and now it is time to fit the model to the data. You can look at the
actual guess values by pressing the Display fit parameters button and the
values should appear in the text box on the right hand side of the main interface.
Next press the button named Fit current group. In a moment you should
see the result of a least-squares fit of the model to the data. Your
final answer may be different but mine is shown below in figure 1.
You can see the residuals plotted in the bottom window which, in addition
to the chi-squared value, provide a visual goodness-of-fit. If you
have modeled the data well then the residuals should vary between ±1,
as shown by the horizontal dashed lines. It looks like we have a good
fit in figure 1.
Figure 1 Fit of model to data for current group.
The model parameters with uncertainties are found in the text panel displayed
to the right of the data window.
The next part of the analysis we want to do is to fit all of the groups.
However we need to be careful at this stage. Scroll the
Group selection slider control down to group 1 and notice how small
the satellite peaks have become. There is a possibility that the least-squares
routine will have trouble fitting this same model to this data. Therefore
we would like to impose a constraint on the area and width of the satellite
peaks. Move the Group selection
slider control back to group 4 and press the Modify fit parameters button.
Set the lower limit for the areas and FWHM (full-width at half maximum)
for the Lorentzians. This means that you need to check the
Set low boxes for the Lorentzians and make sure that the
Lower limit boxes equal 0.0.
When you have finished this, press the button labeled
Fit all groups. You should see fits being performed for each
group starting with group 1 and finishing with group 20. Once it is
finished you can change the
Group selection slider to inspect each fit. Whenever a new
group is displayed with its fit, its fit parameters, uncertainties, and chi-squared
value are also displayed in the text panel to the right of the data window
for you to examine.
Now we would like to look at the dependence of the peak position of the
Lorentzian to the right of the central peak on the group (i.e. the Q-dependence
of the peak position). First we should note which parameter and curve
this corresponds to in terms of our notation discussed above. Inspection
of the parameters (see figure 1) indicates that this parameter is #6.
Press the Plot fit parameter
button and type in 6 in the field labeled
parameter #. Press
Accept and you should see data that looks similar to that shown in
figure 2. You can save these parameters and errors in a three-column
formatted ASCII file (that can be read back into PAN for further analysis),
print to a postscript or JPEG file, add plot to an HTML log file (if open),
zoom into the window using
the same mouse operations as in the main PAN application, and/or exit the
plot utility. You may choose to examine the group-dependence of any
of the fit parameters by simply specifying the curve and parameter using
the technique discussed above.
Figure 2 Dependence of parameter #6 on the group
Return to PAN page