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. This method does not return a new object.

  1. #!/usr/bin/perl
  2. use Demeter;
  3. my $d0 = Demeter::Data -> new(file        => "$where/data/fe.060",
  4.                               name        => '60K',
  5.                               ln          => 1,
  6.                               energy      => q{$1},
  7.                               numerator   => q{$2},
  8.                               denominator => q{$3});
  9. $d0 -> plot('E');
  10. $d0 -> Truncate('after', 7500);
  11. $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);

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

truncate.png