tidy3d.plugins.smatrix.ComponentModeler#
- class ComponentModeler[source]#
Bases:
AbstractComponentModeler
Tool for modeling devices and computing scattering matrix elements.
- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrs
are mutable. For example, the following is allowed for setting anattr
obj.attrs['foo'] = bar
. Also note that Tidy3D` will raise aTypeError
ifattrs
contain objects that can not be serialized. One can check ifattrs
are serializable by callingobj.json()
.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 compute port parameters.
remove_dc_component (bool = True) – Whether to remove the DC component in the Gaussian pulse spectrum. If
True
, the Gaussian pulse is modified at low frequencies to zero out the DC component, which is usually desirable so that the fields will decay. However, for broadband simulations, it may be better to have non-vanishing source power near zero frequency. Setting this toFalse
results in an unmodified Gaussian pulse spectrum which can have a nonzero DC component.folder_name (str = default) – Name of the folder for the tasks on web.
verbose (bool = False) – Whether the
ComponentModeler
should 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.
solver_version (Optional[str] = None) – batch_cached : Optional[Batch] = None Optional field to specify
batch
. Only used as a workaround internally so thatbatch
is written when.to_file()
and then the proper batch is loaded from.from_file()
. We recommend leaving unset as setting this field along with fields that were not used to create the task will cause errors.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 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 (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.example (.. TODO missing basic)
See also
Attributes
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.ports
Methods
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.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.
Inherited Common Usage
- ports#
- 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#
- 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.
- property port_names#
List of port names for inputs and outputs, respectively.
- plot_sim(x=None, y=None, z=None, ax=None)[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 max_mode_index#
maximum mode indices for the smatrix dataset for the in and out ports, respectively.
- __hash__()#
Hash method.