CWLaserTimeStepper¶
- class photonforge.CWLaserTimeStepper(*, power=1, rel_intensity_noise=0, linewidth=0, frequency=None, chirp_bandwidth=0, chirp_period=0, chirp_waveform='sawtooth', 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}\]A linear frequency chirp can be added on top, sweeping the instantaneous frequency over a band \(B\) centered on
frequency, with period \(T\):\[f[k] = f_0 + B d(k \Delta t / T)\]in which \(d\) ramps from -1/2 to 1/2 over each period (sawtooth), or over each half period and back (triangle).
- 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.chirp_bandwidth (Annotated[float, minimum=0, units='Hz']) – Total frequency excursion of a linear sweep, centered on
frequency. Zero disables the chirp.chirp_period (Annotated[float, minimum=0, units='s']) – Duration of one complete sweep.
chirp_waveform (Literal['sawtooth', 'triangle']) – Sweep shape. A sawtooth ramps up over the period and resets; a triangle ramps up over the first half of the period and back down over the second.
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, outputs, time_index, ...)Take a single time step on the given inputs.
update(*args, **kwargs)Update this time stepper.
write_verilog_a(path, *[, backend, ...])Write this configured time stepper as one Verilog-A module.
Attributes
parametric_functionFunction used to update the time stepper.
parametric_kwargsKeyword arguments used to update the time stepper.
propertiesObject properties.
random_variablesRandom variables associated to the time stepper'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 (object) – Unused.
- Return type:
None
- step_single(inputs, outputs, time_index, update_state, shutdown)[source]¶
Take a single time step on the given inputs.
- Parameters:
inputs (ndarray) – Input values at the current time step. Must be a 1D array of complex values ordered according to
keys.outputs (ndarray) – Pre-allocated output array where results will be stored. Same size and type as
inputs.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.
- Return type:
None