FilterTimeStepper

class photonforge.FilterTimeStepper(*, family, shape='lp', f_cutoff=0, order=1, ripple=0, window='hann', a=(1.0,), b=(), taps=101, insertion_loss=0, ports=None, z0=None, mesh_refinement=None, verbose=True)[source]

Filter time stepper for electrical signals

Parameters:
  • family (Literal['tunable_lp_rc', 'digital', 'rc', 'butterworth', 'bessel', 'cheby1', 'rectangular', 'gaussian']) – Filter family.

  • shape (Literal['lp', 'hp', 'bp', 'bs']) – Filter shape.

  • f_cutoff (Annotated[float, minimum=0, units='Hz'] | Annotated[Sequence[Annotated[float, minimum=0, units='Hz']], maxItems=2, minItems=2] | Interpolator) – Cutoff frequency for low- and high-pass filter shapes. For family=="tunable_lp_rc", this can be an Interpolator to provide the dependency with the input voltage. For band-pass and band-stop shapes, this is a 2-value sequence with low and high cutoff frequencies.

  • order (Annotated[int, exclusiveMinimum=0]) – Filter order.

  • ripple (Annotated[float, minimum=0, units='dB']) – Maximum ripple for Chebyshev filters.

  • window (str | tuple[str, float] | tuple[str, float, float] | tuple[str, Sequence[float]]) – Window specification for rectangular filters. Please consult the help for scipy.signal.firwin for valid options.

  • a (Sequence[complex]) – Recursive (denominator) coefficients for a digital IIR filter.

  • b (Sequence[complex]) – Direct (numerator) coefficients for a digital FIR or IIR filter.

  • taps (Annotated[int, exclusiveMinimum=0]) – Length of rectangular or Gaussian filters.

  • insertion_loss (Annotated[float, minimum=0, units='dB']) – Insertion loss added to the filter response.

  • ports (Annotated[Sequence[str], maxItems=2, minItems=2] | None) – Input and output port names. If not set, the sorted list of port names from the component is used.

  • z0 (Annotated[complex, units='Ω'] | Interpolator | None) – Characteristic impedance of the electrical port used to convert the input control field amplitude to voltage for the "tunable_lp_rc" family. If None, derived from port impedance, calculated by mode-solving, or set to 50 Ω.

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

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

Note

Filtering is applied to input signals from the first port (sorted alphabetically) and output on the second port. For the "tunable_lp_rc", the third port contains the control signal.

Methods

reset()

Reset internal state.

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

Initialize the time stepper.

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

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.

status

reset()[source]

Reset internal state.

setup_state(*, component, time_step, verbose=None, **kwargs)[source]

Initialize internal state.

Parameters:
  • component (Component) – Component representing the filter.

  • time_step (Annotated[float, minimum=0, units='s']) – The interval between time steps (in seconds).

  • kwargs – Unused.

  • verbose (bool | None)

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