Port¶
- class photonforge.Port(center, input_direction, spec, extended=True, inverted=False, bend_radius=0)¶
2D port.
- Parameters:
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_technology
can 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.
See also
Methods
can_connect_to
(port)Check if this port can connect to another one.
copy
([deep])Create a copy of this port.
is_connected_to
(port)Check if this port is connected to another one.
matches
(port)Check if this port matches another one.
terminals
([name])Get named terminals from this port.
Create a Tidy3D
ImpedanceCalculator
from this port.to_tidy3d_mode_solver
(frequencies[, ...])Create a Tidy3D
ModeSolver
from this port.to_tidy3d_monitor
(frequencies, name[, ...])Create a Tidy3D ModeMonitor from this port.
to_tidy3d_source
(frequencies[, mode_index, ...])Create a Tidy3D ModeSource from this port.
Attributes
Additinal modes to include in mode solver runs for this port (read only).
Byte representation of the port (read only).
Port bend radius.
Port center.
Port classification: optical or electrical (read only).
Port extended flag.
Port input direction.
Port inverted flag.
Number of modes supported by this port (read only).
Object properties.
Port specification.
- added_solver_modes¶
Additinal modes to include in mode solver runs for this port (read only).
- Type:
int
- as_bytes¶
Byte representation of the port (read only).
- Type:
bytes
- bend_radius¶
Port bend radius.
- Type:
float
- can_connect_to(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.
- Parameters:
port (Port) – Port against which to check.
- Returns:
Boolean indicating if the ports can connect.
- Return type:
bool
- center¶
Port center.
- Type:
ndarray
- classification¶
Port classification: optical or electrical (read only).
- Type:
Literal[‘optical’, ‘electrical’]
- copy(deep=False)¶
Create a copy of this port.
- Parameters:
deep (bool) – If set, creates a deep copy.
- Returns:
New copy.
- Return type:
- extended¶
Port extended flag.
- Type:
bool
- input_direction¶
Port input direction.
- Type:
float
- inverted¶
Port inverted flag.
- Type:
bool
- is_connected_to(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.
- Parameters:
port (Port) – Port against which to check.
- Returns:
Boolean indicating if the ports are connected.
- Return type:
bool
- matches(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.
- Parameters:
port (Port) – Port against which to check.
- Returns:
Boolean indicating if the ports match.
- Return type:
bool
- num_modes¶
Number of modes supported by this port (read only).
- Type:
int
- properties¶
Object properties.
- Type:
- terminals(name=None)¶
Get named terminals from this port.
- to_tidy3d_impedance_calculator(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.
- Parameters:
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:
Tidy3D impedance calculator.
- Return type:
ImpedanceCalculator
- to_tidy3d_mode_solver(frequencies, mesh_refinement=None, group_index=False, technology=None, use_angle_rotation=False)¶
Create a Tidy3D
ModeSolver
from this port.- Parameters:
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_rotation
in theModeSpec
used by the mode solver.
- Returns:
Tidy3D mode solver.
- Return type:
ModeSolver
- to_tidy3d_monitor(frequencies, name, use_angle_rotation=False)¶
Create a Tidy3D ModeMonitor from this port.
- Parameters:
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_rotation
in theModeSpec
used by the monitor.
- Returns:
Tidy3D mode monitor.
- Return type:
ModeMonitor
- to_tidy3d_source(frequencies, mode_index=0, name=None, use_angle_rotation=False)¶
Create a Tidy3D ModeSource from this port.
- Parameters:
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_rotation
in theModeSpec
used by the source.
- Returns:
Tidy3D mode source.
- Return type:
ModeSource