PortSpec
PortSpec( description, width, limits, num_modes=1, polarization=None, target_neff=None, path_profiles=(), added_solver_modes=0, voltage_path=None, current_path=None, default_radius=0, impedance=None,)Optical or electrical port specification.
This class is mainly used to create optical or electrical waveguide
templates for a Technology.
Args
- description (str): Description of the port specification.
- width (float): In-plane dimension of the port.
- limits (Sequence[float]): Out-of-plane bounds of the port.
- num_modes (int): Number of modes supported by this port.
- polarization (Literal[“TE”, “TM”, ""] | None): Mode polarization selection.
- target_neff (float | None): Target effective index for numerical mode solving. If
None, the square root of the largest real permittivity among the technology media withinlimitsat the mode solving frequencies is used. - path_profiles (Iterable[tuple[float, float, str | tuple[int, int]]] | dict[str, tuple[float, float, str | tuple[int, int]]]): Tuples with
(width, offset, layer)describing the path profiles that make up this port’s geometry. Each path profile tuple can be named by using a dictionary. - added_solver_modes (int): Additional modes to solve for in mode solver runs (useful when filtering modes by polarization). These are not included in S parameters computed for ports of this type.
- voltage_path (Sequence[Sequence[float] | complex] | None): Sequence of vertices that make up the integral path for voltage calculation in this port. If an empty sequence is used, the path will be set automatically, if possible.
- current_path (Sequence[Sequence[float] | complex] | Rectangle | Circle | Polygon | Path): Sequence of vertices that make up the integral path for current calculation in this port. A planar structure can be used to define the integral over its contour. If an empty sequence is used, the path will be set automatically, if possible.
- default_radius (float): Default radius used for bends created with this specification.
- impedance (complex | Interpolator | None): Complex impedance as a single or frequency-dependent interpolated value (in ohms). If set to
None, calculation is performed by mode-solving when needed.
Note
If all of voltage_path, current_path, and impedance are
None, the resulting specification will be classified as optical.
Otherwise, it will be an electrical port specification.
Important
Ports whose specifications differ only in target_neff connect
directly, so circuit simulations that mix them might give an incorrect
result. In such cases, it is advisable that the specifications also
differ in some other way to avoid connecting them directly.
Example
>>> port_spec = pf.PortSpec(... "Single mode strip",... 1.5,... (-0.5, 0.75),... path_profiles=[(0.45, 0, (1, 0)), (3, 0, (1, 2))],... )See Also
Methods
Section titled “Methods”| Method | Description |
|---|---|
combined_with | Create a port specification combining this with with a second one. |
copy | Create a copy of this port specification. |
get_paths | Return a list of paths generated by this specification. |
inverted | Return an inverted version of this port if it is asymmetric. |
path_profile_for | Return the path profile in this port specification for a specific layer. |
path_profiles_list | Return the path profiles in this port specification as a list. |
profile_matches | Test if the path profiles in this specification match another’s. |
symmetric | Return a flag indicating whether this port specification is symmetric. |
to_tidy3d | Create a Tidy3D ModeSolver from this port specification. |
to_tidy3d_impedance_calculator | Create a Tidy3D ImpedanceCalculator from this port specification. |
combined_with
Section titled “combined_with”combined_with(self, port_spec, offset=0)Create a port specification combining this with with a second one.
The combined port specification is a copy of this one with additional
path profiles from port_spec.
Args
- port_spec (PortSpec): Port specification with the path profiles to be added.
- offset (float): Added offset to the new path profiles.
Returns
PortSpec: Combined profile.
Note
The combined specification terminals do not have names.
copy(self)Create a copy of this port specification.
Returns
PortSpec: New copy.
get_paths
Section titled “get_paths”get_paths(self, origin, scale_width=True)Return a list of paths generated by this specification.
Args
- origin (Sequence[float] | complex): Origin of the generated paths.
- scale_width (bool): Flag passed to
Pathto indicate whether the width of the created paths should scale when the paths are scaled.
Returns
list[tuple[tuple[int, int], Path]]: List of layer and paths.
inverted
Section titled “inverted”inverted(self)Return an inverted version of this port if it is asymmetric.
Returns
PortSpec: Inverted specification (self, if symmetric).
path_profile_for
Section titled “path_profile_for”path_profile_for(self, layer, technology=None)Return the path profile in this port specification for a specific layer.
Args
- layer (str | tuple[int, int]): Layer for desired the profile.
- technology (Technology | None): Technology specification for this specification.
Returns
tuple[float, float] | tuple[list[float], list[float]]: Width(s) and offset(s) for the selected layer.
Note
If the port specification includes several path profiles for the selected layer, width and offset are returned as lists.
path_profiles_list
Section titled “path_profiles_list”path_profiles_list(self)Return the path profiles in this port specification as a list.
Returns
list[float, float, tuple[int, int]]: List of width, offset, and layer from this port specification’s path profiles.
profile_matches
Section titled “profile_matches”profile_matches(self, port_spec)Test if the path profiles in this specification match another’s.
Args
- port_spec (PortSpec): Port specification to test.
Returns
bool: Match flag.
symmetric
Section titled “symmetric”symmetric(self)Return a flag indicating whether this port specification is symmetric.
Returns
bool: Symmetry flag.
to_tidy3d
Section titled “to_tidy3d”to_tidy3d( self, frequencies, mesh_refinement=None, group_index=False, technology=None,)Create a Tidy3D ModeSolver from this port specification.
Args
- frequencies (Sequence[float]): Sequence of frequency values for the mode solver.
- mesh_refinement (float | None): Minimal number of mesh elements per wavelength used for mode solving.
- group_index (bool): Boolean indicating whether the mode solver should include group index computation.
- technology (Technology | None): Technology specification for this specification.
Returns
ModeSolver: Tidy3D mode solver.
to_tidy3d_impedance_calculator
Section titled “to_tidy3d_impedance_calculator”to_tidy3d_impedance_calculator( self, extrapolate_to_endpoints=True, snap_to_grid=True)Create a Tidy3D ImpedanceCalculator from this port specification.
The impedance calculator can be used with mode solver data from this port specificatin to calculate its impedance. Only electrical port specifications support this method.
Args
- extrapolate_to_endpoints (bool): Set to ignore fields outside the voltage integration path bounds.
- snap_to_grid (bool): Snap integral paths to the data grid.
Returns
ImpedanceCalculator: Tidy3D impedance calculator.
Attributes
Section titled “Attributes”| Attribute | Description |
|---|---|
added_solver_modes | int: Additional modes to include in mode solver runs for this port. |
classification | Literal[‘optical’, ‘electrical’]: Port spec classification: optical or electrical (read only). |
current_path | ndarray | None: Current integration path (for electrical port specifications only). |
default_radius | float: Default radius for bends. |
description | str: Port spec description. |
impedance | Interpolator | None: Impedance interpolator (for electrical port specifications only). |
limits | ndarray: Out-of-plane limits. |
num_modes | int: Number of modes supported by this port. |
path_profiles | Iterable[tuple[float, float, tuple[int, int]]] | dict[str, tuple[float, float, tuple[int, int]]]: Path profiles. |
polarization | Literal[‘TE’, ‘TM’, ”]: Mode polarization selection. |
properties | Properties: Object properties. |
target_neff | float | None: Target effective index for port modes (None for the default). |
voltage_path | ndarray | None: Voltage integration path (for electrical port specifications only). |
width | float: In-plane width. |
added_solver_modes
Section titled “added_solver_modes”int: Additional modes to include in mode solver runs for this port.
classification
Section titled “classification”Literal[‘optical’, ‘electrical’]: Port spec classification: optical or electrical (read only).
current_path
Section titled “current_path”ndarray | None: Current integration path (for electrical port specifications only).
default_radius
Section titled “default_radius”float: Default radius for bends.
description
Section titled “description”str: Port spec description.
impedance
Section titled “impedance”Interpolator | None: Impedance interpolator (for electrical port specifications only).
limits
Section titled “limits”ndarray: Out-of-plane limits.
num_modes
Section titled “num_modes”int: Number of modes supported by this port.
path_profiles
Section titled “path_profiles”Iterable[tuple[float, float, tuple[int, int]]] | dict[str, tuple[float, float, tuple[int, int]]]: Path profiles.
polarization
Section titled “polarization”Literal[‘TE’, ‘TM’, ”]: Mode polarization selection.
properties
Section titled “properties”Properties: Object properties.
target_neff
Section titled “target_neff”float | None: Target effective index for port modes (None for the default).
voltage_path
Section titled “voltage_path”ndarray | None: Voltage integration path (for electrical port specifications only).
float: In-plane width.