PortSpec¶
- class photonforge.PortSpec(description, width, limits, num_modes=1, polarization=None, target_neff=1, path_profiles=(), added_solver_modes=0, voltage_path=None, current_path=None)¶
Optical or electrical port specification.
This class is mainly used to create optical or electrical 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. Each path profile tuple can be named by using a dictionary.added_solver_modes – Additional modes to solve for in mode solver runs (useful when filtering modes by polarization). These are not included in S parameters computed for ports of this type.
voltage_path – Sequence of vertices that make up the path integral for voltage calculation in this port.
current_path – Sequence of vertices that make up the path integral for current calculation in this port. A planar structure can be used to define the integral over its countour.
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
Methods
combined_with
(port_spec[, offset])Create a port specification combinig this with with a second one.
copy
()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.
profile_matches
(port_spec)Test if the path profiles in this specification match another's.
Return a flag indicating wheter this port specification is symmetric.
to_tidy3d
(frequencies[, mesh_refinement, ...])Create a Tidy3D
ModeSolver
from this port specification.Create a Tidy3D
ImpedanceCalculator
from this port specification.Attributes
Additinal modes to include in mode solver runs for this port.
Byte representation of the Port specification (read only).
optical or electrical (read only).
Current integration path (for electrical port specifications only).
Port spec description.
Json representation of this Port specification.
Out-of-plane limits.
Number of modes supported by this port.
Path profiles.
Mode polarization selection.
Target effective index for port modes.
Voltage integration path (for electrical port specifications only).
In-plane width.
- added_solver_modes¶
Additinal modes to include in mode solver runs for this port.
- as_bytes¶
Byte representation of the Port specification (read only).
- classification¶
optical or electrical (read only).
- Type:
Port spec classification
- combined_with(port_spec, offset=0)¶
Create a port specification combinig this with with a second one.
The combined port specification is a copy of this one with additional path profiles from
port_spec
.- Parameters:
port_spec – Port specification with the path profiles to be added.
offset – Added offset to the new path profiles.
- Returns:
New
PortSpec
.
Note
The combined specification terminals do not have names.
- copy()¶
Create a copy of this port specification.
- Returns:
New copy.
- current_path¶
Current integration path (for electrical port specifications only).
- description¶
Port spec 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.
- 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 supported by this port.
- 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.
- profile_matches(port_spec)¶
Test if the path profiles in this specification match another’s.
- Parameters:
port_spec – Port specification to test.
- Returns:
Boolean flag.
- 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 specification.- 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.
- to_tidy3d_impedance_calculator(extrapolate_to_endpoints=True, snap_to_grid=True)¶
Create a Tidy3D
ImpedanceCalculator
from this port specification.The impedance calculator can be used with mode solver data from this port specificatin to calculate its impedance. Only electrical port specifications 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.
- voltage_path¶
Voltage integration path (for electrical port specifications only).
- width¶
In-plane width.