de_twin.detector.Detector#
- class de_twin.detector.Detector(model='DE16', seed=0, *, ht_kv=300.0, **overrides)[source]#
Bases:
objectA camera: sensor maps (dark, gain, defects) plus the per-frame noise pipeline.
overridesreplace anyCameraModelfield, e.g.Detector("DE16", read_noise_adu=4, hot_pixel_fraction=0).exposeis serialised by an internal lock (it reuses buffers).- Parameters:
model (CameraModel | str)
seed (int)
ht_kv (float)
- __init__(model='DE16', seed=0, *, ht_kv=300.0, **overrides)[source]#
- Parameters:
model (CameraModel | str)
seed (int)
ht_kv (float)
Methods
__init__([model, seed, ht_kv])dark_current_map(exposure_s)Dark-current contribution (ADU) for
exposure_s, full sensor (hot pixels included).expected_dark(exposure_s[, request])Noise-free expected dark frame (float64, output shape); integrating cameras.
expected_gain([request])Gain map binned to the output shape (float64).
expose(flux, exposure_s[, request, ...])Simulate one raw frame.
output_shape([request])(h, w) of the hardware frame: ROI, then binning (integer division, like DE-Server); twice that each way for a super-resolution counting frame.
roi([request])Resolved hardware ROI: the requested ROI clamped to the sensor (0 size = full).
super_resolution([request])Whether request reads this camera out at super-resolution: a counting camera, asked for it, unbinned (binning and super-resolution do not combine).
Attributes
True for hot, dead and bad-column pixels, full sensor.
Exposure-independent dark level (offset + fixed pattern), full sensor, ADU.
Relative gain (mean 1; 0 for dead pixels), full sensor.
false counts/s).
- roi(request=None)[source]#
Resolved hardware ROI: the requested ROI clamped to the sensor (0 size = full).
No DE alignment is re-applied: DE-Server sends an already aligned ROI and its
hw_framemust be reproduced exactly.- Parameters:
request (AcquisitionRequest | None)
- Return type:
Roi
- output_shape(request=None)[source]#
(h, w) of the hardware frame: ROI, then binning (integer division, like DE-Server); twice that each way for a super-resolution counting frame.
- Parameters:
request (AcquisitionRequest | None)
- Return type:
- super_resolution(request=None)[source]#
Whether request reads this camera out at super-resolution: a counting camera, asked for it, unbinned (binning and super-resolution do not combine).
- Parameters:
request (AcquisitionRequest | None)
- Return type:
- property dark_map: ndarray#
Exposure-independent dark level (offset + fixed pattern), full sensor, ADU.
- property hot_pixels: tuple[ndarray, ndarray, ndarray]#
false counts/s).
- Type:
(y, x, dark current ADU/s) of the hot pixels (counting cameras
- dark_current_map(exposure_s)[source]#
Dark-current contribution (ADU) for
exposure_s, full sensor (hot pixels included).
- expected_dark(exposure_s, request=None)[source]#
Noise-free expected dark frame (float64, output shape); integrating cameras.
- Parameters:
exposure_s (float)
request (AcquisitionRequest | None)
- Return type:
- expected_gain(request=None)[source]#
Gain map binned to the output shape (float64).
- Parameters:
request (AcquisitionRequest | None)
- Return type:
- expose(flux, exposure_s, request=None, frame_index=0, *, ht_kv=None, seed=None)[source]#
Simulate one raw frame.
flux: electrons / sensor pixel / second, a float array of the ROI shape (or of the binned output shape, or a scalar), orNonefor no beam (dark reference, blanked, retracted…). Returns(frame, info); the frame hasoutput_shape()and the model’s dtype (uint16, or uint8 for counting cameras).infoholdsdose_e_per_px(mean electrons per sensor pixel),saturated,saturated_pixels,blankedand the resolved geometry.seedreplaces the detector’s own for this frame’s noise (a pinned acquisition).