Area detector¶
The AreaDetector interfaces with the Axis Photonique 2-D detector via BCSz. ExposureQuality reports over/under-exposure from check_exposure.
- class resonance.api.core.det.ExposureQuality(overexposed: bool, underexposed: bool, suggested_exposure_seconds: float | None)[source]¶
Bases:
objectQuality assessment of a single detector exposure.
- class resonance.api.core.det.AreaDetector(conn: BCSz.BCSServer, *, name: str = 'Axis Photonique')[source]¶
Bases:
objectInterface to the Axis Photonique 2-D area detector via BCSz.
- Parameters:
conn (BCSz.BCSServer) – Active BCSz server connection.
name (str, optional) – Instrument name registered in BCSz, defaults to
Axis Photonique.
Examples
>>> image = await bl.detector.acquire(exposure_seconds=0.1) >>> print(image.shape) (1024, 1024) >>> quality = bl.detector.check_exposure(image) >>> print(quality) ExposureQuality(overexposed=False, underexposed=False, suggested_exposure_seconds=None) >>> descriptor = bl.detector.describe() >>> print(descriptor) {'dtype': 'int32', 'source': 'detector', 'external': True, 'shape': [1024, 1024]}
- async acquire(exposure_seconds: float) ndarray | None[source]¶
Trigger an exposure and return the acquired image.
- Parameters:
exposure_seconds (float) – Integration time in seconds.
- Returns:
2-D
int32array of shape(height, width), orNoneif the acquisition reported failure.- Return type:
np.ndarray or None
Notes
The shutter is detector-driven; no plan-level shutter wrapping is required around this call.
- check_exposure(image: ndarray, *, over_threshold: int = 200000, over_pixel_count: int = 500, under_threshold: int = 50, under_pixel_count: int = 950000) ExposureQuality[source]¶
Assess whether an image is over- or under-exposed.
- Parameters:
image (np.ndarray) – 2-D detector image.
over_threshold (int, optional) – Pixel value above which a pixel is considered saturated.
over_pixel_count (int, optional) – Minimum number of saturated pixels required to flag overexposure.
under_threshold (int, optional) – Pixel value below which a pixel is considered dark.
under_pixel_count (int, optional) – Minimum number of dark pixels required to flag underexposure.
- Returns:
Dataclass with
overexposed,underexposed, andsuggested_exposure_secondsfields.- Return type:
Notes
The pixel-count heuristic mirrors the sst-rsoxs GreatEyes thresholds used for automated exposure quality decisions.
- describe() dict[str, Any][source]¶
Return a data_keys-compatible descriptor dict for use in RunWriter.open_stream.
- async is_ready() bool[source]¶
Return whether the instrument driver is running and the detector is ready.
Uses BCSz GetInstrumentDriverStatus for the configured instrument name.
- Returns:
True if the driver is running and the detector can accept acquisitions.
- Return type:
- async setup(*, timeout: float = 30.0, poll_interval: float = 0.5) None[source]¶
Ensure the detector driver is started and ready for acquisition.
Starts the instrument driver via BCSz if not already running, then waits until is_ready() is True or timeout is reached.
- Parameters:
- Raises:
TimeoutError – If the driver did not report ready within timeout seconds.