Performing an experiment is one thing, but usually one likes to see the data obtained during recording. This is what displays are designed for. An experiment can have one or more displays that get updated automatically during the experiment run using the event–listener pattern. The base class for displays is
eprcontrol.displays.Display. Every display should inherit from this class.
General display that gets automatically updated during an experiment.
Currently, the class assumes the graphical elements to be created programmatically, but it should be possible in general to use GUIs created in other ways, via “appdesigner” or “guide”, as well.
The class provides the minimal functions to display two-dimensional data, such as those generated via a time-resolved EPR experiment. Thus, it is well-suited to be tested in conjunction with the
A prototypical example for how to use a display in conjunction with an experiment:
experiment = eprcontrol.experiments.DummyExperiment; display = eprcontrol.displays.Display; display.add_listener(experiment); experiment.run();
This way, while the experiment is running, the display is updated.
Set data and update display
After the data are set to the protected attribute of the class, the
update()method is called.
data (numeric) – data to be set (and displayed)
Called as well when calling
set_data()and when having added a listener using
Add listener to a “PostSet” event of the attribute “data”
eprcontrol.experiment.Experiment) – object issuing a “PostSet” event of its “data” property every time the property gets changed
The method adds the
set_data()method as listener to the event, thus updating the display every time the data property of the observed object gets updated.
Remove listener, disconnecting the display from the event
After removing the listener, the display is disconnected from the updates of the previously observed class. However, you can reconnect at any time.