TimeDomainModel

class photonforge.TimeDomainModel(pole_residue_matrix, time_step)

Time-domain model based on a pole-residue representation of an S matrix.

Parameters:
  • pole_residue_matrix (PoleResidueMatrix) – Underlying pole-residue matrix.

  • time_step (float) – Time step to be used for this model.

Example

>>> pole_res = pf.PoleResidueMatrix(
...     poles=[-pf.C_0 / 1.0],
...     residues={("P0", "P0"): [2.0 * pf.C_0, 0.0]},
... )
>>> time_domain = pf.TimeDomainModel(pole_res, time_step=0.001)

Note

Time-domain models cannot be added to components at the moment. Component models are only those used to compute frequency-domain S parameters.

Methods

copy()

Create a copy of this time-domain model.

reset()

Reset the internal model state.

step([inputs, steps, time_step, show_progress])

Compute the outputs for multiple time steps.

step_single(inputs, outputs[, time_index, ...])

Compute the output for a single time step using array-based API.

Attributes

keys

input/output array keys (read only).

pole_residue_matrix

Underlying pole-residue matrix (read only).

properties

Object properties.

time_step

Time step.

copy()

Create a copy of this time-domain model.

Returns:

New copy.

Return type:

TimeDomainModel

keys

input/output array keys (read only).

Type:

tuple[str]

pole_residue_matrix

Underlying pole-residue matrix (read only).

Type:

PoleResidueMatrix

properties

Object properties.

Type:

Properties

reset()

Reset the internal model state.

Returns:

This object.

Return type:

TimeDomainModel

step(inputs=None, steps=0, time_step=0, show_progress=True)

Compute the outputs for multiple time steps.

Note

This method is not thread-safe. Do not call step concurrently from multiple threads on the same TimeDomainModel instance. For parallel simulations, create separate model instances (e.g., via copy()) for each thread.

Parameters:
  • inputs (TimeSeries | None) – Inputs to the time domain model. If None, uses zero inputs for steps time steps.

  • steps (int) – The number of time steps to execute. Only used if inputs is None.

  • time_step (float) – The interval between time steps (in seconds). Only used if inputs is None. Must match the model’s time_step attribute.

  • show_progress (bool) – If True, show computation progress.

Returns:

Computed outputs.

Return type:

TimeSeries

step_single(inputs, outputs, time_index=0, update_state=True, shutdown=False)

Compute the output for a single time step using array-based API.

Note

This method is not thread-safe. Do not call it concurrently from multiple threads on the same TimeDomainModel instance, even with update_state=False. For parallel simulations, create a separate model instance (e.g., via copy()) for each thread.

Parameters:
  • inputs (ndarray) – Input values at the current time step. Must be a contiguous 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. Not used.

  • update_state (bool) – Whether to update the internal model state.

  • shutdown (bool) – Whether this is the last call. Not used.

Returns:

None. Results are written in-place to the outputs array.

time_step

Time step.

Type:

float