lsurf.detectors.PlanarDetector
- class lsurf.detectors.PlanarDetector(center, normal, width, height, name='Planar Detector')[source]
Planar detector with finite rectangular size.
Detects rays that intersect a rectangular plane at a specific position and orientation. Useful for imaging applications and beam profiling.
- Parameters:
center (tuple of float) – Center position of detector plane (x, y, z) in meters.
normal (tuple of float) – Normal vector (defines which direction detector faces).
width (float) – Width of detector (in local u direction) in meters.
height (float) – Height of detector (in local v direction) in meters.
name (str, optional) – Detector name. Default is “Planar Detector”.
- center
Detector center position.
- Type:
ndarray, shape (3,)
- normal
Unit normal vector.
- Type:
ndarray, shape (3,)
- u
Local x-axis direction (width direction).
- Type:
ndarray, shape (3,)
- v
Local y-axis direction (height direction).
- Type:
ndarray, shape (3,)
- accumulated_result
All accumulated detections since last clear().
- Type:
Notes
The local coordinate system is constructed with: - normal: direction the detector faces - u: perpendicular to normal (width direction) - v: perpendicular to both normal and u (height direction)
Only rays traveling toward the front face of the detector (opposite to the normal direction) are detected.
Examples
>>> detector = PlanarDetector( ... center=(0, 0, 50), ... normal=(0, 0, -1), # Facing -z direction ... width=0.1, ... height=0.1 ... ) >>> result = detector.detect(rays)
- __init__(center, normal, width, height, name='Planar Detector')[source]
Initialize planar detector.
Methods
__init__(center, normal, width, height[, name])Initialize planar detector.
clear()Clear all recorded detections.
detect(rays[, current_time, accumulate])Detect rays that intersect the detector plane within bounds.
get_arrival_angles(reference_direction)Get angles between ray directions and reference direction.
Get array of all arrival times.
get_image([bins_u, bins_v])Generate intensity image from detection events.
Get array of all detected intensities.
Get array of all detection positions.
Get sum of all detected intensities.
Get array of all detected wavelengths.
Attributes
All accumulated detections since last clear().
list of DetectionEvent objects.
- __init__(center, normal, width, height, name='Planar Detector')[source]
Initialize planar detector.
- property accumulated_result: DetectorResult
All accumulated detections since last clear().
- property events: list[DetectionEvent]
list of DetectionEvent objects.
For new code, use accumulated_result instead.
- Type:
Backward compatibility
- detect(rays, current_time=0.0, accumulate=True)[source]
Detect rays that intersect the detector plane within bounds.
- Parameters:
- Returns:
Newly detected rays.
- Return type:
Notes
Only detects rays that: - Are traveling toward the front face (opposite to normal) - Intersect the plane in the forward direction - Hit within the width x height bounds
- clear()[source]
Clear all recorded detections.
Resets the detector to its initial state with no recorded events.
- get_image(bins_u=100, bins_v=100)[source]
Generate intensity image from detection events.
- Parameters:
- Returns:
u_centers (ndarray, shape (bins_u,)) – Bin centers in u direction (meters).
v_centers (ndarray, shape (bins_v,)) – Bin centers in v direction (meters).
image (ndarray, shape (bins_v, bins_u)) – Intensity image (sum of intensities per bin).
- Return type:
tuple[ndarray[tuple[Any, …], dtype[float64]], ndarray[tuple[Any, …], dtype[float64]], ndarray[tuple[Any, …], dtype[float64]]]