CWLaserTimeStepper¶
- class photonforge.CWLaserTimeStepper(*, power=1, rel_intensity_noise=0, linewidth=0, frequency=None, phase=0, reflection=0, seed=None)[source]¶
Time-stepper for a continuous-wave (CW) laser source.
This model generates a complex optical field with a constant average power. It can optionally include phase noise, modeled as a Lorentzian line width, and relative intensity noise (RIN) from a white noise process. The output field has the form:
\[A[k] = \sqrt{P[k]} e^{j\phi[k]}\]The phase noise is modeled as a discrete-time Wiener process. The phase increment at each step is a Gaussian random variable with variance determined by the linewidth Δν as:
\[\text{Var}[\Delta\phi] = 2\pi \Delta\nu \Delta t\]RIN is modeled as an additive white noise process on the optical power. The variance of the power fluctuations is derived from the RIN PSD, band-limited by the simulation’s Nyquist frequency, and clamped at zero:
\[\text{Var}[P] \approx \text{RIN} \frac{P_0^2}{2\Delta t}\]- Parameters:
power (Annotated[float, minimum=0, units='W']) – Mean optical output power.
rel_intensity_noise (Annotated[float, minimum=0, units='1/Hz']) – One-sided relative intensity noise (RIN) power spectral density.
linewidth (Annotated[float, minimum=0, units='Hz']) – Full-width at half-maximum (FWHM) of the laser’s Lorentzian shape.
frequency (Annotated[float, minimum=0, units='Hz'] | None) – Absolute laser frequency. If
None, equals the carrier frequency. If detuned from the carrier by Δf, the output envelope rotates at 2πΔf.phase (Annotated[float, units='°']) – Starting phase of the output envelope.
reflection (complex) – Reflection coefficient for incident fields.
seed (Annotated[int, minimum=0] | None) – Random number generator seed to ensure reproducibility.
Methods
reset()Reset internal state.
setup(component, time_step, *[, ...])Initialize the time stepper.
setup_state(*, component, time_step, ...)Initialize internal state.
step([inputs, steps, time_step, show_progress])Compute the outputs of this time stepper, given inputs.
step_single(inputs, time_index, ...)Take a single time step on the given inputs.
update(*args, **kwargs)Update this time stepper.
Attributes
parametric_functionFunction used to update a parametric component.
parametric_kwargsKeyword arguments used to update a parametric component.
propertiesObject properties.
random_variablesRandom variables associated to this modles's parameters.
- setup_state(*, component, time_step, carrier_frequency, **kwargs)[source]¶
Initialize internal state.
- Parameters:
component (Component) – Component representing the laser source.
time_step (Annotated[float, minimum=0, units='s']) – The interval between time steps (in seconds).
carrier_frequency (Annotated[float, minimum=0, units='Hz']) – The carrier frequency used to construct the time stepper. The carrier should be omitted from the input signals, as it is handled automatically by the time stepper.
kwargs – Unused.
- step_single(inputs, time_index, update_state, shutdown)[source]¶
Take a single time step on the given inputs.
- Parameters:
inputs (dict[str, complex]) – Dictionary containing inputs at the current time step, mapping port names to complex values.
time_index (int) – Time series index for the current input.
update_state (bool) – Whether to update the internal stepper state.
shutdown (bool) – Whether this is the last call to the single stepping function for the provided
TimeSeries.
- Returns:
Outputs at the current time step.
- Return type:
dict[str, complex]