csaxs_bec.devices.epics.specMotors.MonoTheta2#
- class MonoTheta2(read_pv, *, string=False, name=None, **kwargs)[source]#
Bases:
VirtualEpicsSignalROConverts the pusher motor position to theta angle
Methods
Register a callback which will receive each OphydObject instance.
calcCheck if the value is valid for this object
Remove a subscription, given the original callback function
Return the description as a dictionary
Provide schema & meta-data for
BlueskyInterface.read_configuration()Disconnect the Signal from the underlying control layer; destroy it
Get the readback value through an explicit call to EPICS.
Disabled for a read-only signal
Put the status of the signal into a simple dictionary format for data acquisition
Dictionary mapping names to value dicts with keys: value, timestamp
Disabled for a read-only signal
set_default_timeoutSet class-wide defaults for EPICS CA communications
Subscribe to events this event_type generates.
Call that is used by bluesky prior to read()
Remove a subscription
unsubscribe_allWait for the underlying signals to initialize or connect
Attributes
SUB_METASUB_VALUEPV alarm severity
PV status
Attempt to cast the EPICS PV value to a string by default
attr_nameIs the signal connected to its associated hardware, and ready to use?
connection_timeoutReturn the dotted name
List of strings if PV is an enum type
Events that can be subscribed to via
obj.subscribeThe high, inclusive control limit for the Signal
Field hints for plotting
kindThe PV control limits (low, high), such that low <= value <= high
The low, inclusive control limit for the Signal
A copy of the metadata dictionary associated with the signal
Metadata keys that will be passed along on value subscriptions
name of the device
The parent of the ophyd object.
The precision of the read PV, as reported by EPICS
The readback PV name
Can the signal be read?
A report on the object.
Walk parents to find ultimate ancestor (parent's parent...).
source_namesubscriptionstimeoutTimestamp of readback PV, according to EPICS
The absolute tolerance associated with the value.
The signal's value
Can the signal be written to?
write_timeout- 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
RuntimeErrorif it has, as a way of verify that no instances will be “missed” by this registry. False by default.
- property alarm_severity#
PV alarm severity
- property alarm_status#
PV status
- property as_string#
Attempt to cast the EPICS PV value to a string 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()#
Return the description as a dictionary
- Returns:
Dictionary of name and formatted description string
- Return type:
dict
- 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_keyschema.- 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 enum_strs#
List of strings if PV is an enum type
- property event_types#
Events that can be subscribed to via
obj.subscribe
- get(*args, **kwargs)#
Get the readback value through an explicit call to EPICS.
- Parameters:
count (int, optional) – Explicitly limit count for array data
as_string (bool, optional) – Get a string representation of the value, defaults to as_string from this signal, optional
as_numpy (bool) – Use numpy array as the return type for array data.
timeout (float, optional) – maximum time to wait for value to be received. (default = 0.5 + log10(count) seconds)
use_monitor (bool, optional) – to use value from latest monitor callback or to make an explicit CA call for the value. (default: True)
connection_timeout (float, optional) – If not already connected, allow up to connection_timeout seconds for the connection to complete.
form ({'time', 'ctrl'}) – PV form to request
- property high_limit#
The high, inclusive control limit for the Signal
- property hints#
Field hints for plotting
- property limits#
The PV 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
- property precision#
The precision of the read PV, as reported by EPICS
- put(*args, **kwargs)#
Disabled for a read-only signal
- property pvname#
The readback PV name
- 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(*args, **kwargs)#
Disabled for a read-only signal
- classmethod set_defaults(*, timeout=2.0, connection_timeout=1.0, write_timeout=None, auto_monitor=False)#
Set class-wide defaults for EPICS CA communications
This may be called only before any instances of EpicsSignalBase are made.
This setting applies to the class it is called on and all its subclasses. For example,
>>> EpicsSignalBase.set_defaults(...)
will apply to
EpicsSignalROandEpicsSignal, which are both subclasses ofEpicsSignalBase.but
>>> EpicsSignal.set_defaults(...)
will not apply to
EpicsSignalRO.- Parameters:
auto_monitor (bool, optional) – If
True, update cached value from EPICS CA monitor callbacks. IfFalse, request new value from EPICS each time get() is called.connection_timeout (float, optional) – Time (seconds) allocated for establishing a connection with the IOC.
timeout (float, optional) – Total time budget (seconds) for reading, not including connection time.
write_timeout (float, optional) – Time (seconds) allocated for writing, not including connection time. The write_timeout is very different than the connection and read timeouts above. It relates to how long an action takes to complete. Any default value we choose here is likely to cause problems—either by being too short and giving up too early on a lengthy action or being too long and delaying the report of a failure. The default, None, waits forever.
- Raises:
RuntimeError – If called after
EpicsSignalBasehas been instantiated for the first time.
- 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,**kwargspassed 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_subsevent_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_typekwargs in _run_subsrun (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 readback PV, according to EPICS
- 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=<object object>)#
Wait for the underlying signals to initialize or connect
- property write_access#
Can the signal be written to?