3.4. Truncating data

Truncating is the process of removing data from one end or the other of a data set. The Truncate method takes two arguments. The first is either of the words before or after and indicates whether data is to be removed from the front or back end of the data. The second argument is the energy value before/after which all data points are removed.

Truncating changes the representation of the data within both DEMETER and IFEFFIT. (But not on disk – DEMETER never alters the original data.) This method does not return a new object.

#!/usr/bin/perl
use Demeter;
my $d0 = Demeter::Data -> new(file        => "$where/data/fe.060",
                              name        => '60K',
                              ln          => 1,
                              energy      => q{$1},
                              numerator   => q{$2},
                              denominator => q{$3});
$d0 -> plot('E');

$d0 -> Truncate('after', 7500);
$d0 -> plot('E');

In the example above, all points after 7500 eV are removed from the data. Here is an example of removing points from the front end of the data.

$d0 -> Truncate('before', 7050);
../_images/truncate.png

Fig. 3.4 These are the data as plotted by the example script above.





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.