Phase#
Phase operations: shifting, wrapping and random perturbations.
Utility functions to apply wavelength-dependent phase shifts, wrap phases into an interval, and add Gaussian noise.
- phise.modules.phase.shift_jit(
- ψ: complex | ndarray,
- δφ: float | ndarray,
- λ: float,
Phase rotation (njit) of an electric field.
- Parameters:
ψ – Complex electric field (scalar or array).
δφ – Applied phase shift (same unit as
λonce converted).λ – Wavelength (scalar, in length units).
- Returns:
Field with phase shift applied, same shape as
ψ.
- phise.modules.phase.shift(
- ψ: complex | ndarray,
- δφ: Quantity,
- λ: Quantity,
Apply a phase shift with unit handling.
Converts
Quantityinputs to numeric values then callsshift_jit().- Parameters:
ψ – Complex electric field (scalar or array).
δφ – Phase shift (length
Quantity, e.g. meters).λ – Wavelength (length
Quantity) used in 2π δφ/λ.
- Returns:
Field with phase shift applied, same shape as
ψ.
- phise.modules.phase.bound(
- φ: Quantity,
- λ: Quantity,
Wrap a phase into [0, λ[ while preserving units.
- Parameters:
φ – Phase (length
Quantity) to wrap.λ – Wavelength (length
Quantity) defining the interval.
- Returns:
Wrapped phase in [0, λ[ with the unit of
φ.
- phise.modules.phase.bound_jit(φ: float, λ: float) float#
Wrap a scalar phase into [0, λ[ (njit version).
- Parameters:
φ – Scalar phase to wrap.
λ – Scalar wavelength defining the interval.
- Returns:
Wrapped phase in [0, λ[ (implicit same unit as inputs).
- phise.modules.phase.perturb(
- φ: ndarray,
- rms: Quantity,
Add Gaussian noise to phases with standard deviation
rms.- Parameters:
φ – Array of phases as
Quantity(all with the same unit).rms – Noise standard deviation, same unit as
φ.
- Returns:
Quantityarray of the same shape asφwith noisy phases.