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 – Port 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

Ports guide

Methods

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.

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

as_bytes

Byte representation of the port (read only).

center

Port center.

extended

Port extended flag.

input_direction

Port input direction.

inverted

Port inverted flag.

num_modes

Number of modes supported by this port (read only).

spec

Port specification.

as_bytes

Byte representation of the port (read only).

center

Port center.

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.

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.