lsurf.sources.PointSource

class lsurf.sources.PointSource(position, num_rays, wavelength, power=1.0)[source]

Isotropic point source emitting in all directions.

Generates rays from a single point with directions uniformly distributed over the unit sphere.

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

  • num_rays (int) – Number of rays to generate.

  • wavelength (float or tuple of float) – Single wavelength (m) or (min, max) range.

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

position

Source position in meters.

Type:

ndarray, shape (3,)

Notes

The angular distribution is uniform over the full 4π steradians. Each ray carries equal intensity (power / num_rays).

Examples

>>> # Monochromatic point source
>>> source = PointSource(
...     position=(0, 0, 0),
...     num_rays=10000,
...     wavelength=532e-9,
...     power=1e-3
... )
>>> rays = source.generate()
>>> # Polychromatic source (white light LED)
>>> source = PointSource(
...     position=(0, 0.1, 0),
...     num_rays=5000,
...     wavelength=(400e-9, 700e-9),
...     power=0.5
... )
__init__(position, num_rays, wavelength, power=1.0)[source]

Initialize point source.

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

  • num_rays (int) – Number of rays to generate.

  • wavelength (float or tuple of float) – Wavelength in meters or (min, max) range.

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

Methods

__init__(position, num_rays, wavelength[, power])

Initialize point source.

generate()

Generate isotropic ray distribution.

__init__(position, num_rays, wavelength, power=1.0)[source]

Initialize point source.

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

  • num_rays (int) – Number of rays to generate.

  • wavelength (float or tuple of float) – Wavelength in meters or (min, max) range.

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

generate()[source]

Generate isotropic ray distribution.

Creates rays emanating from the source position with directions uniformly distributed over the unit sphere.

Returns:

Ray batch with isotropic direction distribution.

Return type:

RayBatch

Notes

Uses the standard method for uniform sphere sampling: - θ uniformly distributed in [0, 2π) - cos(φ) uniformly distributed in [-1, 1]

__repr__()[source]

Return string representation.