Port¶
- class photonforge.Port(center, input_direction, spec, extended=True, inverted=False)¶
2D port.
- Parameters:
center – Port position.
input_direction – Angular direction (in degrees) of power entering the component through this port.
spec –
PortSpec
with this port’s specification.extended – 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 – 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.
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, name])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 center.
optical or electrical (read only).
Port extended flag.
Port input direction.
Port inverted flag.
Number of modes supported by this port (read only).
Port specification.
- added_solver_modes¶
Additinal modes to include in mode solver runs for this port (read only).
- as_bytes¶
Byte representation of the port (read only).
- 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 against which to check.
- Returns:
Boolean indicating if the ports can connect.
- center¶
Port center.
- classification¶
optical or electrical (read only).
- Type:
Port classification
- copy(deep=False)¶
Create a copy of this port.
- Parameters:
deep – If set, creates a deep copy.
- Returns:
New copy.
- extended¶
Port extended flag.
- input_direction¶
Port input direction.
- inverted¶
Port inverted flag.
- 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 against which to check.
- Returns:
Boolean indicating if the ports are connected.
- 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 against which to check.
- Returns:
Boolean indicating if the ports match.
- num_modes¶
Number of modes supported by this port (read only).
- spec¶
Port specification.
- terminals(name=None)¶
Get named terminals from this port.
- Parameters:
name – If not
None
, get only the terminal with this name, if any.- Returns:
Terminal
with the specified name, or a dictionary of terminals.
- 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 – Set to ignore fields outside the voltage integration path bounds.
snap_to_grid – Snap integral paths to the data grid.
- Returns:
Tidy3D impedance calculator.
- to_tidy3d_mode_solver(frequencies, mesh_refinement=None, group_index=False, technology=None)¶
Create a Tidy3D
ModeSolver
from this port.- Parameters:
frequencies – Sequence of frequency values for the mode solver.
mesh_refinement – Minimal number of mesh elements per wavelength used for mode solving.
group_index – Boolean indicating whether the mode solver should include group index computation.
technology – Technology specification for this port.
- Returns:
Tidy3D mode solver.
- to_tidy3d_monitor(frequencies, name)¶
Create a Tidy3D ModeMonitor from this port.
- Parameters:
frequencies – Sequence of frequency values for the mode monitor.
name – Name for the created monitor.
- Returns:
Tidy3D ModeMonitor.
- to_tidy3d_source(frequencies, mode_index=0, name=None)¶
Create a Tidy3D ModeSource from this port.
- Parameters:
frequencies – Sequence of frequency values for the mode source.
mode_index – Mode index to be used as source (must be less than the number of modes supported by this port).
name – Optional name for the created source.
- Returns:
Tidy3D ModeSource.