Deglitching data

“Deglitching” is the process of removing spurious points from data. This is a slightly scary, slightly arbitrary procedure. There is, after all, no obvious definition of what consititutes a spurious point. If, however, you have reason to want to remove data points, this is how it's done.

DEMETER's deglitching procedure is very simple. Given one or more energy values, the data point closest in energy to each supplied value will be removed from the data. Deglitching, therefore, changes the representation of the data within both DEMETER and IFEFFIT.

In this example, some data are imported at lines 4-10 and plotted at line 12. At line 14, two points are removed from the data. Note that this method operates on the object itself. It does not return a new object. Finally at line 15 the deglitched data are plotted over the original data.

Multiple arguments can be given to the deglitch method. Each argument is interpeted as an energy value and the point closest is removed from the data.

  1. #!/usr/bin/perl
  2. use Demeter;
  3. print "Reading and plotting uhup.003\n";
  4. my $d0 = Demeter::Data -> new(file        => "path/to/uhup.003",
  5.                               name        => 'HUP',
  6.                               energy      => '$1', # column 1 is energy
  7.                               numerator   => '$3', # column 3 is I0
  8.                               denominator => '$4', # column 4 is It
  9.                               ln          => 1,    # these are transmission data
  10.                );
  11. $d0 -> plot('e');
  12. $d0 -> name("HUP, deglitched");
  13. $d0 -> deglitch(17385.686, 17655.5);
  14. $d0 -> plot('e');

Here are the data from the code example above with two of t he four glitchy point removed. In the case of these data, the two glitches are due to a signal problem at the beamline and obviously represent spurious points.

deglitch.png

The deglitch method is not the easiest thing to use. DEMETER has no built in way of identifying potential spurious points. This method is the most bare-boned implementation possible. “Here are some data points, remove them!” This method is intended to be the backend of some kind of interactive, graphical deglitching tool, like the one in ATHENA.