pcdsdevices.areadetector.detectors.PCDSAreaDetectorBase

class pcdsdevices.areadetector.detectors.PCDSAreaDetectorBase(prefix='', *, name, kind=None, read_attrs=None, configuration_attrs=None, parent=None, **kwargs)

Standard area detector with no plugins.

Ophyd Device Components

Attribute

Class

Suffix

Docs

Kind

Notes

configuration_names

ArrayAttributeSignal

config

Inherited from DetectorBase

cam (ADComponent)

CamBase

normal

Methods

collect_asset_docs()
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.

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 (OrderedDict) – The keys must be strings and the values must be dict-like with the event_model.event_descriptor.data_key schema.

dispatch(key, timestamp)

Notify plugins of acquisition being complete.

When a new acquisition is started, this method is called with a key which is a label like ‘light’, ‘dark’, or ‘gain8’.

It in turn calls generate_datum on all of the plugins that have that method.

File plugins are identified by searching for a generate_datum() method that must have the signature

def generate_datum(key: str, timestamp: float, datum_kwargs: dict):
   ...
Parameters:
  • key (str) – The label for the datum that should be generated

  • timestamp (float) – The time of the trigger

  • datum_kwargs (Dict[str, Any], optional) – Any datum kwargs that should go to all children.

find_signal(text, use_re=False, case_sensitive=False, match_fcn=None, f=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)

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)

generate_datum(key, timestamp, datum_kwargs=None)

Notify plugins of acquisition being complete.

When a new acquisition is started, this method is called with a key which is a label like ‘light’, ‘dark’, or ‘gain8’.

It in turn calls generate_datum on all of the plugins that have that method.

File plugins are identified by searching for a generate_datum() method that must have the signature

def generate_datum(key: str, timestamp: float, datum_kwargs: dict):
   ...
Parameters:
  • key (str) – The label for the datum that should be generated

  • timestamp (float) – The time of the trigger

  • datum_kwargs (Dict[str, Any], optional) – Any datum kwargs that should go to all children.

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 (dict) – Mapping between port_name and ADBase objects

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 (ADBase or None) – Either the requested plugin or None if not found

get_plugin_graph_edges(*, use_names=True, include_cam=False)

Get a list of (source, destination) ports for all plugin chains.

Parameters:
  • use_names (bool, optional) – By default, the ophyd names for each plugin are used. Set this to False to instead get the AreaDetector port names.

  • include_cam (bool, optional) – Include plugins with ‘CAM’ as the source. As it is easy to assume that a camera without an explicit source is CAM, by default this method does not include it in the list.

make_data_key()
missing_plugins()

Find missing ports

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 (OrderedDict) – The keys must be strings and the values must be dict-like with the keys {'value', 'timestamp'}

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_attrs list.

screen(main: bool = False) None

Open camViewer screen for camera.

Parameters:

main (bool, optional) – Set to True to bring up ‘main’ edm config screen. Defaults to False, which opens python viewer.

stop(*, success=False)

Stop the Device and all (instantiated) subdevices

summary()
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 the StatusBase object 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 StatusBase object which is already completed.

Returns:

status (StatusBase) – StatusBase object which will be marked as complete when the device is ready to be read.

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

Attributes

ad_root
configuration_attrs
connected
hints
kind
subscriptions: ClassVar[FrozenSet[str]] = frozenset({'acq_done'})