fdtdx.calculate_sparams

fdtdx.calculate_sparams#

fdtdx.calculate_sparams(objects, arrays, config, input_port_names, show_progress=True, input_normalization_detector_name=None, key=None, return_detector_states=False)[source]#

Run FDTD simulations for multiple input ports and merge S-parameters.

Calls calculate_sparam() once per entry in input_port_names and merges all results into a single S-parameter dictionary.

Parameters:
  • objects (ObjectContainer) – ObjectContainer from setup_sparams_simulation().

  • arrays (ArrayContainer) – ArrayContainer from setup_sparams_simulation().

  • config (SimulationConfig) – SimulationConfig from setup_sparams_simulation().

  • input_port_names (Sequence[str]) – Names of the input ports to simulate.

  • show_progress (bool) – Whether to display the simulation progress bar.

  • input_normalization_detector_name (str | None) – Passed through to calculate_sparam().

  • key (Array | None) – JAX random key. Defaults to PRNGKey(0).

  • return_detector_states (bool) – When True, return the detector states from each simulation run as a list (one entry per input port). When False an empty list is returned.

Return type:

tuple[dict[tuple[str, str], Array], list[dict[str, dict[str, Array]]]]

Returns:

A 2-tuple (sparams, detector_states_list) where sparams is the merged dict[tuple[str, str], jax.Array] across all simulations and detector_states_list is either a list of per-simulation detector state dicts or an empty list.