pcdsdevices.signal.EpicsSignalEditMD
- class pcdsdevices.signal.EpicsSignalEditMD(read_pv, write_pv=None, *, put_complete=False, string=False, limits=False, name=None, **kwargs)
EpicsSignal variant which allows for user correction of various metadata.
- Parameters:
enum_strings (list of str, optional) – List of enum strings to replace the EPICS originals. May not be used in conjunction with the dynamic
enum_attrs
.enum_attrs (list of str, optional) – List of signal attribute names, relative to the parent device. That is to say a given attribute is assumed to be a sibling of this signal instance. Attribute names may be
None
in the case where the original enum string should be passed through.
See also
None
,An
,comprised
,Keyword
- Parameters:
read_pv (str) – The PV to read from
write_pv (str, optional) – The PV to write to if different from the read PV
limits (bool, optional) – Check limits prior to writing value
auto_monitor (bool, optional) – Use automonitor with epics.PV
name (str, optional) – Name of signal. If not given defaults to read_pv
put_complete (bool, optional) – Use put completion when writing the value
tolerance (any, optional) – The absolute tolerance associated with the value. If specified, this overrides any precision information calculated from the write PV
rtolerance (any, optional) – The relative tolerance associated with the value
timeout (float or None, optional) –
The timeout for serving a read request on a connected channel. This is only applied if the PV is connected within connection_timeout (below).
The default value DEFAULT_TIMEOUT means, “Fall back to class-wide default.” See EpicsSignalBase.set_defaults to configure class defaults.
Explicitly passing None means, “Wait forever.”
write_timeout (float or None, optional) –
The timeout for a reply when put completion is used. This is only applied if the PV is connected within connection_timeout (below).
This is very different than the connection and read timeouts above. It relates to how long an action takes to complete, such motor motion or data acquisition. 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. A finite value can be injected here or, perhaps more usefully, via
set
at the Device level, where a context-appropriate value can be chosen.connection_timeout (float or None, optional) –
Timeout for connection. This includes the time to search and establish a channel.
The default value DEFAULT_CONNECTION_TIMEOUT means, “Fall back to class-wide default.” See EpicsSignalBase.set_defaults to configure class defaults.
Explicitly passing None means, “Wait forever.”
Methods
- describe()
Return the signal description as a dictionary.
Units, limits, precision, and enum strings may be overridden.
- Returns:
dict – Dictionary of name and formatted description string
- get(*, as_string=None, timeout=<object object>, connection_timeout=<object object>, form='time', use_monitor=None, **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
- get_setpoint(*, as_string=None, timeout=<object object>, connection_timeout=<object object>, use_monitor=None, form='time', **kwargs)
Get the setpoint value (if setpoint PV and readback PV differ)
- 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
- read()
Put the status of the signal into a simple dictionary format for data acquisition
- Returns:
dict
- read_configuration()
Dictionary mapping names to value dicts with keys: value, timestamp
- set(value, *, timeout=<object object>, settle_time=None)
Set the value of the Signal and return a Status object.
If put completion is used for this EpicsSignal, the status object will complete once EPICS reports the put has completed.
Otherwise the readback will be polled until equal to the set point (as in
Signal.set
)- Parameters:
- Returns:
st (Status)
See also
Signal.set
- classmethod set_default_timeout(**kwargs)
- 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
EpicsSignalRO
andEpicsSignal
, 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
EpicsSignalBase
has been instantiated for the first time.
- trigger()
Call that is used by bluesky prior to read()
Attributes
- SUB_META = 'meta'
- SUB_SETPOINT = 'setpoint'
- SUB_SETPOINT_META = 'setpoint_meta'
- alarm_severity
PV alarm severity
- alarm_status
PV status
- as_string
Attempt to cast the EPICS PV value to a string by default
- connected
Is the signal connected and ready to use?
- connection_timeout
- enum_attrs
Enum attribute names - the source of each enum string.
- enum_strs
List of enum strings.
For an EpicsSignalEditMD, this could be one of:
The original enum strings from the PV
- The strings found from the respective signals referenced by
enum_attrs
.
The user-provided strings in
enum_strs
.
- high_limit
The high, inclusive control limit for the Signal
- hints
Field hints for plotting
- kind
- limits
The PV limits as reported by EPICS (or EpicsSignalEditMD).
- low_limit
The low, inclusive control limit for the Signal
- metadata
- metadata_keys
Metadata keys that will be passed along on value subscriptions
- precision
The PV precision as reported by EPICS (or EpicsSignalEditMD).
- put_complete
Use put completion when writing the value
- pvname
The readback PV name
- read_access
Can the signal be read?
- setpoint
The setpoint PV value
- setpoint_alarm_severity
Setpoint PV alarm severity
- setpoint_alarm_status
Setpoint PV status
- setpoint_pvname
The setpoint PV name
- setpoint_ts
Timestamp of setpoint PV, according to EPICS
- subscriptions: ClassVar[FrozenSet[str]] = frozenset({'meta', 'setpoint', 'setpoint_meta', 'value'})
- timeout
- timestamp
Timestamp of readback PV, according to EPICS
- tolerance
The tolerance of the write PV, as reported by EPICS
Can be overidden by the user at the EpicsSignal level.
- Returns:
tolerance (float or None)
Using the write PV’s precision – If precision == 0, tolerance will be None If precision > 0, calculated to be 10**(-precision)
- use_limits
Check value against limits prior to sending to EPICS
- value
The signal’s value
- write_access
Can the signal be written to?
- write_timeout