Description | Perl tools for X-ray Absorption Spectroscopy |
Demeter::Data::Beamlines - Role for identifying the beamline provenance of data
This documentation refers to Demeter version 0.9.26.
Using plugins found in Demeter/Plugins/Beamlines, attempt to identify the beamline of origin of the data file. If identified, attempt to glean metadata from the file header.
daq
(string)The name of the data acquisition program used to collect the data.
beamline
(string)The designation of the beamline at which the data were collected.
beamline_identified
(boolean)Set to true once the beamline has been positively identified.
There is only one method -- identify_beamline
. This steps through the plugins found in Demeter/Plugins/Beamlines, each of which must provide a method called is
. Each plugin's is
method is called in turn. Once one returns a positive, metadata is set and this method returns.
These checks can be completely disabled by setting the operations-
identify_beamline> configuration parameter to 0.
A beamline plugin provides one (and only one) method. This method must be called is
.
This method is called like so:
Demeter::Plugin::Beamlines::MX->is($data, $file);
where $data
is the Demeter::Data object that represents the data in the file and $file
is the fully resolved filename of the file being tested.
Each is
method must perform the following chores:
Very quickly recognize whether a file comes from the beamline. Speed is essential as every file will be checked sequentially against every beamline plugin. If a beamline plugin is slow to determine this, then the use of Athena or other applications will be noticeably affected.
Recognize semantic content from the file header. Where possible, map this content onto defined XDI headers. Other semantic content should be placed into extension headers.
Add versioning information for the data acquisition program into the XDI extra_version attribute.
Set the daq
and beamline
attributes of the Demeter::Data object with the names of the data acquisition software and the designation of the beamline.
is
is not required to read the data table and is encouraged not to do so. Of course, if there is semantic content in the data table intended to be interpreted as metadata, then it would be appropriate. But ... ick ...!
If possible, recognize the beamline by examination of the first line (or first few lines) of the file.
Define an Xray::XDI object for use with the Demeter::Data object as soon as possible, but after the bail-out point for a file that is not from this beamline.
Use $data-
xdi->set_item> to set a defined or extension header. The syntax is
$data->xdi->set_item($family, $tag, $value);
Use defined fields wherever possible.
Use $data-
xdi->push_comment> to push each user comment line onto the XDi comment attribute. The syntax is:
$data->xdi->push_comment($comment_line);
where $comment_line
is free-form text and does not end with an end-of-line character. The push_comment
method handles the end-of-line character correctly for your computer.
Some metadata is constant for any file collected at a beamline. Deposit an .ini file in Demeter's share/xdi/ folder and use it by a call to $data-
metadata_from_ini>. The syntax is
$data->metadata_from_ini($inifile);
where $inifile
is the fully resolved name of the .ini file, likely in the share/xdi/ folder (but it can be anywhere). That method will fail gracefully if $inifile
does not exist.
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.