Typhos Data Plugins for PyDM

SignalPlugin

typhos.plugins.register_signal(signal)[source]

Add a new Signal to the registry.

The Signal object is kept within signal_registry for reference by name in the SignalConnection. Signals can be added multiple times, but only the first register_signal call for each unique signal name has any effect.

Signals can be referenced by their name attribute or by their full dotted path starting from the parent’s name.

class typhos.plugins.SignalConnection(channel, address, protocol=None, parent=None)[source]

Connection to monitor an Ophyd Signal.

This is meant as a generalized connection to any type of Ophyd Signal. It handles reporting updates to listeners as well as pushing new values that users request in the PyDM interface back to the underlying signal.

The signal data_type is used to inform PyDM on the Python type that the signal will expect and emit. It is expected that this type is static through the execution of the application.

signal

Stored signal object.

Type:

ophyd.Signal

add_listener(channel)[source]

Add a listener channel to this connection.

This attaches values input by the user to the send_new_value function in order to update the Signal object in addition to the default setup performed in PyDMConnection.

cast(value)[source]

Cast a value to the correct Python type based on signal_type.

If signal_type is not set, the result of ophyd.Signal.describe is used to determine what the correct Python type for value is. We need to be aware of the correct Python type so that we can emit the value through the correct signal and convert values returned by the widget to the correct type before handing them to Ophyd Signal.

close()[source]

Unsubscribe from the Ophyd signal.

find_signal(address: str) Signal[source]

Find a signal in the registry given its address.

This method is intended to be overridden by subclasses that may use a different mechanism to keep track of signals.

Parameters:

address – The connection address for the signal. E.g. in “sig://sim_motor.user_readback” this would be the “sim_motor.user_readback” portion.

Returns:

The Ophyd signal corresponding to the address.

Return type:

Signal

put_value(new_val)[source]

Pass a value from the UI to Signal.

We are not guaranteed that this signal is writeable so catch exceptions if they are created. We attempt to cast the received value into the reported type of the signal unless it is of type np.ndarray.

remove_listener(channel, destroying=False, **kwargs)[source]

Remove a listener channel from this connection.

This removes the send_new_value connections from the channel in addition to the default disconnection performed in PyDMConnection.

send_new_meta(connected=None, write_access=None, severity=None, precision=None, units=None, enum_strs=None, **kwargs)[source]

Update the UI with new metadata from the Signal.

Signal metadata updates always send all available metadata, so default values to this function will not be sent ever if the signal has valid data there.

We default missing metadata to None and skip emitting in general, but for severity we default to NO_ALARM for UI purposes. We don’t want the UI to assume that anything is in an alarm state.

send_new_value(value=None, **kwargs)[source]

Update the UI with a new value from the Signal.

class typhos.plugins.SignalPlugin[source]

Plugin registered with PyDM to handle SignalConnection.

HappiPlugin

These functions will not be imported if happi is not installed in the current Python environment

typhos.plugins.register_client(client)[source]

Register a Happi Client to be used with the DataPlugin.

This is not required to be called by the user, if your environment is setup such that happi.Client.from_config() will return the desired client.

class typhos.plugins.HappiConnection(channel, address, protocol=None, parent=None)[source]

A PyDMConnection to the Happi Database.

add_listener(channel)[source]

Add a new channel to the existing connection.

remove_listener(channel, destroying=False, **kwargs)[source]

Remove a channel from the database connection.

class typhos.plugins.HappiPlugin[source]