csaxs_bec.devices.epics.falcon_csaxs.FalconControl#
- class FalconControl(prefix='', *, name, kind=None, read_attrs=None, configuration_attrs=None, parent=None, child_name_separator='_', connection_timeout=<object object>, **kwargs)[source]#
Bases:
FalconFalcon Control class at cSAXS. prefix: ‘X12SA-SITORO:’
Methods
Register a callback which will receive each OphydObject instance.
Check if the value is valid for this object
Remove a subscription, given the original callback function
Configure the device for something during a run
Provide schema and meta-data for
read().Provide schema & meta-data for
read_configuration()Disconnect and destroy all signals on the Device
Search through the signal docs on this detector for the string text
Get the value of all components in the device
Get the directed graph of the ASYN ports
Return port name : component map
The device tuple type associated with an Device class
Yields all of the instantiated signals in a device hierarchy
Get the plugin which has the given asyn port name
Find missing ports
Attempt to 'pause' the device.
Put a value to all components of the device
Read data from the device.
Dictionary mapping names to value dicts with keys: value, timestamp
Resume a device from a 'paused' state.
Set class-wide defaults for device communications
Stage the device for data collection.
Stop the Device and all (instantiated) subdevices
Subscribe to events this event_type generates.
summaryTrigger the device and return status object.
Unstage the device.
Remove a subscription
unsubscribe_allValidate that all components of pipeline are known
This generates a figure showing the current asyn port layout.
Wait for signals to connect
Walk all components in the Device hierarchy
Walk all signals in the Device hierarchy
Walk all sub-Devices classes in the Device hierarchy
Walk all sub-Devices in the hierarchy
Attributes
SUB_ACQ_DONEacquire_busyA descriptor representing a device component (or signal)
acquiringA descriptor representing a device component (or signal)
ad_rootattr_nameauto_pixels_per_bufferA descriptor representing a device component (or signal)
buffer_sizeA descriptor representing a device component (or signal)
channel_advanceA descriptor representing a device component (or signal)
client_waitA descriptor representing a device component (or signal)
collect_modeA descriptor representing a device component (or signal)
component_namesconfiguration_attrsconfiguration_namesA descriptor representing a device component (or signal)
If the device is connected.
connection_timeoutcopt_risetime_optimizationA descriptor representing a device component (or signal)
copy_decay_timeA descriptor representing a device component (or signal)
copy_detection_filterA descriptor representing a device component (or signal)
copy_detection_thresholdA descriptor representing a device component (or signal)
copy_detector_polarityA descriptor representing a device component (or signal)
copy_min_pulse_pair_separationA descriptor representing a device component (or signal)
copy_roi_channelA descriptor representing a device component (or signal)
copy_roi_energyA descriptor representing a device component (or signal)
copy_roi_scaA descriptor representing a device component (or signal)
copy_scale_factorA descriptor representing a device component (or signal)
dead_timeA descriptor representing a device component (or signal)
do_read_allA descriptor representing a device component (or signal)
do_read_tracesA descriptor representing a device component (or signal)
do_status_allA descriptor representing a device component (or signal)
Return the dotted name
dwellA descriptor representing a device component (or signal)
dxpA descriptor representing a device component (or signal)
erase_allA descriptor representing a device component (or signal)
erase_startA descriptor representing a device component (or signal)
Events that can be subscribed to via
obj.subscribehdf5A descriptor representing a device component (or signal)
hintsidead_timeA descriptor representing a device component (or signal)
ignore_gateA descriptor representing a device component (or signal)
input_logic_polarityA descriptor representing a device component (or signal)
kindlazy_wait_for_connectionlist_modeA descriptor representing a device component (or signal)
max_elapsed_liveA descriptor representing a device component (or signal)
max_elapsed_realA descriptor representing a device component (or signal)
max_elapsed_trigger_liveA descriptor representing a device component (or signal)
max_eventsA descriptor representing a device component (or signal)
max_input_count_rateA descriptor representing a device component (or signal)
max_output_count_rateA descriptor representing a device component (or signal)
max_scasA descriptor representing a device component (or signal)
max_triggersA descriptor representing a device component (or signal)
mbytes_readA descriptor representing a device component (or signal)
mcaA descriptor representing a device component (or signal)
name of the device
nd_array_modeA descriptor representing a device component (or signal)
next_pixelA descriptor representing a device component (or signal)
num_scasA descriptor representing a device component (or signal)
The parent of the ophyd object.
pixel_advance_modeA descriptor representing a device component (or signal)
pixels_per_bufferA descriptor representing a device component (or signal)
pixels_per_runA descriptor representing a device component (or signal)
poll_timeA descriptor representing a device component (or signal)
port_nameprescaleA descriptor representing a device component (or signal)
preset_eventsA descriptor representing a device component (or signal)
preset_modeA descriptor representing a device component (or signal)
preset_real_timeA descriptor representing a device component (or signal)
preset_triggersA descriptor representing a device component (or signal)
read_allA descriptor representing a device component (or signal)
read_all_onceA descriptor representing a device component (or signal)
read_attrsread_rateA descriptor representing a device component (or signal)
read_tracesA descriptor representing a device component (or signal)
A report on the object.
Walk parents to find ultimate ancestor (parent's parent...).
save_systemA descriptor representing a device component (or signal)
save_system_fileA descriptor representing a device component (or signal)
set_acquire_busyA descriptor representing a device component (or signal)
set_client_waitA descriptor representing a device component (or signal)
signal_namessnl_connectedA descriptor representing a device component (or signal)
start_allA descriptor representing a device component (or signal)
status_allA descriptor representing a device component (or signal)
status_all_onceA descriptor representing a device component (or signal)
stop_allA descriptor representing a device component (or signal)
subscriptionssync_countA descriptor representing a device component (or signal)
trigger_signals- class OphydAttrList(device, kind, remove_kind, recurse_key)#
Bases:
MutableSequencelist proxy to migrate away from Device.read_attrs and Device.config_attrs
- append(value)#
S.append(value) – append value to the end of the sequence
- clear() None -- remove all items from S#
- count(value) integer -- return number of occurrences of value#
- extend(values)#
S.extend(iterable) – extend sequence by appending elements from the iterable
- index(value[, start[, stop]]) integer -- return first index of value.#
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- insert(index, object)#
S.insert(index, value) – insert value before index
- pop([index]) item -- remove and return item at index (default last).#
Raise IndexError if list is empty or index is out of range.
- remove(value)#
S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.
- reverse()#
S.reverse() – reverse IN PLACE
- 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.
- apply = None#
- auto_apply = None#
- 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)
- configure(d: Dict[str, Any]) Tuple[Dict[str, Any], Dict[str, Any]]#
Configure the device for something during a run
This default implementation allows the user to change any of the configuration_attrs. Subclasses might override this to perform additional input validation, cleanup, etc.
- Parameters:
d (dict) – The configuration dictionary. To specify the order that the changes should be made, use an OrderedDict.
- Returns:
(old, new) tuple of dictionaries
Where old and new are pre- and post-configure configuration states.
- property connected#
If the device is connected.
Subclasses should override this
- describe() OrderedDictType[str, Dict[str, Any]]#
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_keyschema.- Return type:
OrderedDict
- describe_configuration() OrderedDictType[str, Dict[str, Any]]#
Provide schema & meta-data for
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 and destroy all signals on the Device
- property dotted_name: str#
Return the dotted name
- property event_types#
Events that can be subscribed to via
obj.subscribe
- find_signal(text, use_re=False, case_sensitive=False, match_fcn=None, f=<colorama.ansitowin32.StreamWrapper object>)#
Search through the signal docs on this detector for the string text
- Parameters:
text (str) – Text to find
use_re (bool, optional) – Use regular expressions
case_sensitive (bool, optional) – Case sensitive search
match_fcn (callable, optional) – Function to call when matches are found Defaults to a function that prints matches to f
f (file-like, optional) – File-like object that the default match function prints to (Defaults to sys.stdout)
- get(**kwargs)#
Get the value of all components in the device
Keyword arguments are passed onto each signal.get(). Components beginning with an underscore will not be included.
- get_asyn_digraph()#
Get the directed graph of the ASYN ports
- Returns:
G (networkx.DiGraph) – Directed graph of pipelines
port_map (dict) – Mapping between port_name and ADBase objects
- get_asyn_port_dictionary()#
Return port name : component map
- Returns:
port_map – Mapping between port_name and ADBase objects
- Return type:
dict
- classmethod get_device_tuple()#
The device tuple type associated with an Device class
This is a tuple representing the full state of all components and dynamic device sub-components.
- get_instantiated_signals(*, attr_prefix=None)#
Yields all of the instantiated signals in a device hierarchy
- Parameters:
attr_prefix (string, optional) – The attribute prefix. If None, defaults to self.name
- Yields:
(fully_qualified_attribute_name, signal_instance)
- get_plugin_by_asyn_port(port_name)#
Get the plugin which has the given asyn port name
- Parameters:
port_name (str) – The port name to search for
- Returns:
ret – Either the requested plugin or None if not found
- Return type:
ADBase or None
- missing_plugins()#
Find missing ports
- 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
- pause() None#
Attempt to ‘pause’ the device.
This is called when ever the
RunEngineis interrupted.A device may have internal state that means plans can not safely be re-wound. This method may: put the device in a ‘paused’ state and/or raise
NoReplayAllowedto indicate that the plan can not be rewound.- Raises:
bluesky.run_engine.NoReplayAllowed –
- put(dev_t, **kwargs)#
Put a value to all components of the device
Keyword arguments are passed onto each signal.put()
- Parameters:
dev_t (DeviceTuple or tuple) – The device tuple with the value(s) to put (see get_device_tuple)
- read() OrderedDictType[str, Dict[str, Any]]#
Read data from the device.
This method is expected to be as instantaneous as possible, with any substantial acquisition time taken care of in
trigger().The OrderedDict returned by this method must have identical keys (in the same order) as the OrderedDict returned by
describe().By convention, the first key in the return is the ‘primary’ key and maybe used by heuristics in
bluesky.The values in the ordered dictionary must be dict (-likes) with the keys
{'value', 'timestamp'}. The'value'may have any type, the timestamp must be a float UNIX epoch timestamp in UTC.- Returns:
data – The keys must be strings and the values must be dict-like with the keys
{'value', 'timestamp'}- Return type:
OrderedDict
- read_configuration() OrderedDictType[str, Dict[str, Any]]#
Dictionary mapping names to value dicts with keys: value, timestamp
To control which fields are included, change the Component kinds on the device, or modify the
configuration_attrslist.
- property report#
A report on the object.
- resume() None#
Resume a device from a ‘paused’ state.
This is called by the
bluesky.run_engine.RunEnginewhen it resumes from an interruption and is responsible for ensuring that the device is ready to take data again.
- property root#
Walk parents to find ultimate ancestor (parent’s parent…).
- classmethod set_defaults(*, connection_timeout=10.0)#
Set class-wide defaults for device communications
This may be called only before any instances of Device are made.
This setting applies to the class it is called on and all its subclasses. For example,
>>> Device.set_defaults(...)
will apply to any Device subclass.
- Parameters:
connection_timeout (float, optional) – Time (seconds) allocated for establishing a connection with the IOC.
- Raises:
RuntimeError – If called after
EpicsSignalBasehas been instantiated for the first time.
- stage(*args, **kwargs)#
Stage the device for data collection.
This method is expected to put the device into a state where repeated calls to
trigger()andread()will ‘do the right thing’.Staging not idempotent and should raise
RedundantStagingif staged twice without an intermediateunstage().This method should be as fast as is feasible as it does not return a status object.
The return value of this is a list of all of the (sub) devices stage, including it’s self. This is used to ensure devices are not staged twice by the
RunEngine.This is an optional method, if the device does not need staging behavior it should not implement stage (or unstage).
- Returns:
devices – list including self and all child devices staged
- Return type:
list
- stop(*, success=False)#
Stop the Device and all (instantiated) subdevices
- 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
- trigger() StatusBase#
Trigger the device and return status object.
This method is responsible for implementing ‘trigger’ or ‘acquire’ functionality of this device.
If there is an appreciable time between triggering the device and it being able to be read (via the
read()method) then this method is also responsible for arranging that theStatusBaseobject returned by this method is notified when the device is ready to be read.If there is no delay between triggering and being readable, then this method must return a
StatusBaseobject which is already completed.- Returns:
status –
StatusBaseobject which will be marked as complete when the device is ready to be read.- Return type:
StatusBase
- unstage() List[object]#
Unstage the device.
This method returns the device to the state it was prior to the last stage call.
This method should be as fast as feasible as it does not return a status object.
This method must be idempotent, multiple calls (without a new call to ‘stage’) have no effect.
- Returns:
devices – list including self and all child devices unstaged
- Return type:
list
- unsubscribe(cid)#
Remove a subscription
See also
subscribe(),clear_sub()- Parameters:
cid (int) – token return by
subscribe()
- validate_asyn_ports()#
Validate that all components of pipeline are known
- Raises:
RuntimeError – If there any input ports to known plugins where the source is not known to ophyd
- visualize_asyn_digraph(ax=None, *args, **kwargs)#
This generates a figure showing the current asyn port layout.
This method generates a plot showing all of the currently enabled Areadetector plugin asyn ports and their relationships. The current ports and relationships are found using self.get_asyn_digraph.
- Parameters:
ax (matplotlib axes) – if None (default) then a new figure is created otherwise it is plotted on the specified axes.
*args (networkx.draw_networkx args and kwargs.) – For the allowed args and kwargs see the networkx.draw_networkx documentation
**kwargs (networkx.draw_networkx args and kwargs.) –
For the allowed args and kwargs see the networkx.draw_networkx documentation
- wait_for_connection(all_signals=False, timeout=<object object>)#
Wait for signals to connect
- Parameters:
all_signals (bool, optional) – Wait for all signals to connect (including lazy ones)
timeout (float or None) – Overall timeout
- classmethod walk_components()#
Walk all components in the Device hierarchy
- Yields:
ComponentWalk – Where ancestors is all ancestors of the signal, including the top-level device walk_components was called on.
- walk_signals(*, include_lazy=False)#
Walk all signals in the Device hierarchy
EXPERIMENTAL: This method is experimental, and there are tentative plans to change its API in a way that may not be backward-compatible.
- Parameters:
include_lazy (bool, optional) – Include not-yet-instantiated lazy signals
- Yields:
ComponentWalk – Where ancestors is all ancestors of the signal, including the top-level device walk_signals was called on.
- classmethod walk_subdevice_classes()#
Walk all sub-Devices classes in the Device hierarchy
- Yields:
(dotted_name, subdevice_class)
- walk_subdevices(*, include_lazy=False)#
Walk all sub-Devices in the hierarchy
EXPERIMENTAL: This method is experimental, and there are tentative plans to change its API in a way that may not be backward-compatible.
- Yields:
(dotted_name, subdevice_instance)