PortSpec

class photonforge.PortSpec(description, width, limits, num_modes=1, polarization=None, target_neff=1, path_profiles=())

Planar port specification.

This class is mainly used to create waveguide templates for a Technology.

Parameters:
  • description – Description of the port specification.

  • width – In-plane dimension of the port.

  • limits – Out-of-plane bounds of the port.

  • num_modes – Number of modes supported by this port.

  • polarization – Mode polarization selection.

  • target_neff – Target effective index for numerical mode solving.

  • path_profiles – Iterable of tuples with (width, offset, layer) describing the path profiles that make up this port’s geometry.

Example

>>> port_spec = PortSpec(
...     "Single mode strip",
...     1.5,
...     (-0.5, 0.75),
...     path_profiles=[(0.45, 0, (1, 0)), (3, 0, (1, 2))],
... )

See also

Ports guide

Methods

copy([deep])

Create a copy of this port specification.

from_json(json_str)

Create a port specification object from a json string.

get_paths(origin[, scale_width])

Return a list of paths generated by this specification.

inverted()

Return an inverted version of this port if it is asymmetric.

path_profile_for(layer[, technology])

Return the path profile in this port specification for a specific layer.

symmetric()

Return a flag indicating wheter this port specification is symmetric.

to_tidy3d(frequencies[, mesh_refinement, ...])

Create a Tidy3D ModeSolver from this port_spec.

Attributes

as_bytes

Byte representation of the Port specification (read only).

description

PortSpec description.

json

Json representation of this Port specification.

limits

Out-of-plane limits.

num_modes

Number of modes.

path_profiles

Path profiles.

polarization

Mode polarization selection.

target_neff

Target effective index for port modes.

width

In-plane width.

as_bytes

Byte representation of the Port specification (read only).

copy(deep=False)

Create a copy of this port specification.

Returns:

New copy.

description

PortSpec description.

static from_json(json_str)

Create a port specification object from a json string.

Parameters:

json_str – Strig containing the json data.

Returns:

PortSpec instance.

get_paths(origin, scale_width=True)

Return a list of paths generated by this specification.

Parameters:
  • origin – Origin of the generated paths.

  • scale_width – Flag passed to Path to indicate whether the width of the created paths should scale when the paths are scaled.

Returns:

List of tuples with layer and Path.

inverted()

Return an inverted version of this port if it is asymmetric.

Returns:

Inverted PortSpec or self.

json

Json representation of this Port specification.

limits

Out-of-plane limits.

num_modes

Number of modes.

path_profile_for(layer, technology=None)

Return the path profile in this port specification for a specific layer.

Parameters:
  • layer – Layer for which the profile is returned.

  • technology – Technology specification for this PortSpec.

Returns:

Width and offet 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

Path profiles.

polarization

Mode polarization selection.

symmetric()

Return a flag indicating wheter this port specification is symmetric.

Returns:

Boolean flag.

target_neff

Target effective index for port modes.

to_tidy3d(frequencies, mesh_refinement=None, group_index=False, technology=None)

Create a Tidy3D ModeSolver from this port_spec.

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 PortSpec.

Returns:

Tidy3D mode solver.

width

In-plane width.