DifferentialTimeStepper

class photonforge.DifferentialTimeStepper(*, scheme='backwards', scale=1.0, output_port=None)[source]

Time stepper for differentiating electrical signals in time.

The “backwards” scheme, implements:

\[y_k = s \frac{x_k - x_{k-1}}{\Delta t}\]

whereas the “central” scheme uses:

\[y_k = s \frac{x_k - x_{k-2}}{2 \Delta t}\]
Parameters:
  • scheme (Literal['backwards', 'central']) – Differentiation scheme.

  • scale (Annotated[float, units='s']) – Output scaling factor \(s\).

  • output_port (str | None) – Name of the port used as output. If None, the last port is used (in the sorted list of ports).

Methods

reset()

Reset any internal state of the time stepper.

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

Initialize the time stepper.

setup_state(*, time_step, component, **kwargs)

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.

Attributes

parametric_function

Function used to update the time stepper.

parametric_kwargs

Keyword arguments used to update the time stepper.

properties

Object properties.

random_variables

Random variables associated to the time stepper's parameters.

reset()[source]

Reset any internal state of the time stepper.

The default implementation performs no action. This method can be overridden in derived classes to reset any internal state the time stepper may have.

setup_state(*, time_step, component, **kwargs)[source]

Initialize internal state.

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

  • component (Component) – Component representing the time stepper.

  • kwargs – Unused.

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