exopy.measurement.plugin module

Plugin handling all measurement related functions.

class exopy.measurement.plugin.MeasurementPlugin[source]

Bases: exopy.utils.plugin_tools.HasPreferencesPlugin

The measurement plugin is reponsible for managing all measurement related extensions and handling measurement execution.

workspace

Reference to the workspace if any.

path

Reference to the last directory from/in which a measurement was loaded/saved

edited_measurements

Currently edited measures.

enqueued_measurements

Currently enqueued measures.

processor

Measurement processor responsible for measurement execution.

engines

List of currently available engines.

selected_engine

Currently selected engine represented by its id.

engine_policy

What to do of the engine when there is no more measurement to perform.

pre_hooks

List of currently available pre-execution hooks.

default_pre_hooks

Default pre-execution hooks to use for new measures.

monitors

List of currently available monitors.

default_monitors

Default monitors to use for new measures.

auto_show_monitors

Always show monitors on measurement startup.

post_hooks

List of currently available post-execution hooks.

default_post_hooks

Default post-execution hooks to use for new measures.

editors

List of currently available editors.

start()[source]

Start the plugin lifecycle by collecting all contributions.

stop()[source]

Stop the plugin and remove all observers.

get_declarations(kind, ids)[source]

Get the declarations of engines/editors/tools.

If an id does not correspond to a known declarations it will be omitted from the return value, but no error will be raised. This is because the user can easily know which declarations exist by looking at the appropriate member of the plugin.

Parameters
  • kind ({'engine', 'editor', 'pre-hook', 'monitor', 'post-hook'}) – Kind of object to create.

  • ids (list) – Ids of the declarations to return.

Returns

declarations – Declarations stored in a dict by id.

Return type

dict

create(kind, id, default=True)[source]

Create a new instance of an engine/editor/tool.

Parameters
  • kind ({'engine', 'editor', 'pre-hook', 'monitor', 'post-hook'}) – Kind of object to create.

  • id (unicode) – Id of the object to create.

  • default (bool, optional) – Whether to use default parameters or not when creating the object.

Returns

obj – New instance of the requested object.

Return type

BaseEngine|BaseMeasurementTool|BaseEditor

Raises

ValueError : – Raised if the provided kind or id in incorrect.

find_next_measurement()[source]

Find the next runnable measurement in the queue.

Returns

measurement – First valid measurement in the queue or None if there is no available measurement.

Return type

Measurement|None