R
e
l
e
a
s
e
DEMETER
0.0.1
5 September, 2006

S
i
t
e

m
a
p
Main Page
Downloads
Contributions
Documents
Change Logs
Reporting bugs
Bruce's homepage

I
F
E
F
F
I
T
IFEFFIT Homepage
IFEFFIT Wiki
Bruce's Wiki page
IFEFFIT mailing list
IFEFFIT FAQ
xafs.org

X
A
S

S
o
f
t
w
a
r
e
ATHENA
ARTEMIS
HEPHAESTUS
DEMETER
ATOMS
SixPack
WebATOMS
ATOMS database
XAS File Format
EASE
SourceForge

DEMETER

For she, after inventing the grain in the island of Sicily, was the first to gather, prepare, preserve it, and the first to instruct mankind how to sow it.

Carlos Parada


DEMETER is a set of programmer's tools encompassing all the functionality of ATHENA and ARTEMIS. It is a very-high-level, pure-Perl interface to IFEFFIT. It is not, itself, a software product --- rather it is the tool from which software products can be built. DEMETER was first conceived as the intial phase of a rewrite of ARTEMIS, but quickly evolved into something much more useful than that. The intent is that DEMETER will be the IFEFFIT interface library for things like:

Download and use instructions

Use the anonymous SVN server at cars9.uchicago.edu to check out the current version of DEMETER. This, of course, requires that you have a working copy of the Subversion version control software on your computer and that you know how to use it to check out code.

    svn co http://cars9.uchicago.edu/svn/demeter/
    
You can also browse DEMETER's Subverison repository from your web browser using the svn web portal http://cars9.uchicago.edu/svn/demeter/. At this time, only Bruce has privilege to write to the repository. If you would like to contribute code, documentation, or examples, let Bruce know.

I have not yet written build and installation scripts. For now, you need to point your perl programs at the location where you checked DEMETER out from the repository. Use the -I switch to find the DEMETER modules. Use something like this in the first line of your program

    #!/usr/bin/perl -I/home/bruce/codes/demeter/
    

There are a number of example scripts using DEMETER in the `examples/' directory.

CPAN requirements

Several modules must be downloaded from CPAN and installed for Demeter to work. The currrent list is in the `Bundle/DemeterBunlde.pm' file. The easiest way to install these requirements is to use the CPAN utility. From the main directory of the DEMETER distribution, do the following:

 shell~> perl -MCPAN -e shell
 cpan> install Bundle::DemeterBundle
This will take a while. Answer yes to all the questions about following dependencies.

Document pages

Here are links to the html-ified pod documentation for the components of the DEMETER system. Note that the links in the document pages pointing to other document pages point incorrectly. This is an unfortunate feature of the tool used to convert the pod pages to html. Eventually, I'll write a post-processor to fix those problems.

Coming eventually actual content on the Plot document page, a quick-start quide to using Demeter, and some Emacs tools for automating object creation and setting attributes. For now, just follow the examples and hopefully things will make sense.

Demeter
The base class for the DEMETER system.
D
o
c
u
m
e
n
t

p
a
g
e
s
Demeter::Plot
The Plot object, which is used to control how plots are made.
Demeter::Data
The Data object, which is used to contain all parameters and methods for manipulating, processing, and analyzing XAS data.
Demeter::Data::Mu
Methods for Data objects containing mu(E) data
Demeter::Data::E0
Methods for aligning and calibrating mu(E) data
Demeter::Data::Process
Methods for basic mu(E) data processing
Demeter::Feff
The Feff object, which is used to run Feff and organize its output
Demeter::ScatteringPath
The ScatteringPath object, which is used by the Feff object's path finder method.
Demeter::Feff::Sanity
Sanity checks on Feff calculations, inherited by Feff.pm
Demeter::Path
The Path object, which is used to define and manipulate scattering paths and their associated path parameters math expressions.
Demeter::GDS
The Guess/Def/Set parameter object, which is used to define, organize, and evaluate the parameters used in a fit.
Demeter::Fit
The Fit object, which is a collection of Data, Path, and GDS objects deining an EXAFS fit.
Demeter::Fit::Sanity
Sanity checks on fitting models, inherited by Fit.pm
Demeter::Dispose
Methods for interacting with IFEFFIT. This class is inherited by all other classes in the DEMETER system.
Demeter::Config
Methods for configuring DEMETER applications.
Demeter::Project
Methods for saving and reading DEMETER project files.
Demeter::Tools
Utility class methods


