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
input/output array keys (read only).
Underlying pole-residue matrix (read only).
Object properties.
Time step.
- copy()¶
Create a copy of this time-domain model.
- Returns:
New copy.
- Return type:
- keys¶
input/output array keys (read only).
- Type:
tuple[str]
- pole_residue_matrix¶
Underlying pole-residue matrix (read only).
- Type:
- properties¶
Object properties.
- Type:
- reset()¶
Reset the internal model state.
- Returns:
This object.
- Return type:
- 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
stepconcurrently from multiple threads on the sameTimeDomainModelinstance. For parallel simulations, create separate model instances (e.g., viacopy()) for each thread.- Parameters:
inputs (TimeSeries | None) – Inputs to the time domain model. If
None, uses zero inputs forstepstime steps.steps (int) – The number of time steps to execute. Only used if
inputsisNone.time_step (float) – The interval between time steps (in seconds). Only used if
inputsisNone. Must match the model’stime_stepattribute.show_progress (bool) – If
True, show computation progress.
- Returns:
Computed outputs.
- Return type:
- 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
TimeDomainModelinstance, even withupdate_state=False. For parallel simulations, create a separate model instance (e.g., viacopy()) 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
outputsarray.
- time_step¶
Time step.
- Type:
float