| Description | Perl tools for X-ray Absorption Spectroscopy |
Demeter::Mode - Demeter's sentinel system
This documentation refers to Demeter version 0.9.26.
This special object is used to store global attributes of an instance of Demeter in a way that makes those attributes available to any Demeter object.
Access to this object is via the get_mode and set_mode methods of the Demeter base class. The convenience methods co and po of the Demeter base class are used to gain access to the Config and Plot objects. Any of these methods can be called by any Demeter object:
$to_screen = $data_object -> get_mode('screen');
$to_screen = $gds_object -> get_mode('screen');
$to_screen = $path_object -> get_mode('screen');
$to_screen = $scattering_path -> get_mode('screen');
$to_screen = $prj_object -> get_mode('screen');
## and so on ...
This object also monitors the creation and destruction of Demeter objects (Atoms, Data, Data::Prj, Data::JSON, Data::MultiChannel, Data::BulkMerge, Feff, Feff::External, Fit, GDS, Path, Plot, Plot::Indicator, ScatteringPath, SSPath, VPath, etc.) and provides methods which give a way for one object to affect any other objects created during the instance of Demeter. For example, when the kweight value of the Plot object is changed, it is necessary to signal all Data objects that they will need to update their forward Fourier transforms. This object is the glue that allows things like that to happen.
backendDispose commands to Larch or Ifeffit, as appropriate, when true.
screenDispose commands to STDOUT when true.
plotscreenDispose plotting commands to STDOUT when true.
repscreenDispose reprocessed commands to STDOUT when true.
fileDispose commands to a file when a filename is given.
plotfileDispose plotting commands to a file when a filename is given.
repfileDispose reprocessed commands to a file when a filename is given.
bufferDispose commands to a string or array when given a reference to a string or array.
plotbufferOptionally dispose of plotting commands to a difference string or array reference.
callbackDispose commands by sending them as the argument to a user-supplied code rerference.
plotcallbackOptionally dispose of plotting commands to a difference code reference.
feedbackA code ref for disposing of feedback from Ifeffit or Larch.
configA reference to the singleton Config object. $C is the special template variable.
plotA reference to the current Plot object. $P is the special template variable.
fitA reference to the current Fit object. $F is the special template variable.
standardA reference to the current Data object used as a data processing standard. $DS is the special template variable.
theoryA reference to the current Feff object. $T is the special template variable.
pathA reference to the current Path object. $PT is the special template variable.
template_processThe template set to use for processing data.
template_fitThe template set to use for fitting data.
template_analysisThe template set to use for analyzing mu(E) data.
template_plotThe template set to use for plotting data.
template_feffThe template set to use for writing feff.inp files.
template_testA special template set used for testing Demeter.
AtomsA list of all Atoms objects created during this instance of Demeter.
DataA list of all Data objects created during this instance of Demeter.
FeffA list of all Feff objects created during this instance of Demeter.
ExternalA list of all Feff::External objects created during this instance of Demeter.
FitA list of all Fit objects created during this instance of Demeter.
GDSA list of all GDS objects created during this instance of Demeter.
PathA list of all Path objects created during this instance of Demeter.
PlotA list of all Plot objects created during this instance of Demeter.
ScatteringPathA list of all ScatteringPath objects created during this instance of Demeter.
VPathA list of all VPath objects created during this instance of Demeter.
SSPathA list of all SSPath objects created during this instance of Demeter.
PrjA list of all Data::Prj objects created during this instance of Demeter.
JSONA list of all Data::JSON objects created during this instance of Demeter.
iwdThe initial working directory when Demeter starts.
cwdDemeter's current working directory.
???
datadefaultThis is a Data object used as a fallback. For instance, one might want to process and plot Path objects without having imported a Data object. This global attribute will be used in that case to properly process and plot the Path.
feffdefaultThis is a Feff object used as a fallback in some Path-like objects.
external_plot_objectFor plotting backends that have an objective interface, this global attribute carried the refernece to that object. For example, in the gnuplot backend, this contains a reference to the Graphics::GnuplotIF object.
uiThis is a string identifying the user interface backend.
When set to screen, it tells triggers the import of curses-based methods in Demeter::UI::Screen::Interview and Demeter::UI::Screen::Progress. Other options used at this time are wx and web.
This is normally set at import, as in
use Demeter qw(:ui=screen);
The default is either the value of $ENV{DEMETER_MODE} or none. Setting $ENV{DEMETER_MODE} is done when the mode setting must be specified very early in startup. This is done, for example, in WebAtoms to set the ui to web.
silently_ignore_unplottableWhen true, this averts croaking in certain situations where an attempt is made to plot an object in a way that it cannot be plotted (for example, attempting to plot in energy a Data object of datatype chi). This is useful in the context of a GUI, but is stringly discouraged in a command line script.
It should rarely be necessary that a user script needs to access this part of this object. Mostly the sentinel functionality is handled behind the scenes, during object creation or destruction or at the end of a script. The details are documented here for those times when one needs to see under the hood.
Each Demeter object (Atoms, Data, Data::Prj, Data::MultiChannel, Data::BulkMerge, Feff, Feff::External, Fit, GDS, Path, Plot, Plot::Indicator, ScatteringPath, SSPath, VPath, etc.) (Data::Prj is refered to just as Prj, other Data::* classes are the same) has each of the following three function associated with it.
All of my examples use the Data object.
This is the accessor for the attribute which holds the list of all Data objects created during this instance of Demeter.
my @list = @{ $object->mo->Data };
push_ObjectThis is the method used to append an object to the list;
$data_object->push_Data($data_object);
This happens automatically when a Data object is created.
clear_ObjectThis method is used to clear the contents of the list.
$data_object->clear_Data;
This is not used for anything at this time, but it seemed useful.
fetchThis method returns an object reference given its group name.
$object = $demeter_object->mo->fetch("ScatteringPath", $group);
In this example, the ScatteringPath object whose group name is $group will be returned. The first argument is one of the Demeter object types. This method was written to facilitate drag and drop in the Wx version of Artemis. Wx's drag and drop capability does not easily do DND on blessed references. It was much easier to do DND on an array of group names, which are simple strings. I then needed this method to convert the list of group names back into a list of object references.
reset_path_indexThis resets the path counter to 1. This is used when closing one project and starting a new one so that path indexing can start at 1 in the new fit. See close_project in Demeter::UI::Artemis::Project.
Moose type constraints are used on several of the GDS object attributes. Error messages appropriate to the type constrain will be generated.
See the discussion of serialization and deserialization in Demeter::Fit.
See Demeter::Config for a description of the configuration system.
Demeter's dependencies are in the Build.PL file.
Errors should be propagated into def 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.