Description | Perl tools for X-ray Absorption Spectroscopy |
Demeter::Feff::Histogram - Arbitrary distribution functions
This documentation refers to Demeter version 0.9.26.
my $feff = Demeter::Feff->new(yaml=>'some_feff.yaml');
my @list_of_paths = @{ $feff->pathlist };
my $firstshell = $list_of_paths[0];
my ($rx, $ry) = $firstshell->histogram_from_file('RDFDAT20K', 1, 2, 2.5, 3.0);
my @common = (s02 => 'amp', sigma2 => 'sigsqr', e0 => 'enot', data=>$data);
my @paths = $firstshell -> make_histogram($rx, $ry, \@common);
This role of the ScatteringPath object provides tools for generating and parameterizing arbitrary distribution functions.
histogram_from_file
Read data from a text file to define the distribution function. Returns array references containing the x- and y-axis data.
($ref_r, $ref_y) = histogram_from_file($filename, $xcol, $ycol, $rmin, $rmax);
The arguments are the filename, the column numbers (counting from 1) containing the R-grid and the amplitudes of the distributions, and the minimum and maximum r-values to read from the file.
make_histogram
Given the array references from histogram_from_file
or histogram_gamma
, return a reference to a list of SSPath objects defining the histogram.
$ref_paths = $firstshell -> make_histogram($rx, $ry, $scale, \@common);
The caller is the ScatteringPath object used as the Feff calculation for each bin in the histogram. The first two arguments are the array references. @rx
must be a referecne to an array of numbers -- the x-axis values. @ry
may be a reference to an array of numbers or strings. If numbers, they are taken as the bin poulations. If strings, they are taken to be math expressions for computing the bin populations.
The third argument is the name of a parameter that will be used as an isotropic scaling factor for the dletaR parameter. The remaining arguments will be passed to each resulting Path object.
histogram_gamma
Define a gamma-like dsitribution function.
my ($rx, $ry, $rz) = $fspath -> sp -> histogram_gamma(1.8, 3.0, 0.03);
The return values are array references. The first is to the grid in R space defined by the parameters of the method. The second is a list of text strings which will be to define the s02
parameters of each bin. The third is a list of GDS objects conatining additional def and guess parameters required as part of the fitting model.
make_gamma_histogram
Generate Path and GDS objects required to do the gamma-like fit using a histogram. The first three arguments of the method are the return values of histogram_gamma
, the last is an array reference which will be passed as the attributes of each Path object generated.
my ($paths, $gamma_gds) = $fspath -> sp -> make_gamma_histogram($rx, $ry, $rz, $common);
To finish off the fit, you would do something like this:
my $e0 = Demeter::GDS->new(gds=>'guess', name=>'enot', mathexp=>0);
my $fit = Demeter::Fit->new(gds=>[$e0, @$gamma_gds], data=>[$data], paths=>$paths);
$fit->fit;
See Demeter::Config for a description of the configuration system. The plot and ornaments configuration groups control the attributes of the Plot object.
make_histogram
only makes sense right now using a single scattering path as the basis. Need to throw an error if the ScatteringPath is not a ss path.
Fits using the Gamma-like distribution are not very stable...
Need to implement user-defined distribution, although I don't have a clear idea how to do so...
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.