pyrolab.drivers.Instrument

Contents

pyrolab.drivers.Instrument#

class Instrument[source]#

Bases: Service

Abstract base class provides a common interface for services and instruments.

While not a true abstract base class (it can be instantiated), all the essential functions raise NotImplementedErrors when run. They are therefore required to be overridden by derived classes.

Note that, in order to support autoconnect within the PyroLab framework, the __init__ method is never used to set up or connect to the instrument. This is because when objects are hosted by a PyroLab server, they are instantiated and that object exists in perpetuity. Since we’d like to be able to connect and disconnect from devices while leaving the server running (an example use case would be to use the device locally, in a lab, manipulating physical controls, without killing the server connection), separate methods connect() and close() are required. In this way, instruments can be forcibly disconnected without leaving the hosting object in an unrecoverable state.

Attributes:
_autoconnect_paramsdict

A private dictionary of parameters that will be used to connect to the instrument when hosted by a PyroLab server. This value should never be manipulated by a user. It is listed here to prevent accidental overwriting by an unwitting user wanting to use the same name.

Methods

autoconnect()

Autoconnect to an instrument using internally stored parameters.

close()

Releases resources, hardware or otherwise.

connect(**kwargs)

Connects to instruments or services that require initialization.

detect_devices()

Returns a list of connection parameters for available devices.

ping()

Returns a bool (True) to indicate that the Daemon is alive and can be communicated with.

pyrolab_version()

Return the version of PyroLab running the device.

set_behavior([instance_mode, instance_creator])

Sets the Pyro5 behavior for the class (modified in place).