resonance.api.core.det¶
resonance.api.core.det
¶
ExposureQuality(overexposed, underexposed, suggested_exposure_seconds)
dataclass
¶
Quality assessment of a single detector exposure.
Attributes:
| Name | Type | Description |
|---|---|---|
overexposed |
bool
|
True when the number of saturated pixels exceeds the configured threshold. |
underexposed |
bool
|
True when the number of dark pixels exceeds the configured threshold. |
suggested_exposure_seconds |
float or None
|
Recommended exposure time, or None when no suggestion is available. |
AreaDetector(conn, *, name=AXIS_PHOTONIQUE)
¶
Interface to the Axis Photonique 2-D area detector via BCSz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
BCSServer
|
Active BCSz server connection. |
required |
name
|
str
|
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]}
Source code in src/resonance/api/core/det.py
is_ready()
async
¶
Return whether the instrument driver is running and the detector is ready.
Uses BCSz GetInstrumentDriverStatus for the configured instrument name.
Returns:
| Type | Description |
|---|---|
bool
|
True if the driver is running and the detector can accept acquisitions. |
Source code in src/resonance/api/core/det.py
setup(*, timeout=30.0, poll_interval=0.5)
async
¶
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:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Maximum time in seconds to wait for the driver to become ready. Default 30.0. |
30.0
|
poll_interval
|
float
|
Seconds between readiness checks. Default 0.5. |
0.5
|
Raises:
| Type | Description |
|---|---|
TimeoutError
|
If the driver did not report ready within timeout seconds. |
Source code in src/resonance/api/core/det.py
acquire(exposure_seconds)
async
¶
Trigger an exposure and return the acquired image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exposure_seconds
|
float
|
Integration time in seconds. |
required |
Returns:
| Type | Description |
|---|---|
ndarray or None
|
2-D |
Notes
The shutter is detector-driven; no plan-level shutter wrapping is required around this call.
Source code in src/resonance/api/core/det.py
check_exposure(image, *, over_threshold=int(200000.0), over_pixel_count=500, under_threshold=50, under_pixel_count=950000)
¶
Assess whether an image is over- or under-exposed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
2-D detector image. |
required |
over_threshold
|
int
|
Pixel value above which a pixel is considered saturated. |
int(200000.0)
|
over_pixel_count
|
int
|
Minimum number of saturated pixels required to flag overexposure. |
500
|
under_threshold
|
int
|
Pixel value below which a pixel is considered dark. |
50
|
under_pixel_count
|
int
|
Minimum number of dark pixels required to flag underexposure. |
950000
|
Returns:
| Type | Description |
|---|---|
ExposureQuality
|
Dataclass with |
Notes
The pixel-count heuristic mirrors the sst-rsoxs GreatEyes thresholds used for automated exposure quality decisions.
Source code in src/resonance/api/core/det.py
describe()
¶
Return a data_keys-compatible descriptor dict for use in RunWriter.open_stream.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with keys |
Source code in src/resonance/api/core/det.py
get_acquired2d_string(conn, name)
async
¶
Get the acquired 2D string from the detector.
get_acquired2d_base85(conn, name)
async
¶
Get the acquired 2D string from the detector.