DelayedTimeStepper

class photonforge.DelayedTimeStepper(time_stepper, input_delay=0, output_delay=0)[source]

Time stepper that adds time delays to other time steppers.

Delays are quantized down to whole time steps. Delays shorter than one time step therefore have no effect. A delay within rounding (relative 1e-9) of a whole number of time steps counts as that number.

Parameters:
  • time_stepper (TimeStepper) – The time stepper to wrap with delays.

  • input_delay (Annotated[float, minimum=0, units='s']) – Default delay applied to the inputs.

  • output_delay (Annotated[float, minimum=0, units='s']) – Default delay applied to the outputs.

Methods

bind_native(step, keys[, state, cstate, context])

Bind a compiled step function.

reset()

Reset any internal state of the time stepper.

setup(component, time_step, *[, ...])

Initialize the time stepper.

setup_state(*, time_step[, input_delays, ...])

Initialize internal buffers and set port-specific delays.

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

input_delay_steps

this wrapper's delays plus the wrapped stepper's own.

keys

Tuple of input/output keys.

output_delay_steps

this wrapper's delays plus the wrapped stepper's own.

parametric_function

Function used to update the time stepper.

parametric_kwargs

Keyword arguments used to update the time stepper.

path_delays

Minimum delay in time steps of each path through the wrapped stepper and its lines.

properties

Object properties.

random_variables

Random variables associated to the time stepper's parameters.

property input_delay_steps: dict[str, int]

this wrapper’s delays plus the wrapped stepper’s own.

Type:

Input lines in time steps

property keys: tuple[str, ...]

Tuple of input/output keys.

property output_delay_steps: dict[str, int]

this wrapper’s delays plus the wrapped stepper’s own.

Type:

Output lines in time steps

property path_delays: dict[tuple[str, str], int]

Minimum delay in time steps of each path through the wrapped stepper and its lines.

reset()[source]

Reset any internal state of the time stepper.

The default implementation restores the arrays given to bind_native(), if any, and performs no other action. Derived classes override it to reset the state they hold themselves.

Return type:

None

setup_state(*, time_step, input_delays={}, output_delays={}, **kwargs)[source]

Initialize internal buffers and set port-specific delays.

Parameters:
  • time_step (float) – The interval between time steps (in seconds).

  • input_delays (dict[str, Annotated[float, minimum=0, units='s']]) – Mapping of port names to delays (in seconds) to override the default input delay.

  • output_delays (dict[str, Annotated[float, minimum=0, units='s']]) – Mapping of port names to delays (in seconds) to override the default output delay.

  • kwargs (object) – Unused.

Return type:

object

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 original TimeSeries.

Return type:

None