pcdsdevices.areadetector.detectors.PCDSHDF5BlueskyTriggerable
- class pcdsdevices.areadetector.detectors.PCDSHDF5BlueskyTriggerable(*args, write_path: str, always_acquire: bool = True, **kwargs)
- Saves an HDF5 file in a bluesky plan. - This class takes care of all the standard setup for saving the files using the HDF5 plugin for our area detector setups at LCLS during bluesky scans, including configuration of the stage signals and various site-specific settings. - You can decide how many images we’ll take at each point by setting the - num_images_per_pointattribute.- There are two modes provided: “always aquire” and “aquire at points” with key differences in the behavior. You can select which one to use using the - always_acquirekeyword argument, which defaults to True.- With always_aquire=True (default): - Viewers will remain updated throughout the scan, even between - scan points. - The camera will be set to - acquireat- stage, if needed, which begins taking images. This happens early in the scan.
- At each point, the - capturefeature of the HDF5 plugin will be toggled on until we’ve saved an image count equal to the- num_images_per_pointattribute. The counting is handled by the plugin.
- If the camera or server lags during the aquisition, the scan will patiently wait for the correct number of images to be saved. 
- There is no guarantee that the images are sequential, there can be gaps, but each image that does get saved will be trigger-synchronized. (And therefore, beam-synchronized with beam-synchronized triggers). 
- Each point in the scan will have its own associate hdf5 file. 
- If the camera needed to be set to - acquireat- stage, it will revert to- stopat- unstage.
 - With always_acquire=False: - Viewers will only be updated at the specific scan points. - The HDF5 plugin will be set to - captureat stage, and the camera- will be configured to take a fixed number of images per acquisition cycle. - At each point, the - acquirebit will be turned on, which causes- num_images_per_pointimages to be acquired.
- If the camera or server lags during the acquisition, it will be unable to complete it cleanly. 
- There is a guarantee that the images are sequential. 
- All the points in the scan will be grouped into one larger hdf5 file. 
 - This class can be also be used interactively via the - save_imagesfunction.- Parameters:
- prefix ( - str) – The PV prefix that leads us to this camera’s PVs.
- write_path ( - str) – The directory to drop our hdf5 files into.
- always_acquire ( - bool, optional) – Determines which mode we use to collect images as described above.
- name ( - str, keyword-only) – A name to associate with the camera for bluesky.
 
 - Ophyd Device Components - Attribute - Class - Suffix - Docs - Kind - Notes - configuration_names - ArrayAttributeSignal- config - Inherited from - PCDSAreaDetectorBase- cam (ADComponent) - normal - Inherited from - PCDSAreaDetectorBase- hdf51 (ADComponent) - HDF51:- Save output as an HDF5 file - 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 - OrderedDictthis method returns must match the keys in the- OrderedDictreturn 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_keyschema.
 
 - 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_datumon 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): ... 
 - 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_datumon 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): ... 
 - 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 - OrderedDictreturned by this method must have identical keys (in the same order) as the- OrderedDictreturned 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_attrslist.
 - 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. 
 
 - 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.
 
 - stop(*, success=False)
- Stop the Device and all (instantiated) subdevices 
 - summary()
 - trigger()
- Trigger one acquisition. 
 - 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
 - connection_timeout
 - hints
 - kind
 - num_images_per_point
- The number of images to save at each point in the scan.