Demeter

Description Perl tools for X-ray Absorption Spectroscopy
Demeter > Perl Modules > Demeter::Data::BulkMerge
Source

NAME

Demeter::Data::BulkMerge - Efficiantly merge many files into a single spectrum

VERSION

This documentation refers to Demeter version 0.9.26.

DESCRIPTION

This object provides an efficient way to merge a large number of files into a single spectrum. The assumption is that the user is not interested in having each individual file processed. This would be the case for measuring many repititions for the sake of improving the statistical quality of the data.

  my $data = Demeter::Data->new(file=>$file, ...);
  my $bulk = Demeter::Data::BulkMerge->new(master => $data,
                                           data => \@list_of_files);
  my $merged = $bulk->merge;
  $_->plot('E') foreach ($data, $merged);

The trick is that each file is only imported to the point of having arrays for energy and xmu. Each file in the list is imported to the same group. The merge is computed by accumulation and divided by the total numberof scans.

This requires that one data file be considered carefully. This is the master. All other data are interpolated to the energy grid of the master.

Care is taken not to include files which are less than 95% (configurable with the margin attribute) of the size of the master data file.

Note that preprocessing the data takes time. A run with the plugin and align attributes set takes about twice as long as a straight merge of the raw data.

ATTRIBUTES

master [Demeter::Data object]

This contains the Demeter::Data object for the processed data group to which all subsequent data files are merged. This acts as the interpolation standard and as the alignment standard (if the align attribute is true). The merged data group will inherit attributes from this group. So, if the master has sensible parameters for normalization and background removal, the merged group will have the same sensible parameters.

data [list of strings]

This is a list of fully resolved paths to the data files to be merged. These can be relative or absolute paths, but they must resolve correctly to actual files. Files that don't exist or aren't readable will be silently ignored.

align [boolean]

When true, this says to align each file in the data list to the master.

smooth [integer]

When non-zero, the alignment will be done using the smoothed derivative spectrum. The value of this parameter indicated the number of smoothings.

plugin [string]

The name of the plugin to use to interpret the data. For example, to use the Demeter::Data::X23A2MED plugin, this attribute would be set to X23A2MED.

margin [number between 0 and 1]

This number defines the margin in filesize outside of which a data file is excluded from the merge. The default is 0.997, thus any file in the data list which is smaller than 99.7% the size of the master file will be excluded.

subsample [array of integers]

This is used to specify sub-samplings of the data ensemble, presumably to test convergence to the mean. If this is set to [4, 16, 64] then Data groups will be saved which sum 4, 16, and 64 of the files included in the merge. The sub-sampled Data groups are saved to the sequence attribute.

sequence [array of Data objects]

Data objects from a sub-sampling sequence.

METHODS

merge

Performs the merge using some special optimizations that minimize the interaction with the data processing backend (Ifeffit/Larch). This returns a Data object containing the merged spectrum, divided by the number of spectra included in the merge.

CONFIGURATION

There are no configuration options for this class.

See Demeter::Config for a description of Demeter's configuration system.

DEPENDENCIES

Demeter's dependencies are in the Build.PL file.

BUGS AND LIMITATIONS

Please report problems to the Ifeffit Mailing List (http://cars9.uchicago.edu/mailman/listinfo/ifeffit/)

Patches are welcome.

AUTHOR

Bruce Ravel, http://bruceravel.github.io/home

http://bruceravel.github.io/demeter/

LICENCE AND COPYRIGHT

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.