csaxs_bec.devices.omny.rt.rt_ophyd.RtSignalBase#

class RtSignalBase(signal_name, **kwargs)[source]#

Bases: SocketSignal

Methods

add_instantiation_callback

Register a callback which will receive each OphydObject instance.

check_value

Check if the value is valid for this object

clear_sub

Remove a subscription, given the original callback function

describe

Provide schema and meta-data for read()

describe_configuration

Provide schema & meta-data for BlueskyInterface.read_configuration()

destroy

Disconnect the Signal from the underlying control layer; destroy it

get

Get the current value of the signal.

put

Put method to send values to the socket.

read

Put the status of the signal into a simple dictionary format for data acquisition

read_configuration

Dictionary mapping names to value dicts with keys: value, timestamp

set

Set the value of the Signal and return a Status object.

subscribe

Subscribe to events this event_type generates.

trigger

Call that is used by bluesky prior to read()

unsubscribe

Remove a subscription

unsubscribe_all

wait_for_connection

Wait for the underlying signals to initialize or connect

Attributes

SUB_META

SUB_SETPOINT

SUB_VALUE

attr_name

connected

Is the signal connected to its associated hardware, and ready to use?

dotted_name

Return the dotted name

event_types

Events that can be subscribed to via obj.subscribe

high_limit

The high, inclusive control limit for the Signal

hints

Field hints for plotting

kind

limits

The control limits (low, high), such that low <= value <= high

low_limit

The low, inclusive control limit for the Signal

metadata

A copy of the metadata dictionary associated with the signal

metadata_keys

Metadata keys that will be passed along on value subscriptions

name

name of the device

parent

The parent of the ophyd object.

read_access

Can the signal be read?

report

A report on the object.

root

Walk parents to find ultimate ancestor (parent's parent...).

source_name

subscriptions

timestamp

Timestamp of the readback value

tolerance

The absolute tolerance associated with the value.

value

The signal's value

write_access

Can the signal be written to?

classmethod add_instantiation_callback(callback, fail_if_late=False)#

Register a callback which will receive each OphydObject instance.

Parameters:
  • callback (callable) – Expected signature: f(ophydobj_instance)

  • fail_if_late (boolean) – If True, verify that OphydObj has not yet been instantiated and raise RuntimeError if it has, as a way of verify that no instances will be “missed” by this registry. False by default.

check_value(value, **kwargs)#

Check if the value is valid for this object

This function does no normalization, but may raise if the value is invalid.

Raises:

ValueError

clear_sub(cb, event_type=None)#

Remove a subscription, given the original callback function

See also subscribe(), unsubscribe()

Parameters:
  • cb (callable) – The callback

  • event_type (str, optional) – The event to unsubscribe from (if None, removes it from all event types)

property connected#

Is the signal connected to its associated hardware, and ready to use?

describe()#

Provide schema and meta-data for read()

This keys in the OrderedDict this method returns must match the keys in the OrderedDict return by read().

This provides schema related information, (ex shape, dtype), the source (ex PV name), and if available, units, limits, precision etc.

Returns:

data_keys – The keys must be strings and the values must be dict-like with the event_model.event_descriptor.data_key schema.

Return type:

OrderedDict

describe_configuration()#

Provide schema & meta-data for BlueskyInterface.read_configuration()

This keys in the OrderedDict this method returns must match the keys in the OrderedDict return by read().

This provides schema related information, (ex shape, dtype), the source (ex PV name), and if available, units, limits, precision etc.

Returns:

data_keys – The keys must be strings and the values must be dict-like with the event_model.event_descriptor.data_key schema.

Return type:

OrderedDict

destroy()#

Disconnect the Signal from the underlying control layer; destroy it

Clears all subscriptions on this Signal. Once destroyed, the signal may no longer be used.

property dotted_name: str#

Return the dotted name

property event_types#

Events that can be subscribed to via obj.subscribe

get(**kwargs)#

Get the current value of the signal. Children should never override this method, but should implement the socket read logic in ‘socket_get’ to ensure proper callback handling and caching of values.

property high_limit#

The high, inclusive control limit for the Signal

property hints#

Field hints for plotting

property limits#

The control limits (low, high), such that low <= value <= high

property low_limit#

The low, inclusive control limit for the Signal

property metadata#

A copy of the metadata dictionary associated with the signal

property metadata_keys#

Metadata keys that will be passed along on value subscriptions

property name#

name of the device

property parent#

The parent of the ophyd object.

If at the top of its hierarchy, parent will be None

put(value, connection_timeout=1, **kwargs)#

Put method to send values to the socket. Children should never override this method, but should implement instead the socket write logic in ‘socket_set’ to ensure proper callback handling.

Parameters:
  • value (any) – The value to set

  • connection_timeout (float, optional) – If not already connected, allow up to connection_timeout seconds for the connection to complete.

read()#

Put the status of the signal into a simple dictionary format for data acquisition

Return type:

dict

property read_access#

Can the signal be read?

read_configuration()#

Dictionary mapping names to value dicts with keys: value, timestamp

property report#

A report on the object.

property root#

Walk parents to find ultimate ancestor (parent’s parent…).

set(value, *, timeout=None, settle_time=None, **kwargs)#

Set the value of the Signal and return a Status object.

Returns:

st – This status object will be finished upon return in the case of basic soft Signals

Return type:

Status

subscribe(callback, event_type=None, run=True)#

Subscribe to events this event_type generates.

The callback will be called as cb(*args, **kwargs) with the values passed to _run_subs with the following additional keys:

sub_type : the string value of the event_type obj : the host object, added if ‘obj’ not already in kwargs

if the key ‘timestamp’ is in kwargs _and_ is None, then it will be replaced with the current time before running the callback.

The *args, **kwargs passed to _run_subs will be cached as shallow copies, be aware of passing in mutable data.

Warning

If the callback raises any exceptions when run they will be silently ignored.

Parameters:
  • callback (callable) –

    A callable function (that takes kwargs) to be run when the event is generated. The expected signature is

    def cb(*args, obj: OphydObject, sub_type: str, **kwargs) -> None:
    

    The exact args/kwargs passed are whatever are passed to _run_subs

  • event_type (str, optional) –

    The name of the event to subscribe to (if None, defaults to the default sub for the instance - obj._default_sub)

    This maps to the sub_type kwargs in _run_subs

  • run (bool, optional) – Run the callback now

See also

clear_sub, _run_subs

Returns:

cid – id of callback, can be passed to unsubscribe to remove the callback

Return type:

int

property timestamp#

Timestamp of the readback value

property tolerance#

The absolute tolerance associated with the value.

trigger()#

Call that is used by bluesky prior to read()

unsubscribe(cid)#

Remove a subscription

See also subscribe(), clear_sub()

Parameters:

cid (int) – token return by subscribe()

property value#

The signal’s value

wait_for_connection(timeout=0.0)#

Wait for the underlying signals to initialize or connect

property write_access#

Can the signal be written to?