Description | Perl tools for X-ray Absorption Spectroscopy |
Demeter::Data::Process - Processing XAS data
This documentation refers to Demeter version 0.9.26.
This subclass of Demeter::Data contains methods for calibrating mu(E) data and adjusting e0.
Note that these data processing methods are not reversable (without reimporting the data). Many of the examples suggest the use of the clone
method for easy comparison between the processed and original data. In those cases cloning is a good idea because the methods will alter the arrays in the data processing backend (Ifeffit/Larch).
rebin
This method rebins EXAFS data onto a standard EXAFS grid defined by parameters that can be passed to the method via an anonymous hash. It returns the reference to the new object and creates an appropriate set of arrays. The new object is a clone of the original object.
$rebinned_group = $data -> rebin(pre=>-35, xanes=>0.3);
$rebinned_group -> plot('E');
The parameter hash can contain zero or more of these parameters:
The group name of the newly created group containing the rebinned data. The default is to generate a unique group name.
The boundary between the pre-edge and XANES regions, expressed in relative energy. The default is -30 eV.
The boundary between the XANES and EXAFS regions, expressed in relative energy. The default is 50 eV.
The grid size in energy of the rebinned pre-edge region. The default is 10 eV.
The grid size in energy of the rebinned XANES region. The default is 0.5 eV.
The grid size in wavenumber of the rebinned EXAFS region. The default is 0.07 inverse Angstrom.
See Demeter::Config and the rebin configuration group for details about configuring the defaults.
merge
This method merges a list of data groups. The merge can be done in mu(E), norm(E), or chi(k). A list of Data objects will be interpolated onto the energy (or k) grid of $data
and merged along with $data
.
$merged_group = $data->merge('e', @groups);
The first argument is e
, n
, or k
. The remaining arguments are Data objects to be included in the merge.
Truncate
Truncate data before or after a given value. This discards the truncated points from the arrays in the data processing backend (Ifeffit/Larch).
$data -> Truncate("after", 7700);
The truncation is exclusive -- that is the value closest in energy or k to the supplied value remains in the array.
This is capitalized to avoid confusion with the perl built-in.
deglitch
Remove a single data points -- glitches -- from the data. This only works on mu(E) data and a check is made that the supplied values are within the data range.
$data -> deglitch(17385.686);
or
$data -> deglitch(@spurious_points);
In each case, the points closest in energy to the supplied values are removed. Glitches are simply removed from the data -- no interpolation between surrounding values is made.
There is no method explicitly intended to find a glitchy point. That is left as a chore for the user interface.
Due to a quirk in Ifeffit (or perhaps in my understanding of Ifeffit) attempting to deglitch any of the last two points of data will result in both points being removed. The same is true of the first two points. This is a bug, but not, I don't think, a horrible one.
smooth
Perform three-point smoothing on the mu(E) or chi(k) data, as appropriate. The argument tells Demeter how many times to reapply the smoothing.
$copy = $data -> Clone;
$copy -> smooth(5);
convolve
Perform a Gaussian or Lorentzian convolution on the data. Becuase this has a number of possible arguments, named arguments in an anonymous hash are used. The width is sigma as defined in the data processing backend (Ifeffit/Larch) and is a possitive number. A negative number will be interpretted as zero. The type is either "Gaussian" or "Lorentzian". The type is either "xmu" or "chi" -- that is convolute mu(E) or chi(k) data.
$copy = $data -> Clone;
$copy -> convolve(width=>2, type=>'gaussian', which=>'xmu');
noise
Add noise to a mu(E) or chi(k) spectrum.
$copy = $data -> Clone;
$copy -> noise(noise=>0.02, which=>'xmu');
The amount of noise is intepretted differently for mu(E) data as for chi(k). For chi(k) data, the supplied noise used as the RMS value of the noise to be applied to the un-weighted chi(k) data. Consequently, you probably want to use a small value -- probably something on the order of 0.001.
For mu(E) data, the noise is interpretted as a fraction of the edge step. Thus the noise level for a given value scales with the size of the edge step. A value of 0.02, as in the example above, is 2% of the edge step.
See Demeter::Config for a description of the configuration system.
Demeter's dependencies are in the Build.PL file.
The merge method does not yet return the varience array.
Adding noise to chi(k) is not working correctly. (But adding noise to mu(E) does.)
Please report problems to the Ifeffit Mailing List (http://cars9.uchicago.edu/mailman/listinfo/ifeffit/)
Patches are welcome.
Bruce Ravel, http://bruceravel.github.io/home
http://bruceravel.github.io/demeter/
Copyright (c) 2006-2018 Bruce Ravel (http://bruceravel.github.io/home). All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlgpl.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.