lsurf.sources.GaussianBeam

class lsurf.sources.GaussianBeam(waist_position, direction, waist_radius, num_rays, wavelength, power=1.0)[source]

Gaussian beam with specified waist and Rayleigh range.

Implements paraxial Gaussian beam using ray approximation. Each ray represents a wavefront normal, with intensity weighted according to the Gaussian profile.

Parameters:
  • waist_position (tuple of float) – Position of beam waist (x, y, z) in meters.

  • direction (tuple of float) – Beam axis direction (dx, dy, dz), will be normalized.

  • waist_radius (float) – Beam waist radius (w₀) in meters.

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

  • wavelength (float) – Wavelength in meters. Must be monochromatic for Gaussian beam.

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

waist_position

Beam waist position.

Type:

ndarray, shape (3,)

direction

Normalized beam direction.

Type:

ndarray, shape (3,)

waist_radius

Beam waist radius w₀.

Type:

float

rayleigh_range

Rayleigh range z_R = πw₀²/λ.

Type:

float

Notes

The Gaussian beam has intensity profile:

I(r) = I₀ exp(-2r²/w²)

where w is the beam radius at distance z from the waist:

w(z) = w₀ √(1 + (z/z_R)²)

and z_R = πw₀²/λ is the Rayleigh range.

This implementation generates rays at the waist position with parallel directions (plane wavefront at waist). Ray intensities are weighted according to the Gaussian profile.

Examples

>>> # 1 mm waist Nd:YAG laser
>>> source = GaussianBeam(
...     waist_position=(0, 0, 0),
...     direction=(0, 0, 1),
...     waist_radius=1e-3,
...     num_rays=5000,
...     wavelength=1064e-9,
...     power=10e-3
... )
>>> print(f"Rayleigh range: {source.rayleigh_range:.3f} m")
__init__(waist_position, direction, waist_radius, num_rays, wavelength, power=1.0)[source]

Initialize Gaussian beam.

Parameters:
  • waist_position (tuple of float) – Position of beam waist (x, y, z) in meters.

  • direction (tuple of float) – Beam axis direction, will be normalized.

  • waist_radius (float) – Beam waist radius w₀ in meters.

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

  • wavelength (float) – Wavelength in meters.

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

Raises:

ValueError – If wavelength is a tuple (polychromatic not supported), or if waist_radius <= 0.

Methods

__init__(waist_position, direction, ...[, power])

Initialize Gaussian beam.

beam_radius_at(z)

Compute beam radius at distance z from waist.

divergence_angle()

Compute far-field divergence angle.

generate()

Generate Gaussian beam.

__init__(waist_position, direction, waist_radius, num_rays, wavelength, power=1.0)[source]

Initialize Gaussian beam.

Parameters:
  • waist_position (tuple of float) – Position of beam waist (x, y, z) in meters.

  • direction (tuple of float) – Beam axis direction, will be normalized.

  • waist_radius (float) – Beam waist radius w₀ in meters.

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

  • wavelength (float) – Wavelength in meters.

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

Raises:

ValueError – If wavelength is a tuple (polychromatic not supported), or if waist_radius <= 0.

generate()[source]

Generate Gaussian beam.

Creates rays at the waist position with Gaussian-distributed positions and parallel directions.

Returns:

Ray batch with Gaussian intensity distribution.

Return type:

RayBatch

Notes

Positions are sampled from a 2D Gaussian distribution with σ = w₀/2. Intensities are weighted by the Gaussian profile to accurately represent the beam’s energy distribution.

beam_radius_at(z)[source]

Compute beam radius at distance z from waist.

Parameters:

z (float) – Distance from waist along beam axis in meters.

Returns:

Beam radius w(z) in meters.

Return type:

float

Notes

w(z) = w₀ √(1 + (z/z_R)²)

divergence_angle()[source]

Compute far-field divergence angle.

Returns:

Half-angle divergence in radians.

Return type:

float

Notes

θ = λ / (π w₀)

__repr__()[source]

Return string representation.