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 of element_mappings is 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 (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.

Attributes

batch

Batch associated with this component modeler.

batch_path

Path to the batch saved to file.

matrix_indices_monitor

Tuple of all the possible matrix indices (port, mode_index) in the Component Modeler.

matrix_indices_run_sim

Tuple of all the source matrix indices (port, mode_index) in the Component Modeler.

matrix_indices_source

Tuple of all the source matrix indices (port, mode_index) in the Component Modeler.

max_mode_index

maximum mode indices for the smatrix dataset for the in and out ports, respectively.

port_names

List of port names for inputs and outputs, respectively.

sim_dict

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 the ComponentModeler. 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.

get_port_by_name(port_name)[source]#

Get the port from the name.

to_monitor(port)[source]#

Creates a mode monitor from a given port.

to_source(port, mode_index)[source]#

Creates a list of mode sources from a given port.

shift_port(port)[source]#

Generate a new port shifted by the shift amount in normal direction.

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.

run(path_dir='.')[source]#

Solves for the scattering matrix of the system.

__hash__()#

Hash method.

load(path_dir='.')[source]#

Load a scattering matrix from saved BatchData object.