Example script

Here is a short example of using the DEMETER system to import and plot some data. This example is in the distribution, in the `examples/' directory. Note that, once the Plot and Data objects are defined, it takes exactly one method call to make a plot. The data import, and normalization, background removal, and Fourier transform are all done behind the scenes. Cool!

#!/usr/bin/perl -I/home/bruce/codes/demeter/

## This is a fairly simple example of using Demeter to process
## some mu(E) data and make a nice plot.

use warnings;
use strict;
use Ifeffit::Demeter;

Ifeffit::Demeter->set_mode({ifeffit=>1, buffer=>0, screen=>1,});
my $plot_features = Ifeffit::Demeter::Plot -> new();

my $dobject = Ifeffit::Demeter::Data -> new({group => 'data0'});
$dobject -> set({is_xmu    => 1,
                 file      => "fe.060.xmu",
                 fft_kmax  => 3,
                 fft_kmin  => 14,
                 label     => 'My iron data',
                 bkg_spl2  => 18,
                 bkg_nor2  => 1800,
                });

## decide how to plot the data
$plot_features->set({e_mu    => 1,
                     e_bkg   => 1,
                     e_norm  => 0,
                     e_pre   => 1,
                     e_post  => 1,
                     kweight => 2,
                     r_pl    => 'm',
                     'q_pl'  => 'r',
                    });
$dobject->set({bkg_flatten=>1});
$dobject->plot('kq');           # E k R q
## note that reading the data file, the background removal, and
## Fourier transform comes along for the ride when you ask for a
## plot -- that is, each of the following methods are called
## as needed behind the scenes:
#     $dobject->read_data;
#     $dobject->autobk;
#     $dobject->fft;
#     $dobject->bft;
## cool, huh?


#### writing output column data files

$dobject->save('norm', "fe.dat"); # xmu norm chi r q fit


More examples

This table shows the plots generated by several of the example scripts in the SVN repository. Compare these plots with the scripts to see how much can be done in a very small number of lines of code using DEMETER. Click on the thumbnails to see the full size plots.
process example This image is the output of the the example shown above.
compare example This example shows a comparison between two iron foils at different temperatures.
cufit example This example shows a fit to the first three shells of a copper foil. Note that most of the script is devoted to setting up the details of the data, paths, and iftting parameters. In fact, the perl source code for doing so looks a lot like the contents of `feffit.inp' file. This example also shows in interesting use of the y_offset Data attribute to make a stacked plot.
mdsfit example This example builds on the previous example. This is a multiple data set fit to copper foil at two temperatures. The plot shows the data and fit from both data sets simultaneously.
ag-au example This example shows a fit to 5 data sets of various silver-gold alloys. The last part of the script demonstrates a bit of simple interactivity allowing the user to select the data set to plot along with its fit and the paths used in the fit.



Some people decided to make knowledge into property. That wasn't capitalism speaking; that was a greedy scam. There wasn't anything normatively acceptable about it. It contravened the freedom of speech and ideas. We [don't] engage in it because it [excludes] people from ideas.

Eban Moglan, General Counsel, Free Software Foundation

Creative Commons License
This web site is licensed under
a Creative Commons License.

Tools used to create this site include:
[Created by XEmacs!]     [Created with the Template Toolkit!]
Time-stamp: <04 February, 2007>
This page copyright © 2007 Bruce Ravel

Support Amnesty International
*Support the American Civil Liberties Union
Support The Electronic Frontier Foundation

BoingBoing guide to defeating censorware