fdtdx.calculate_sparam#
- fdtdx.calculate_sparam(objects, arrays, config, input_port_name, show_progress=True, input_normalization_detector_name=None, key=None)[source]#
Run the FDTD simulation and extract S-parameters from mode-overlap detectors.
Intended to be called with the outputs of
setup_sparams_simulation(). EachModeOverlapDetectorin objects contributes one entry to the returned dictionary. Because a single simulation (with one active input port) measures the transmission to all output ports simultaneously, the dictionary keys are(detector_name, input_port_name)tuples so that results from multiple calls can be merged into a full S-matrix.To simulate all input ports in one call (multiple simulations), use
calculate_sparams().- Parameters:
objects (
ObjectContainer) – ObjectContainer fromsetup_sparams_simulation().arrays (
ArrayContainer) – ArrayContainer fromsetup_sparams_simulation().config (
SimulationConfig) – SimulationConfig fromsetup_sparams_simulation().input_port_name (
str) – Name of the active input port. Should match thenamefield of the correspondingPortSpec, or the auto-generated name"Source_<i>"when no name was supplied.show_progress (
bool) – Whether to display the simulation progress bar.input_normalization_detector_name (
str|None) – Name (or substring) of the detector used to normalise the input power. Defaults to a detector whose name contains input_port_name.key (
Array|None) – JAX random key. Defaults toPRNGKey(0).
- Return type:
tuple[dict[tuple[str,str],Array],dict[str,dict[str,Array]]]- Returns:
A 2-tuple
(sparams, detector_states)where sparams maps(detector_name, input_port_name)to a complex scattering-amplitude array indexed by frequency. For the single-frequency detectors created bysetup_sparams_simulation(), each value has shape(1,). detector_states is the finalDetectorStatedict for every detector in the simulation.