13.1. VPath object

A fit can involve a lot of paths. It is often useful to make a plot showing your data and its fit along with some of the paths that were used in the fit. This quickly becomes unweildy for a complex fit with lots of small paths. A plot showing each individual path will be messy and won't effectively convey how the large number of small paths contribute to the fit.

The VPath, or “virtual path”, is a solution to this problem. The VPath is a user-defined collection of normal Path objects which can be bundled together, summed, then plotted as such. The VPath serves no purpose in the construction of a fitting model, but it can be very useful for visualizing the results of a fit.

It works like this:

my $vpath = Demeter::VPath->new(name => "my virtual path");
$vpath -> include($path1, $path2, $path3);
$vpath -> plot('R');

The VPath is created like any object, using the new method. It can be given a name, which, like the name of a Data or Path object, will be used in the legend of any plot.

The collection of paths is created using the include method. This method takes one or more Path objects, in this case $path1, $path2, and $path3 contain references to Path objects. The include method is cumulative. You can call it repeatedly, each time adding another Path to the collection.

Finally, the VPath object is plotted just like any Data or Path object. DEMETER is careful to keep each element of the VPath up to date with respect to the fit and will make the summation in k-space just before Fourier transforming (if plotting in R or q) and making the plot.

The use of the VPath to make interesting plots is demonstrated in the example of a uranyl ion in solution. That example also demonstrates the cumulative use of the include method.

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.