fdtdx.detectors_from_gds_ports

fdtdx.detectors_from_gds_ports#

fdtdx.detectors_from_gds_ports(gds_source, cell_name, port_specs, wave_characters, simulation_volume, gds_center, direction='+', mode_index=0, filter_pol=None, height_axis=2, flatten=True)[source]#

Create ModeOverlapDetector objects from GDS port markers.

Mirrors sources_from_gds_ports() exactly but produces ModeOverlapDetector objects. wave_characters is a sequence to match the detector constructor signature.

See sources_from_gds_ports() for full documentation of the constraint layout, ordering guarantee, and direction dict usage.

Parameters:
  • gds_source (str | Path | Library) – Path to a .gds file or an already-loaded gdstk.Library.

  • cell_name (str) – GDS cell containing the port marker polygons.

  • port_specs (list[GDSPortSpec]) – List of GDSPortSpec objects.

  • wave_characters (Sequence[WaveCharacter]) – Sequence of wavelength characters forwarded to each detector.

  • simulation_volume (SimulationVolume) – Reference object for size/position constraints. Its partial_real_shape must be set on propagation_axis.

  • gds_center (tuple[float, float]) – GDS coordinate (in metres) mapped to the x/y centre of the simulation volume.

  • direction (Union[Literal['+', '-'], dict[str, Literal['+', '-']]]) – Propagation direction ("+" or "-"), applied to all detectors. Pass a dict mapping port names to individual directions when needed.

  • mode_index (int) – Waveguide mode index.

  • filter_pol (Optional[Literal['te', 'tm']]) – Optional polarisation filter.

  • height_axis (int) – Simulation axis treated as the out-of-plane height; detectors are made to span the full simulation extent on this axis (default 2 = z). This assumes a single vertical stack — detectors run from one face of the simulation volume to the other along height_axis.

  • flatten (bool) – Flatten sub-cell references before reading polygons.

Returns:

propagation position, transverse center, full-height size, and vertical center.

Return type:

(detectors, constraints) — four constraints per detector

Raises:

ValueError – If propagation_axis is not 0 or 1, or if simulation_volume.partial_real_shape is None on propagation_axis.