Port
Port( center, input_direction, spec, extended=True, inverted=False, bend_radius=0,)2D port.
Args
- center (Sequence[float] | complex): Port position.
- input_direction (float): Angular direction (in degrees) of power entering the component through this port.
- spec (str | PortSpec): Port specification. A port specification name from the current
config.default_technologycan be used. - extended (bool): Indicates if the port should be extended during component extrusion. This is mainly used to extend input/output waveguides into the PML region of numerical simulation models. Internal ports (ports not touching the component boundaries) should set this parameter to
False. - inverted (bool): Flag to indicate if this port uses its specification with inverted offsets, which happens for reflected references, for example. This flag is only meaningful if the specification is asymmetric.
- bend_radius (float): Used to specify modes on curved waveguides. Positive (negative) values indicate a left (right) turn when following the input direction of the port.
Important
Port centers are snapped to the grid (in the input axis) and half the grid otherwise.
See Also
Methods
Section titled “Methods”| Method | Description |
|---|---|
can_connect_to | Check if this port can connect to another one. |
copy | Create a copy of this port. |
is_connected_to | Check if this port is connected to another one. |
matches | Check if this port matches another one. |
terminals | Get named terminals from this port. |
to_tidy3d_impedance_calculator | Create a Tidy3D ImpedanceCalculator from this port. |
to_tidy3d_mode_solver | Create a Tidy3D ModeSolver from this port. |
to_tidy3d_monitor | Create a Tidy3D ModeMonitor from this port. |
to_tidy3d_source | Create a Tidy3D ModeSource from this port. |
can_connect_to
Section titled “can_connect_to”can_connect_to(self, port)Check if this port can connect to another one.
Two ports can connect when their path profiles match. Special care is taken when their specifications are asymmetric to make sure any required inversion is in place.
Args
- port (Port): Port against which to check.
Returns
bool: Boolean indicating if the ports can connect.
copy(self, deep=False)Create a copy of this port.
Args
- deep (bool): If set, creates a deep copy.
Returns
Port: New copy.
is_connected_to
Section titled “is_connected_to”is_connected_to(self, port)Check if this port is connected to another one.
Two ports are connected when they are placed in the same location, have opposite input directions and compatible specifications. If the specification is asymmetric, one of the ports must be inverted.
Args
- port (Port): Port against which to check.
Returns
bool: Boolean indicating if the ports are connected.
matches
Section titled “matches”matches(self, port)Check if this port matches another one.
Two ports match when they are equal. If their specification is symmetric, inverted ports also match, even though they are not equal.
Args
- port (Port): Port against which to check.
Returns
bool: Boolean indicating if the ports match.
terminals
Section titled “terminals”terminals(self, name=None)Get named terminals from this port.
Args
- name (str | None): If given, get only the terminal with this name.
Returns
Terminal | dict[str, Terminal]: Single terminal with the specified name, or a dictionary of terminals.
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.
The impedance calculator can be used with mode solver data from this port to calculate its impedance. Only electrical ports 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.
to_tidy3d_mode_solver
Section titled “to_tidy3d_mode_solver”to_tidy3d_mode_solver( self, frequencies, mesh_refinement=None, group_index=False, technology=None, use_angle_rotation=False,)Create a Tidy3D ModeSolver from this port.
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 used to extrude this port.
- use_angle_rotation (bool): Enable the use of
angle_rotationin theModeSpecused by the mode solver.
Returns
ModeSolver: Tidy3D mode solver.
to_tidy3d_monitor
Section titled “to_tidy3d_monitor”to_tidy3d_monitor( self, frequencies, name, use_angle_rotation=False, technology=None)Create a Tidy3D ModeMonitor from this port.
Args
- frequencies (Sequence[float]): Sequence of frequency values for the mode monitor.
- name (str): Name for the created monitor.
- use_angle_rotation (bool): Enable the use of
angle_rotationin theModeSpecused by the monitor. - technology (Technology | None): Technology specification used for the default
target_neff.
Returns
ModeMonitor: Tidy3D mode monitor.
to_tidy3d_source
Section titled “to_tidy3d_source”to_tidy3d_source( self, frequencies, mode_index=0, name=None, use_angle_rotation=False, technology=None,)Create a Tidy3D ModeSource from this port.
Args
- frequencies (Sequence[float]): Sequence of frequency values for the mode source.
- mode_index (int): Mode index to be used as source (must be less than the number of modes supported by this port).
- name (str | None): Optional name for the created source.
- use_angle_rotation (bool): Enable the use of
angle_rotationin theModeSpecused by the source. - technology (Technology | None): Technology specification used for the default
target_neff.
Returns
ModeSource: Tidy3D mode source.
Attributes
Section titled “Attributes”| Attribute | Description |
|---|---|
added_solver_modes | int: Additinal modes to include in mode solver runs for this port (read only). |
bend_radius | float: Port bend radius. |
center | ndarray: Port center. |
classification | Literal[‘optical’, ‘electrical’]: Port classification: optical or electrical (read only). |
extended | bool: Port extended flag. |
input_direction | float: Port input direction. |
inverted | bool: Port inverted flag. |
num_modes | int: Number of modes supported by this port (read only). |
properties | Properties: Object properties. |
spec | PortSpec: Port specification. |
added_solver_modes
Section titled “added_solver_modes”int: Additinal modes to include in mode solver runs for this port (read only).
bend_radius
Section titled “bend_radius”float: Port bend radius.
center
Section titled “center”ndarray: Port center.
classification
Section titled “classification”Literal[‘optical’, ‘electrical’]: Port classification: optical or electrical (read only).
extended
Section titled “extended”bool: Port extended flag.
input_direction
Section titled “input_direction”float: Port input direction.
inverted
Section titled “inverted”bool: Port inverted flag.
num_modes
Section titled “num_modes”int: Number of modes supported by this port (read only).
properties
Section titled “properties”Properties: Object properties.
PortSpec: Port specification.