port_modes

photonforge.port_modes(port, frequencies=(), mesh_refinement=None, group_index=False, impedance=False, technology=None, task_name=None, remote_path='Mode Solver', verbose=True, show_progress=True)[source]

Compute the port modes using Tidy3D’s mode solver.

Parameters:
  • port (str | Port | FiberPort | PortSpec | ModeSolver | Sequence[str | Port | FiberPort | PortSpec | ModeSolver]) – Port or port specification to solver for modes. A Tidy3D ModeSolver instance can also be used. A sequence of any of those solves all entries in a single batch.

  • frequencies (Sequence[float]) – Sequence of frequency values for the mode solver. Not required if a ModeSolver instance is used as ‘port’.

  • mesh_refinement (float | None) – Minimal number of mesh elements per wavelength used for mode solving.

  • group_index (bool) – Flag indicating whether the mode solver should include group index computation.

  • impedance (bool) – Flag indicating whether the mode impedances should also be computed and returned.

  • technology (Technology | None) – Technology specification for the port.

  • task_name (str | None) – Name for the Tidy3D task. In a batch, an index suffix is appended to each task name.

  • remote_path (str) – Remote folder for the task.

  • verbose (bool) – Flag controlling solver verbosity.

  • show_progress (bool) – Flag to control whether to show solver progress.

Returns:

Mode solver object with calculated data, or a list of them if ‘port’ is a sequence. If impedance == True, the calculated impedances are also returned (None for optical modes), as a single value or a list, matching ‘port’.

Return type:

ModeSolver | list[ModeSolver] | tuple[ModeSolver, object] | tuple[list[ModeSolver], list]

Note

If a ModeSolver instance is used as ‘port’, arguments ‘frequency’, ‘mesh_refinement’, ‘group_index’, and ‘technology’ have no effect.