tidy3d.plugins.smatrix.ComponentModeler#
- class ComponentModeler[source]#
Bases:
Tidy3dBaseModel
Tool for modeling devices and computing scattering matrix elements.
- Parameters:
simulation (Attribute:
simulation
) –Type
Simulation
Default
Description
Simulation describing the device without any sources present.
ports (Attribute:
ports
) –Type
Tuple[Port, …]
Default
= ()
Description
Collection of ports describing the scattering matrix elements. For each input mode, one simulation will be run with a modal source.
freqs (Attribute:
freqs
) –Type
Union[Tuple[float, …], ArrayLike[dtype=float, ndim=1]]
Default
Units
Hz
Description
Array or list of frequencies at which to evaluate the scattering matrix.
folder_name (Attribute:
folder_name
) –Type
str
Default
= default
Description
Name of the folder for the tasks on web.
element_mappings (Attribute:
element_mappings
) –Type
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]], …]
Default
= ()
Description
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 ofelement_mappings
is 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
) –Type
Optional[Tuple[Tuple[str, pydantic.v1.types.NonNegativeInt], …]]
Default
= None
Description
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 (Attribute:
verbose
) –Type
bool
Default
= False
Description
Whether the
ComponentModeler
should print status and progressbars.callback_url (Attribute:
callback_url
) –Type
Optional[str]
Default
= None
Description
Http 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
) –Type
str
Default
= .
Description
Base 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
Simulation
objects 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
Simulation
with all sources added for each port, for troubleshooting.plot_sim_eps
([x, y, z, ax])Plot permittivity of the
Simulation
with 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_only
parameter to theComponentModeler
.run_only
contains 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
Simulation
objects 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
Simulation
with 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
Simulation
with 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.