tidy3d.plugins.smatrix.AbstractComponentModeler#
- class AbstractComponentModeler[source]#
Bases:
ABC,Tidy3dBaseModelTool for modeling devices and computing port parameters.
- 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,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().name (str =) – simulation : Simulation Simulation describing the device without any sources present.
ports (Tuple[Union[Port, LumpedPort, CoaxialLumpedPort, WavePort], ...] = ()) – 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 toFalseresults in an unmodified Gaussian pulse spectrum which can have a nonzero DC component.run_only (Optional[Tuple[Union[tuple[str, pydantic.v1.types.NonNegativeInt], str], ...]] = None) – Set of matrix indices that define the simulations to run. If
None, simulations will be run for all indices in the scattering matrix. If a tuple is given, simulations will be run only for the given matrix indices.element_mappings (Tuple[tuple[Union[tuple[tuple[str, pydantic.v1.types.NonNegativeInt], tuple[str, pydantic.v1.types.NonNegativeInt]], tuple[str, str]], Union[tuple[tuple[str, pydantic.v1.types.NonNegativeInt], tuple[str, pydantic.v1.types.NonNegativeInt]], tuple[str, str]], Union[tidy3d.components.types.base.tidycomplex, tidy3d.components.types.base.ComplexNumber]], ...] = ()) – Tuple of S matrix element mappings, each described by a tuple of (input_element, output_element, coefficient), where the coefficient is the element_mapping coefficient describing the relationship between the input and output matrix element. 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.custom_source_time (Union[GaussianPulse, ContinuousWave, CustomSourceTime, NoneType] = None) – If provided, this will be used as specification of the source time-dependence in simulations. Otherwise, a default source time will be constructed.
Attributes
Abstract property for all matrix indices that will be used to collect data.
Tuple of all the matrix indices that will be used to run simulations.
Tuple of all the source matrix indices, which may be less than the total number of ports.
portsMethods
get_port_by_name(port_name)Get the port from the name.
get_task_name(port[, mode_index, format])Generates a standardized task name from a port object.
run([path_dir, folder_name, callback_url, ...])unique_port_names(val, values)make sure each element of val has a unique name (if specified).
Inherited Common Usage
- name#
- simulation#
- ports#
- freqs#
- remove_dc_component#
- run_only#
- element_mappings#
- custom_source_time#
- static get_task_name(port, mode_index=None, format='RF')[source]#
Generates a standardized task name from a port object.
This method creates a unique string identifier for a simulation task based on a port. The naming convention can be controlled by specifying a mode index directly, which takes precedence, or by selecting a predefined format.
- Parameters:
port (Port) – The port object from which to derive the base name.
mode_index (Optional[int], optional) – If provided, this index is appended to the port name (e.g., ‘port_1@1’), overriding the format argument. Defaults to None.
format (TaskNameFormat, optional) – Specifies the naming convention to use when mode_index is not provided. - “RF”: Returns the plain port name (e.g., “port_1”). - “PF”: Appends a zero index to the name (e.g., “port_1@0”). Defaults to “RF”.
- Returns:
The formatted task name string.
- Return type:
str
- Raises:
ValueError – If an invalid format string is provided.
- abstract property matrix_indices_monitor#
Abstract property for all matrix indices that will be used to collect data.
- property matrix_indices_source#
Tuple of all the source matrix indices, which may be less than the total number of ports.
- property matrix_indices_run_sim#
Tuple of all the matrix indices that will be used to run simulations.
- classmethod unique_port_names(val, values)#
make sure each element of val has a unique name (if specified).
- run(path_dir='.', *, folder_name='default', callback_url=None, verbose=True, solver_version=None, pay_type='AUTO', priority=None, local_gradient=False, max_num_adjoint_per_fwd=10)[source]#
- __hash__()#
Hash method.