lsurf.detectors.DirectionalDetector

class lsurf.detectors.DirectionalDetector(position, direction, acceptance_angle, radius, name='Directional Detector')[source]

Detector with angular acceptance cone.

Detects rays that pass within a specified radius AND arrive within a specified angular acceptance cone. Useful for modeling detectors with limited field of view such as telescopes or fiber couplers.

Parameters:
  • position (tuple of float) – Detector position (x, y, z) in meters.

  • direction (tuple of float) – Direction detector is pointing (acceptance cone axis).

  • acceptance_angle (float) – Half-angle of acceptance cone in radians.

  • radius (float) – Detection radius at position in meters.

  • name (str, optional) – Detector name. Default is “Directional Detector”.

position

Detector position.

Type:

ndarray, shape (3,)

direction

Unit vector pointing in detector viewing direction.

Type:

ndarray, shape (3,)

acceptance_angle

Acceptance cone half-angle in radians.

Type:

float

radius

Detection radius.

Type:

float

name

Detector name.

Type:

str

accumulated_result

All accumulated detections since last clear().

Type:

DetectorResult

Notes

A ray is detected if: 1. Its closest approach to the detector position is within radius 2. The angle between the ray direction and the detector direction

(considering the ray as incoming) is within acceptance_angle

Examples

>>> # 10-degree acceptance cone detector
>>> detector = DirectionalDetector(
...     position=(0, 0, 100),
...     direction=(0, 0, -1),
...     acceptance_angle=np.radians(10),
...     radius=5.0
... )
>>> result = detector.detect(rays)
>>> print(f"Detected {result.num_rays} rays within acceptance cone")
__init__(position, direction, acceptance_angle, radius, name='Directional Detector')[source]

Initialize directional detector.

Parameters:
  • position (tuple of float) – Detector position in meters.

  • direction (tuple of float) – Direction detector is pointing.

  • acceptance_angle (float) – Acceptance cone half-angle in radians.

  • radius (float) – Detection radius in meters.

  • name (str, optional) – Detector name.

Methods

__init__(position, direction, ...[, name])

Initialize directional detector.

clear()

Clear all recorded detections.

detect(rays[, current_time, accumulate])

Detect rays within acceptance cone and detection radius.

get_arrival_angles(reference_direction)

Get angles between ray directions and reference direction.

get_arrival_times()

Get array of all arrival times.

get_intensities()

Get array of all detected intensities.

get_positions()

Get array of all detection positions.

get_total_intensity()

Get sum of all detected intensities.

get_wavelengths()

Get array of all detected wavelengths.

Attributes

accumulated_result

All accumulated detections since last clear().

events

list of DetectionEvent objects.

__init__(position, direction, acceptance_angle, radius, name='Directional Detector')[source]

Initialize directional detector.

Parameters:
  • position (tuple of float) – Detector position in meters.

  • direction (tuple of float) – Direction detector is pointing.

  • acceptance_angle (float) – Acceptance cone half-angle in radians.

  • radius (float) – Detection radius in meters.

  • name (str, optional) – Detector name.

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 within acceptance cone and detection radius.

Parameters:
  • rays (RayBatch) – Ray batch to test.

  • current_time (float, optional) – Current simulation time. Default is 0.0.

  • accumulate (bool, optional) – Whether to accumulate results. Default is True.

Returns:

Newly detected rays.

Return type:

DetectorResult

clear()[source]

Clear all recorded detections.

Resets the detector to its initial state with no recorded events.

__repr__()[source]

Return string representation.

__len__()[source]

Return number of detected rays.

get_arrival_times()[source]

Get array of all arrival times.

get_arrival_angles(reference_direction)[source]

Get angles between ray directions and reference direction.

get_intensities()[source]

Get array of all detected intensities.

get_wavelengths()[source]

Get array of all detected wavelengths.

get_positions()[source]

Get array of all detection positions.

get_total_intensity()[source]

Get sum of all detected intensities.