cameras#
zen_api_utils.cameras
#
Classes:
-
IntegerFrame–Frame representation with integer coordinates.
-
IntegerSize–Size representation with integer dimensions.
-
CameraInfo–Comprehensive camera information container.
Functions:
-
get_cameras_info_LM–Retrieve comprehensive information about all available cameras.
-
get_camera_info_LM–Retrieve comprehensive information about a specific camera by its ID.
IntegerFrame
dataclass
#
IntegerFrame(x: int, y: int, width: int, height: int)
Frame representation with integer coordinates.
Replaces DoubleFrame from ZEN API to avoid floating-point precision issues and provide cleaner integer-based coordinate handling.
Attributes:
-
x(int) –X-coordinate of the frame's starting point (left edge)
-
y(int) –Y-coordinate of the frame's starting point (top edge)
-
width(int) –Width of the frame in pixels
-
height(int) –Height of the frame in pixels
IntegerSize
dataclass
#
IntegerSize(width: int, height: int)
Size representation with integer dimensions.
Replaces DoubleSize from ZEN API to provide cleaner integer-based dimension handling without floating-point precision concerns.
Attributes:
-
width(int) –Width dimension in pixels
-
height(int) –Height dimension in pixels
CameraInfo
dataclass
#
CameraInfo(available_binnings: list[str], binning: int, binning_description: str, exposure_time: float, min_exposure_time: float, max_exposure_time: float, id: str, name: str, is_preset: bool, frame: IntegerFrame, max_frame_size: IntegerSize)
Comprehensive camera information container.
Contains all relevant camera parameters converted to appropriate data types for easier handling and processing. Frame and size information is converted to integer-based representations for precision and convenience.
Attributes:
-
available_binnings(list[str]) –List of available binning modes (e.g., "1x1", "2x2")
-
binning(int) –Current binning factor
-
binning_description(str) –Human-readable description of current binning
-
exposure_time(float) –Current exposure time in seconds
-
min_exposure_time(float) –Minimum allowed exposure time in seconds
-
max_exposure_time(float) –Maximum allowed exposure time in seconds
-
id(str) –Unique camera identifier
-
name(str) –Human-readable camera name
-
is_preset(bool) –Whether camera settings are from a preset configuration
-
frame(IntegerFrame) –Current camera frame/ROI with integer coordinates
-
max_frame_size(IntegerSize) –Maximum possible frame size with integer dimensions
get_cameras_info_LM
async
#
get_cameras_info_LM(cameras_service: CameraServiceStub) -> list[CameraInfo]
Retrieve comprehensive information about all available cameras.
Queries the ZEN API camera service to get detailed information about all cameras in the system, including their current settings, capabilities, and frame configurations. Converts ZEN API's DoubleFrame and DoubleSize objects to integer-based representations for easier handling.
Parameters:
-
cameras_service(CameraServiceStub) –Connected camera service stub for API calls
Returns:
-
list[CameraInfo]–list[CameraInfo]: List of camera information objects with converted data types
Raises:
-
Exception–If camera service communication fails or camera data is inaccessible
Example
channel, metadata = initialize_zenapi("config.ini") camera_service = CameraServiceStub(channel=channel, metadata=metadata) cameras = await get_cameras_list_LM(camera_service) for camera in cameras: ... print(f"Camera: {camera.name}, Size: {camera.max_frame_size.width}x{camera.max_frame_size.height}")
get_camera_info_LM
async
#
get_camera_info_LM(cameras_service: CameraServiceStub, camera_id: str) -> CameraInfo
Retrieve comprehensive information about a specific camera by its ID.
Queries the ZEN API camera service to get detailed information about a specific camera identified by its unique ID, including its current settings, capabilities, and frame configurations. Converts ZEN API's DoubleFrame and DoubleSize objects to integer-based representations for easier handling.
Parameters:
-
cameras_service(CameraServiceStub) –Connected camera service stub for API calls
-
camera_id(str) –Unique identifier of the camera to retrieve
Returns:
-
CameraInfo(CameraInfo) –Camera information object with converted data types
Raises:
-
Exception–If camera service communication fails or camera ID is invalid
Example
channel, metadata = initialize_zenapi("config.ini") camera_service = CameraServiceStub(channel=channel, metadata=metadata) camera = await get_camera_info_LM(camera_service, "camera_001") print(f"Camera: {camera.name}, Binning: {camera.binning}")