lsurf.sources.ParallelBeamFromPositions

class lsurf.sources.ParallelBeamFromPositions(positions, direction, wavelength=5.32e-07, power=1.0)[source]

Parallel rays from explicitly specified positions.

All rays share the same direction, making this ideal for: - Atmospheric refraction studies with specific impact parameters - Plane wave propagation through inhomogeneous media - Grid-based ray launching for wavefront analysis

Unlike CollimatedBeam which generates positions in a disk, this source accepts arbitrary position arrays, enabling custom spatial distributions.

Parameters:
  • positions (array_like, shape (N, 3)) – Starting positions for each ray in meters.

  • direction (tuple of float) – Direction vector for all rays (will be normalized).

  • wavelength (float or tuple of float, optional) – Single wavelength (m) or (min, max) range. Default is 532 nm.

  • power (float, optional) – Total source power in watts. Default is 1.0.

positions

Ray starting positions.

Type:

ndarray, shape (N, 3)

direction

Normalized ray direction.

Type:

ndarray, shape (3,)

Examples

>>> # Rays at different impact parameters for atmospheric study
>>> impact_params = np.linspace(0, 10000, 100)
>>> positions = np.column_stack([
...     -np.sqrt((R + 100e3)**2 - (R + impact_params)**2),  # x
...     np.zeros_like(impact_params),                       # y
...     impact_params                                       # z
... ])
>>> source = ParallelBeamFromPositions(positions, direction=(1, 0, 0))
>>> rays = source.generate()
>>> propagator.propagate(rays, total_distance=500e3, step_size=100)
>>> # Regular grid of rays
>>> x, y = np.meshgrid(np.linspace(-1, 1, 10), np.linspace(-1, 1, 10))
>>> positions = np.column_stack([x.ravel(), y.ravel(), np.zeros(100)])
>>> source = ParallelBeamFromPositions(positions, direction=(0, 0, 1))
__init__(positions, direction, wavelength=5.32e-07, power=1.0)[source]

Initialize parallel ray source.

Parameters:
  • positions (array_like, shape (N, 3)) – Starting positions for each ray in meters.

  • direction (tuple of float) – Direction vector for all rays (will be normalized).

  • wavelength (float or tuple of float, optional) – Wavelength in meters or (min, max) range. Default is 532 nm.

  • power (float, optional) – Total source power in watts. Default is 1.0.

Raises:

ValueError – If positions shape is invalid or direction is zero vector.

Methods

__init__(positions, direction[, wavelength, ...])

Initialize parallel ray source.

generate()

Generate parallel ray batch.

Attributes

positions

Ray starting positions, shape (N, 3).

__init__(positions, direction, wavelength=5.32e-07, power=1.0)[source]

Initialize parallel ray source.

Parameters:
  • positions (array_like, shape (N, 3)) – Starting positions for each ray in meters.

  • direction (tuple of float) – Direction vector for all rays (will be normalized).

  • wavelength (float or tuple of float, optional) – Wavelength in meters or (min, max) range. Default is 532 nm.

  • power (float, optional) – Total source power in watts. Default is 1.0.

Raises:

ValueError – If positions shape is invalid or direction is zero vector.

property positions: ndarray[tuple[Any, ...], dtype[float32]]

Ray starting positions, shape (N, 3).

generate()[source]

Generate parallel ray batch.

Creates rays at the specified positions, all with the same direction.

Returns:

Ray batch with parallel rays ready for propagation.

Return type:

RayBatch

__repr__()[source]

Return string representation.