Description | Perl tools for X-ray Absorption Spectroscopy |
Demeter::Data::Prj - Read data from original-style Athena project files
This documentation refers to Demeter version 0.9.26.
This class contains methods for interacting with Athena project files. It is not a subclass of some other Demeter method.
$project = Demeter::Data::Prj->new(file=>'some.prj');
@data = $project -> slurp; # import all records
($d1, $2) = $project -> record(3, 8); # import specific records
The script lsprj
, which comes with Demeter, uses this module.
See Demeter::Data::Athena for Demeter's method of writing Athena project files.
Note that the semantics of this object are identical to Demeter::Data::JSON. They are intended to be used interchangeably. Athena and Artemis will read Prj and JSON files transparently.
set
Currently, the only thing to set is file
.
$prj -> set(file=>'some.prj');
Setting the file triggers reading the file. You do not need to read the file explicitly.
slurp
Return a list containing Demeter Data objects for each group from the project file. This is a convenience wrapper wround the record
method.
@data_objects = $prj -> slurp
prj
is an alias for slurp
.
record
Import a single record from the project file.
To retrieve the third group from an Athena project file:
$data_object = $prj -> record(3);
Note that, for this method, you count the groups in the Athena project starting with 1, where record #1 is the top-most record in the list as displayed in Athena.
records
is an alias for record
, as in
@data_objects = $prj -> records(3, 4, 8);
All imported records will have attributes set to values imported from the project file.
Note that is you pass this method an argument whose value is larger than the number of records in the associated project file, it will silently skip that argument.
list
Return a listing of the labels of the groups in the project file.
print $prj -> list;
==prints==>
# record
# -------------------------------------------
1 : Iron foil
2 : Iron oxide
3 : Iron sulfide
Optionally, a list of attributes can be passed, generating a simple table of parameter values.
print $prj -> list(qw(bkg_rbkg fft_kmin));
==prints==>
# record bkg_rbkg fft_kmin
# -------------------------------------------
1 : Iron foil 1.6 2.0
2 : Iron oxide 1.0 2.0
3 : Iron sulfide 1.0 3.0
The attributes are those for the Demeter::Data object.
allnames
This returns the labels as displayed in Athena's groups list as an array.
my @names = $prj -> allnames;
plot_as_chi
This returns the same sort of list as the entries
accessor, except that all the gorups that cannot be plotted as chi(K) (i.e. detector groups, xanes groups, etc) have been filtered out. Two array references are returned, the first containing the names of those groups, the second containing the filtered entries list.
my ($names_ref, $entries_ref) = $prj -> plot_as_chi;
Demeter::Data::Prj: $file does not exist
The Athena project file cannot be found on your computer.
Demeter::Data::Prj:$file cannot be read (permissions?)
The specified Athena project file cannot be read by Demeter, possibly because of permissions settings.
could not open $file as an Athena project
A problem was encountered attempting to open the Athena project file using the Compress::Zlib module.
There are no configuration options for this class.
See Demeter::Config for a description of Demeter's configuration system.
Demeter's dependencies are in the Build.PL file.
Not all Athena attributes are dealt with correctly yet -- title is the biggie
Need to deal with chi groups, detector groups, etc.
Not dealing yet with, for instance, LCF parameters
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.