10.3. After a fit

After a fit finishes, each of the following tasks happens:

  1. Best fit values and error bars are stored for each GDS object defining a guess parameter.
  2. Final values are stored for each GDS object defining a def parameter.
  3. All after parameters are evaluated.
  4. The residual of the fit is calculated.
  5. The statistics of the fit, including χ2, reduced χ2, R-factor, and all correlations between guess parameters are stored in the Fit object.
  6. All path parameters are evaluated and stored in the Path objects.
  7. The fit's “happiness” (see the next section for details) is evaluated.
  8. All GDS parameters flagged for automatic annotation are annotated.

All of that is a detailed way of saying that every object involved in the fit is ready to be used for useful and interesting chores after the fit. All Data and Path objects are ready to be plotted. The fit can be saved a Fit serialization. Column data files can be exported. A log file can be written. Any of the chores can happen with confidence that every thing is completely up-to-date with the results of the fit.

Picking up from the example of the multiple data set fit, the following example demonstrates how to perform several of the common after-fit chores that might be part of a fitting script. The previous example demonstrated how to make an interesting plot using the two data sets and their fits.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 ### ... picking up at line 61 of the previous example ...

 ## do the fit
 $fit -> fit;

 ## write a log file
 my ($header, $footer) = ('', '');
 $fit -> logfile("cufit.log", $header, $footer);

 $fit -> freeze(file=>"cu_temperature.dpj");

 $data[0]->save("fit", "cu_10K.fit");
 $data[1]->save("fit", "cu_150K.fit");

 $fit -> interview;
Log file
At line 8 a log file is written. The first argument of the logfile method is the name of the output log file. The other two arguments, both set to empty strings in this example, contain user-specified text that is written to the beginning and end of log file.
Fit serialization
At line 10 the fit is serialized. This serialization file is simply a normal zip file containing the serializations of all the objects used in the fit along with a log file and a few other results of the fit. The convention is for this zip file to have the extension .dpj (i.e. DEMETER project). Note that the .dpj file can be imported into ARTEMIS.
Column data
At lines 12 and 13, the results of the fit to each data set are saved as column data files. These files contain columns with the k, data, the fit, the window, the residual, and the background function is it was corefined. See the chapter on output formats for more details on this and other column output formats.
Fit interview
At line 15, the interview method is called. This is a simple terminal application for examining the results of the fit. The log file and statistical parameters of the fit can be examined using this application and simple plots can be made. The interview is a bare-bones tool. But it is a nice compromise between using a GUI and writing your own tools to examine the results of the fit. DEMETER ships with a command line program called rdfit which is a wrapper around the interview method. It reads a .dpj file specified at the command line, imports it into a Fit object, then runs the interview method. The interview method and the rdfit program are described in more detail in chapter on user interfaces.



DEMETER is copyright © 2009-2016 Bruce Ravel – This document is copyright © 2016 Bruce Ravel

This document is licensed under The Creative Commons Attribution-ShareAlike License.

If DEMETER and this document are useful to you, please consider supporting The Creative Commons.