lsurf.detectors.SphericalDetector
- class lsurf.detectors.SphericalDetector(center, radius, name='Spherical Detector', use_gpu=True)[source]
Spherical detector centered at a point.
Detects all rays that pass within a certain radius of the center point. Good for collecting rays from all directions without directional bias.
- Parameters:
- center
Detector center position.
- Type:
ndarray, shape (3,)
- accumulated_result
All accumulated detections since last clear().
- Type:
Notes
Detection is based on the closest approach distance between each ray and the center point. A ray is detected if this distance is less than or equal to the detection radius.
The arrival time is computed assuming the ray travels through air (n approx 1.0) from its current position to the detection point.
Examples
>>> detector = SphericalDetector( ... center=(0, 0, 100), ... radius=10.0, ... use_gpu=True ... ) >>> result = detector.detect(reflected_rays) >>> print(f"Detected {result.num_rays} rays")
- __init__(center, radius, name='Spherical Detector', use_gpu=True)[source]
Initialize spherical detector.
Methods
__init__(center, radius[, name, use_gpu])Initialize spherical detector.
clear()Clear all recorded detections.
detect(rays[, current_time, accumulate])Detect rays that pass within detection radius.
get_arrival_angles(reference_direction)Get angles between ray directions and reference direction.
Get array of all arrival times.
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, radius, name='Spherical Detector', use_gpu=True)[source]
Initialize spherical 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 pass within detection radius.
For each ray, find the closest approach to center. If within radius, record a detection event.
- Parameters:
- Returns:
Newly detected rays.
- Return type:
- clear()[source]
Clear all recorded detections.
Resets the detector to its initial state with no recorded events.
- get_arrival_times()[source]
Get array of all arrival times.
- Returns:
times – Arrival times in seconds for all detected rays.
- Return type:
ndarray, shape (N,)
- get_arrival_angles(reference_direction)[source]
Get angles between ray directions and reference direction.
- Parameters:
reference_direction (ndarray, shape (3,)) – Reference vector for angle calculation.
- Returns:
angles – Angles in radians.
- Return type:
ndarray, shape (N,)
- get_intensities()[source]
Get array of all detected intensities.
- Returns:
intensities – Intensity values for all detected rays.
- Return type:
ndarray, shape (N,)
- get_wavelengths()[source]
Get array of all detected wavelengths.
- Returns:
wavelengths – Wavelengths in meters.
- Return type:
ndarray, shape (N,)