tidy3d.plugins.smatrix.ComponentModeler#
- class ComponentModeler[source]#
Bases:
Tidy3dBaseModelTool for modeling devices and computing scattering matrix elements.
- Parameters:
simulation (Attribute:
simulation) –TypeSimulation
DefaultDescriptionSimulation describing the device without any sources present.
ports (Attribute:
ports) –TypeTuple[Port, …]
Default= ()
DescriptionCollection of ports describing the scattering matrix elements. For each input mode, one simulation will be run with a modal source.
freqs (Attribute:
freqs) –TypeUnion[Tuple[float, …], ArrayLike[dtype=float, ndim=1]]
DefaultUnitsHz
DescriptionArray or list of frequencies at which to evaluate the scattering matrix.
folder_name (Attribute:
folder_name) –Typestr
Default= default
DescriptionName of the folder for the tasks on web.
element_mappings (Attribute:
element_mappings) –TypeTuple[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]], …]
Default= ()
DescriptionMapping 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 ofelement_mappingsis a tuple of(element1, element2, c), where the scattering matrixSmatrix[element2]is set equal toc * Smatrix[element1].If all elements of a given column of the scattering matrix are defined byelement_mappings, the simulation corresponding to this column is skipped automatically.run_only (Attribute:
run_only) –TypeOptional[Tuple[Tuple[str, pydantic.v1.types.NonNegativeInt], …]]
Default= None
DescriptionIf 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 (Attribute:
verbose) –Typebool
Default= False
DescriptionWhether the
ComponentModelershould print status and progressbars.callback_url (Attribute:
callback_url) –TypeOptional[str]
Default= None
DescriptionHttp PUT url to receive simulation finish event. The body content is a json file with fields
{'id', 'status', 'name', 'workUnit', 'solverVersion'}.path_dir (Attribute:
path_dir) –Typestr
Default= .
DescriptionBase directory where data and batch will be downloaded.
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 BatchData object.
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 theComponentModeler.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.