psi.core package

Subpackages

Submodules

psi.core.api module

psi.core.exceptions module

Exception hierarchy for psiexperiment.

Catching PSIException distinguishes errors raised (and understood) by the framework from arbitrary programming errors.

exception psi.core.exceptions.ActionError(message, action=None, event=None)[source]

Bases: PSIException

Raised when an ExperimentAction’s command or callback fails.

The original exception is available as __cause__.

action

The ExperimentActionBase instance that failed.

event

Name of the event that triggered the action.

exception psi.core.exceptions.PSIException[source]

Bases: Exception

Base class for all exceptions raised by psiexperiment itself.

psi.core.experiment_action module

class psi.core.experiment_action.EventLogger(parent=None, **kwargs)[source]

Bases: Declarative

Defines a command that is invoked whenever an event occurs

command

A value of type str.

By default, bytes will NOT be promoted to strings. Pass strict=False to the constructor to enable loose string checking.

class psi.core.experiment_action.ExperimentAction(parent=None, **kwargs)[source]

Bases: ExperimentActionBase

command

Command to invoke

class psi.core.experiment_action.ExperimentActionBase(parent=None, **kwargs)[source]

Bases: Declarative

allow_unregistered

If True, the controller’s startup validation will not require the names referenced by event to be registered events or state flags. Only set this for events that are generated dynamically at runtime.

delay

Should action be delayed? If nonzero, this may cause some timing issues. Use with caution.

dependencies

A member which allows list values.

Assigning to a list creates a copy. The orginal list will remain unmodified. This is similar to the semantics of the assignment operator on the C++ STL container classes.

event

A value of type str.

By default, bytes will NOT be promoted to strings. Pass strict=False to the constructor to enable loose string checking.

invocations

Number of times the command was invoked

invoke(core, **kwargs)[source]
kwargs

Arguments to pass to command by keyword

match

A value which is callable.

weight

Defines order of invocation. Less than 100 invokes before default. Higher than 100 invokes after default. Note that if concurrent is True, then order of execution is not guaranteed.

class psi.core.experiment_action.ExperimentCallback(parent=None, **kwargs)[source]

Bases: ExperimentActionBase

callback

Callback to invoke

class psi.core.experiment_action.ExperimentEvent(parent=None, **kwargs)[source]

Bases: Declarative

associated_state

A value which allows objects of a given type or types.

Values will be tested using the PyObject_TypeCheck C API call. This call is equivalent to type(obj) in cls.mro(). It is less flexible but can be faster than Instance. Use Instance when allowing you need a tuple of types or (abstract) types relying on custom __isinstancecheck__ and Typed when the value type is explicit.

If optional is True, the value of a Typed may be set to None, otherwise None is not considered as a valid value.

name

Export the ‘name’ attribute as a declarative member.

class psi.core.experiment_action.ExperimentState(parent=None, **kwargs)[source]

Bases: Declarative

Allows for indication of a state (e.g., experiment_active, iti_active). Automatically contributes the start/end events associataed with the state (e.g., experiment_start, experiment_end).

events = ['prepare', 'start', 'end']
name

Export the ‘name’ attribute as a declarative member.

psi.core.experiment_action.eval_match(code, context, ignore_missing=False)[source]
psi.core.experiment_action.simple_match(key, context, ignore_missing=False)[source]

psi.core.metadata_item module

psi.core.preferences module

class psi.core.preferences.ItemPreferences(parent=None, **kwargs)[source]

Bases: _AutoPreferences

get_object(workbench)[source]
item

A member class which supports value initialization.

A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).

class psi.core.preferences.PluginPreferences(parent=None, **kwargs)[source]

Bases: _AutoPreferences

get_object(workbench)[source]
plugin_id

A value of type str.

By default, bytes will NOT be promoted to strings. Pass strict=False to the constructor to enable loose string checking.

class psi.core.preferences.Preferences(parent=None, **kwargs)[source]

Bases: Declarative

get_object(workbench)[source]
get_preferences(workbench)[source]
name

Export the ‘name’ attribute as a declarative member.

set_preferences(workbench, preferences)[source]

psi.core.status_item module

Module contents