lsurf.sources.CollimatedBeam
- class lsurf.sources.CollimatedBeam(center, direction, radius, num_rays, wavelength, power=1.0, profile='uniform')[source]
Collimated beam with parallel rays.
Generates rays with identical directions and positions distributed in a circular cross-section. Supports uniform and Gaussian intensity profiles.
- Parameters:
center (tuple of float) – Beam center position (x, y, z) in meters.
direction (tuple of float) – Beam propagation direction (dx, dy, dz), will be normalized.
radius (float) – Beam radius 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 beam power in watts. Default is 1.0.
profile ({'uniform', 'gaussian'}, optional) – Spatial intensity profile. Default is ‘uniform’.
- center
Beam center position.
- Type:
ndarray, shape (3,)
- direction
Normalized beam direction.
- Type:
ndarray, shape (3,)
Notes
For Gaussian profile, the radius corresponds to 2σ (where σ is the standard deviation of the Gaussian). Ray intensities are weighted according to the Gaussian distribution.
Ray timing is initialized so that all rays cross the reference plane (at center) at time=0. This ensures coherent phase fronts.
Examples
>>> # Uniform circular beam >>> source = CollimatedBeam( ... center=(0, 0, 0), ... direction=(0, 0, 1), ... radius=1e-3, ... num_rays=5000, ... wavelength=633e-9, ... power=5e-3 ... )
>>> # Gaussian beam profile >>> source = CollimatedBeam( ... center=(0, 0, 0), ... direction=(0, 0, 1), ... radius=2e-3, ... num_rays=10000, ... wavelength=1064e-9, ... power=1.0, ... profile='gaussian' ... )
- __init__(center, direction, radius, num_rays, wavelength, power=1.0, profile='uniform')[source]
Initialize collimated beam.
- Parameters:
center (tuple of float) – Beam center position (x, y, z) in meters.
direction (tuple of float) – Beam propagation direction, will be normalized.
radius (float) – Beam radius 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 beam power in watts. Default is 1.0.
profile ({'uniform', 'gaussian'}, optional) – Spatial intensity profile. Default is ‘uniform’.
- Raises:
ValueError – If radius <= 0 or profile not in {‘uniform’, ‘gaussian’}.
Methods
__init__(center, direction, radius, ...[, ...])Initialize collimated beam.
generate()Generate collimated beam.
- __init__(center, direction, radius, num_rays, wavelength, power=1.0, profile='uniform')[source]
Initialize collimated beam.
- Parameters:
center (tuple of float) – Beam center position (x, y, z) in meters.
direction (tuple of float) – Beam propagation direction, will be normalized.
radius (float) – Beam radius 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 beam power in watts. Default is 1.0.
profile ({'uniform', 'gaussian'}, optional) – Spatial intensity profile. Default is ‘uniform’.
- Raises:
ValueError – If radius <= 0 or profile not in {‘uniform’, ‘gaussian’}.
- generate()[source]
Generate collimated beam.
Creates rays with parallel directions and positions sampled in a disk perpendicular to the beam direction.
- Returns:
Ray batch with collimated ray directions.
- Return type:
Notes
For uniform profile, positions are uniformly distributed in a disk. For Gaussian profile, positions follow a 2D Gaussian distribution and intensities are weighted accordingly.