fdtdx.sources_from_gds_ports#
- fdtdx.sources_from_gds_ports(gds_source, cell_name, port_specs, wave_character, simulation_volume, gds_center, direction='+', mode_index=0, filter_pol=None, height_axis=2, flatten=True)[source]#
Create
ModePlaneSourceobjects from GDS port markers.Each polygon on a port marker layer becomes one source. The polygon’s centroid determines the position of the source’s left face along
propagation_axis; the source’s width is set to match the port marker polygon’s width on the transverse axis.- Parameters:
gds_source (
str|Path|Library) – Path to a.gdsfile or an already-loadedgdstk.Library.cell_name (
str) – GDS cell containing the port marker polygons.port_specs (
list[GDSPortSpec]) – List ofGDSPortSpecobjects (one per port layer).wave_character (
WaveCharacter) – Wavelength / frequency character forwarded to every source.simulation_volume (
SimulationVolume) – Reference object for cross-section size/position constraints. Itspartial_real_shapemust be set onpropagation_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 passed to each source ("+"or"-"). Can also be a dict mapping port names to directions.mode_index (
int) – Waveguide mode index (default 0 = fundamental).filter_pol (
Optional[Literal['te','tm']]) – Optional polarisation filter ("te","tm", orNone).height_axis (
int) – Simulation axis treated as the out-of-plane height; sources are made to span the full simulation extent on this axis (default 2 = z). This assumes a single vertical stack — sources run from one face of the simulation volume to the other alongheight_axis.flatten (
bool) – Flatten sub-cell references before reading polygons.
- Returns:
propagation position, transverse center, full-height size, and vertical center.
- Return type:
(sources, constraints)— four constraints per source- Raises:
ValueError – If
propagation_axisis not 0 or 1, or ifsimulation_volume.partial_real_shapeisNoneonpropagation_axis.