Displays subpackage

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.

Classes

class eprcontrol.displays.Display

Bases: handle

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 eprcontrol.experiments.DummyExperiment class.

Example

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.

Display()

Create an object of the Display class

set_data(data)

Set data and update display

After the data are set to the protected attribute of the class, the update() method is called.

Parameters

data (numeric) – data to be set (and displayed)

update()

Update display

Called as well when calling set_data() and when having added a listener using add_listener().

add_listener(observed_object)

Add listener to a “PostSet” event of the attribute “data”

Parameters

observed_object (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()

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.

delete()

Savely delete object

In case the Display object is deleted, the corresponding figure handle will be closed as well.