herosdevices.hardware.ids.peak_camera¶
Driver for cameras based on the ids peak library.
Module Contents¶
- herosdevices.hardware.ids.peak_camera.ids_peak = None¶
- herosdevices.hardware.ids.peak_camera.DEFAULT_CONFIG¶
- class herosdevices.hardware.ids.peak_camera.PeakCompatibleCamera(cam_id: str, config_dict: dict, default_config: str | None = None, lib_path: str | None = None, reset_to_continuous: bool = False)[source]¶
Bases:
herosdevices.core.templates.camera.CameraTemplateA class to interface with IDS Peak cameras.
The class provides functionality to control and capture images from IDS Peak cameras. It manages camera configuration, acquisition, and data streaming.
Important
To access the camera as non-root user, you need to add the following udev rule to
/etc/udev/rules.d/99-ids.rules:ATTRS{idVendor}=="1409", MODE="666"
The vendor library must be obtained from the official website. Download the IDS peak archive file, unpack it at move the content of
lib/ids/cti/to a place where the user running the driver can access it. This path then needs to be specified via thelib_pathargument (/opt/idspeak/ids/cti/in the example below). If you install the full ids peak software via the installer,lib_pathis/usr/lib/ids/cti/.To find the
cam_idof your camera, you can use the script./bin/ids_open_camera_cpp_by_serno. Executing it will list give a list of all connected cameras:IDS peak genericAPI "open_camera_by_serno" Sample v1.1.2 Serial numbers available: 0: 4108829617 - IDS Imaging Development Systems GmbH U3-368xXCP-M (1409f4e7c3b1 U3-368xXCP-M-2) 1: 4108829619 - IDS Imaging Development Systems GmbH U3-368xXCP-M (1409f4e7c3b3 U3-368xXCP-M-3)
In this example, the
cam_idare1409f4e7c3b1and1409f4e7c3b3.Note
The
node_mapattribute provides access to the camera node map. If you need to set some special nodes you can use that. You can find the available nodes in the official API manuals:- node_map: ids_peak.ids_peak.NodeMap | None = None¶
- cam_id¶
- default_config_dict¶
- reset_to_continuous = False¶
- get_config_nodes(only_implemented: bool = True) dict[source]¶
Get all nodes from the camera in form of a dict including information about if they can be set/read.
- Parameters:
only_implemented – Shows only nodes that are implemented on the attached camera. If False, returns all nodes the driver library knows
- get_camera¶
- acquisition_running: bool = False¶
- payload_metadata: dict¶
- keep_device_open = True¶
- default_config: str¶
- get_device() collections.abc.Iterator[None]¶
Yield a device handle.
# use the device in a with statement with self.get_device() as camera: camera.do_something()
- open() Any¶
Open the device handler and assign it to self._device.
- teardown() None¶
Release the device handler and potentially de-initialize the API.
- start() bool¶
Fire a software trigger.
- Returns:
True if successful
- stop() bool¶
Abort the exposure and release queued buffers.
- Returns:
True if successful
- reset() None¶
Reset the device by aborting any ongoing exposure, closing and re-opening the handler.
- get_status() dict¶
Get a dict with the current device status.
- Returns:
A dict with the device status
- property config_dict: dict¶
Get a copy of the configuration dict.
- Returns:
Copy of the configuration dict
- update_configuration(new_config_dict: dict, merge: bool = True) None¶
Update the configuration dict with new configuration.
Each dict key corresponds a (new) configuration name. Each value is a dict with config property -> config value.
- Parameters:
new_config_dict – A dict of configurations where the keys are the configuration names
merge – If
True, the new dict is recursively merged with the current set config dict. IfFalsethe old configurations with the provided names (keys) are overwritten.
- get_configuration() dict¶
Get the currently active configuration.
- Returns:
The currently active configuration.
- configure(config: str = '', metadata: dict | None = None) bool¶
Configure the device with the known configuration config.
To add a configuration to the device, use
update_configuration().- Parameters:
config – Key (name) of the configuration
metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted
acquisition_dataevent.
- set_configuration¶
- update_payload_metadata(metadata: dict, merge: bool = True) None¶
Update metadata dict send with every emitted frame by the
acquisition_dataevent method.- Parameters:
metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted
acquisition_dataevent.merge – If
True, the new dict is merged with the current set metadata dict. IfFalsethe old metadata is overwritten by the given dict.
- arm(metadata: dict | None = None, kill_running: bool = False) bool¶
Arm the device with the currently active configuration.
- Parameters:
metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted
acquisition_dataevent.kill_running – If
Trueany running acquisition will be stopped. IfFalseand an acquisition isrunning (already)
raised. (an error will be)
- Returns:
True if arming was successful else False
- acquisition_data(frame: numpy.ndarray, metadata: dict | None = None) tuple¶
Event to emit new frames.
Note
The dtype of the frame is not changed here.
- Parameters:
frame – The frame payload data (for example an image or an scope trace)
metadata – The metadata which is passed along the payload. This argument takes precedence over the
payload_metadataattribute (for example set by theupdate_payload_metadatamethod) while merging the two dicts.
- Returns:
A tuple of image and metadata(-dict)
- acquisition_started(metadata: dict | None = None) dict¶
Event emitted when the acquisition thread starts.
- Returns:
A dict with acquisition metadata
- acquisition_stopped(metadata: dict | None = None) dict¶
Event emitted when the acquisition thread stops.
- Returns:
A dict with acquisition metadata