tidy3d.plugins.smatrix.ComponentModeler#
- class ComponentModeler[source]#
- Bases: - Tidy3dBaseModel- Tool for modeling devices and computing scattering matrix elements. - Parameters:
- simulation (Simulation) – Simulation describing the device without any sources present. 
- ports (Tuple[Port, ...] = ()) – Collection of ports describing the scattering matrix elements. For each input mode, one simulation will be run with a modal source. 
- freqs (Union[Tuple[float, ...], ArrayLike[dtype=float, ndim=1]]) – [units = Hz]. Array or list of frequencies at which to evaluate the scattering matrix. 
- folder_name (str = default) – Name of the folder for the tasks on web. 
- element_mappings (Tuple[Tuple[Tuple[Tuple[str, pydantic.v1.types.NonNegativeInt], Tuple[str, pydantic.v1.types.NonNegativeInt]], Tuple[Tuple[str, pydantic.v1.types.NonNegativeInt], Tuple[str, pydantic.v1.types.NonNegativeInt]], Union[tidy3d.components.types.tidycomplex, tidy3d.components.types.ComplexNumber]], ...] = ()) – Mapping between elements of the scattering matrix, as specified by pairs of - (port name, mode index)matrix indices, where the first element of the pair is the output and the second element of the pair is the input.Each item of- element_mappingsis a tuple of- (element1, element2, c), where the scattering matrix- Smatrix[element2]is set equal to- c * Smatrix[element1].If all elements of a given column of the scattering matrix are defined by- element_mappings, the simulation corresponding to this column is skipped automatically.
- run_only (Optional[Tuple[Tuple[str, pydantic.v1.types.NonNegativeInt], ...]] = None) – If given, a tuple of matrix indices, specified by ( - Port,- int), to run only, excluding the other rows from the scattering matrix. If this option is used, the data corresponding to other inputs will be missing in the resulting matrix.
- verbose (bool = False) – Whether the - ComponentModelershould print status and progressbars.
- callback_url (Optional[str] = None) – Http PUT url to receive simulation finish event. The body content is a json file with fields - {'id', 'status', 'name', 'workUnit', 'solverVersion'}.
- path_dir (str = .) – Base directory where data and batch will be downloaded. 
- example (.. TODO missing basic) – 
 
 - See also - Attributes - Batch associated with this component modeler. - Path to the batch saved to file. - Tuple of all the possible matrix indices (port, mode_index) in the Component Modeler. - Tuple of all the source matrix indices (port, mode_index) in the Component Modeler. - Tuple of all the source matrix indices (port, mode_index) in the Component Modeler. - maximum mode indices for the smatrix dataset for the in and out ports, respectively. - List of port names for inputs and outputs, respectively. - Generate all the - Simulationobjects for the S matrix calculation.- Methods - get_path_dir(path_dir)- Check whether the supplied 'path_dir' matches the internal field value. - get_port_by_name(port_name)- Get the port from the name. - load([path_dir])- Load a scattering matrix from saved - BatchDataobject.- plot_sim([x, y, z, ax])- Plot a - Simulationwith all sources added for each port, for troubleshooting.- plot_sim_eps([x, y, z, ax])- Plot permittivity of the - Simulationwith all sources added for each port.- run([path_dir])- Solves for the scattering matrix of the system. - shift_port(port)- Generate a new port shifted by the shift amount in normal direction. - to_monitor(port)- Creates a mode monitor from a given port. - to_source(port, mode_index)- Creates a list of mode sources from a given port. - simulation#
 - ports#
 - freqs#
 - folder_name#
 - element_mappings#
 - run_only#
- Finally, to exclude some rows of the scattering matrix, one can supply a - run_onlyparameter to the- ComponentModeler.- run_onlycontains the scattering matrix indices that the user wants to run as a source. If any indices are excluded, they will not be run.
 - verbose#
 - callback_url#
 - path_dir#
 - property sim_dict#
- Generate all the - Simulationobjects for the S matrix calculation.
 - property matrix_indices_monitor#
- Tuple of all the possible matrix indices (port, mode_index) in the Component Modeler. 
 - property matrix_indices_source#
- Tuple of all the source matrix indices (port, mode_index) in the Component Modeler. 
 - property matrix_indices_run_sim#
- Tuple of all the source matrix indices (port, mode_index) in the Component Modeler. 
 - plot_sim(x=None, y=None, z=None, ax=None, **kwargs)[source]#
- Plot a - Simulationwith all sources added for each port, for troubleshooting.
 - plot_sim_eps(x=None, y=None, z=None, ax=None, **kwargs)[source]#
- Plot permittivity of the - Simulationwith all sources added for each port.
 - property batch#
- Batch associated with this component modeler. 
 - property batch_path#
- Path to the batch saved to file. 
 - get_path_dir(path_dir)[source]#
- Check whether the supplied ‘path_dir’ matches the internal field value. 
 - property max_mode_index#
- maximum mode indices for the smatrix dataset for the in and out ports, respectively. 
 - property port_names#
- List of port names for inputs and outputs, respectively. 
 - __hash__()#
- Hash method.