CircuitTimeStepper

class photonforge.CircuitTimeStepper(mesh_refinement=None, max_iterations=100, abs_tolerance=1e-8, rel_tolerance=1e-5, max_threads=8, verbose=True)[source]

Circuit-level time stepper.

Constructs time steppers for individual circuit elements and handles connections between them. Each time stepper initialization is preceded by an update to the componoent’s technology, the component itself, and its active model by calling Reference.update. They are reset to their original state afterwards.

If a reference includes repetitions, it is flattened so that each instance is called separatelly.

Parameters:
  • mesh_refinement (Annotated[float, exclusiveMinimum=0] | None) – Minimum number of mesh elements per wavelength used for mode solving.

  • max_iterations (Annotated[int, exclusiveMinimum=0]) – Maximum number of iterations for self-consistent signal propagation through the circuit. A larger value may be needed for larger circuits or high-Q feedback loops.

  • abs_tolerance (Annotated[float, exclusiveMinimum=0]) – The absolute tolerance for the convergence check.

  • rel_tolerance (Annotated[float, exclusiveMinimum=0]) – The relative tolerance for the convergence check.

  • max_threads (Annotated[int, exclusiveMinimum=0]) – Maximum number of threads used for stepping individual subcomponents.

  • verbose (bool) – Flag setting the verbosity of mode solver runs.

Methods

reset()

Reset the state of the circuit variables.

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

Initialize the time stepper.

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

Initialize internal circuit variables.

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_function

Function used to update a parametric component.

parametric_kwargs

Keyword arguments used to update a parametric component.

properties

Object properties.

random_variables

Random variables associated to this modles's parameters.

status

reset()[source]

Reset the state of the circuit variables.

setup_state(*, component, time_step, carrier_frequency, monitors={}, updates={}, chain_technology_updates=True, verbose=None, **kwargs)[source]

Initialize internal circuit variables.

Parameters:
  • component (Component) – Component for the time stepper.

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

  • carrier_frequency (float) – 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.

  • monitors (dict[str, Port | FiberPort | GaussianPort]) – Additional ports to include in the outputs as a dictionary with monitor names as keys. Subcomponent ports can be obtained with Reference.get_ports() for the 1st level of references or with Component.query() for more deeply-nested ports.

  • updates (dict[Sequence[str | int | None], dict[str, dict[str, Any]]]) – Dictionary of parameter updates to be applied to components, technologies, and models for references within the main component. See CircuitModel.start() for examples.

  • chain_technology_updates (bool) – if set, a technology update will trigger an update for all components using that technology.

  • verbose (bool | None) – If set, overrides the model’s verbose attribute and is passed to reference models.

  • kwargs – Keyword arguments passed to reference models.

Returns:

Object with a status dictionary.

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]