gdsfactory Integration API¶
gdsfactory
¶
gdsfactory bridge, imported as hog: PDK stacks, periodic layouts and metasurfaces.
Needs the gdsfactory extra and an active PDK; see the gdsfactory user guide.
Modules:
-
geometry–Line gratings: a grid-snapped PCell, and extraction that refuses anything else.
-
lattice–2D-periodic layouts: grid-snapped PCells, exact extraction, PDK stacks and rcwa2d layers.
-
materials–Materials for gdsfactory stacks: specifications, crystal orientation, PDK names.
-
metasurface–Metasurfaces whose cells differ site by site: layout, read-back and SAX models.
-
simulate–Labelled results from a layout (
simulate_*) or a hand-written stack (solve_*). -
sparameters–Cached four-port S-parameters for PDK stacks and metasurface cells.
-
stack–Vertical stacks, written by hand or read from a PDK
LayerStack.
Classes:
-
LineGrating–A grating of identical ridges along y, repeating along x.
-
UnitCell–The repeating unit of a 2D-periodic pattern.
-
Oriented–A material and its crystal orientation.
-
CrossedGratingResponse–A 2D-periodic pattern's response over
[wavelength, angle, order]. -
GratingResponse–A line grating's response over
[wavelength, angle, order]. -
PlanarResponse–A planar stack's response over
[wavelength, angle, azimuth]. -
StackLayer–One layer of the vertical stack, from the incident side down.
-
VerticalStack–Half-spaces and layers, incident side first.
Functions:
-
extract_line_grating–Read a line grating back from the polygons of
componentonlayer. -
line_grating–PCell:
n_periodsridges of widthfill · period_umand lengthlength_um. -
crossed_grating_layers–:mod:
~hyperbolic_optics.rcwa2dlayers for a unit cell etched into a stack. -
crossed_grating_stack–A 2D-periodic pattern and the patterned stack its etch makes in the PDK's LayerStack.
-
extract_unit_cell–Read a 2D-periodic pattern back from the polygons of
componentonlayer. -
periodic_array–PCell: the
polygonsof one cell, repeatedn_cellstimes on a lattice. -
material_tensor–Lab-frame permittivity tensor
[..., 3, 3]for a material specification. -
x_cut–Optic axis in the wafer plane at
axis_azimuth_degfrom the layout x axis. -
z_cut–Optic axis along the wafer normal (a z-cut wafer of a uniaxial crystal).
-
cell_from_pdk–Read one cell's centred lattice footprint through a PDK LayerStack.
-
cell_layers–A cell's :mod:
~hyperbolic_optics.rcwa2dlayers at a wavelength (traceable). -
cell_sax_model–A SAX model of one cell in an infinite array of itself: its zeroth-order S-matrix.
-
metasurface_component–A metasurface: the cell
cells[k]at each sitesites_um[k]. -
read_metasurface–A metasurface layout read back into per-site cells.
-
turned–Turn a cell's polygons, optionally turning its crystals too (traceable).
-
simulate_crossed_grating–A 2D-periodic pattern in a layout, etched into the PDK's stack: cell, stack, response.
-
simulate_grating–A line grating in a layout, etched into the PDK's stack: geometry, stack, response.
-
simulate_stack–The PDK stack at one point of a layout, and its plane-wave response.
-
solve_crossed_grating–Diffraction by a 2D-periodic pattern etched into a stack, over wavelength and angle.
-
solve_grating–Diffraction by a line grating etched into a stack, over wavelength and angle.
-
solve_stack–Reflection and transmission of an unpatterned stack.
-
stack_sax_model–A SAX model of an unpatterned stack, e.g. from :func:
vertical_stack. -
model_from_npz–A SAX model from saved S-parameters, interpolated over wavelength, modes kept.
-
write_sparameters_cell–Cache a cell's four-port S-parameters; angles and solver settings follow cell_sax_model.
-
write_sparameters_stack–The plane-wave S-matrix of the PDK stack at a point of a layout, over wavelength.
-
grating_layers–:mod:
~hyperbolic_optics.rcwalayers for a line grating etched into a stack. -
grating_stack–A line grating and the patterned stack its etch makes in the PDK's LayerStack.
-
vertical_stack–The unpatterned stack at
point_um: ambient above, lowest level as the exit.
LineGrating
dataclass
¶
A grating of identical ridges along y, repeating along x.
Attributes:
-
period_um(float) –Grating period in µm.
-
fill(float) –Ridge width as a fraction of the period.
-
offset(float) –Position of the first ridge's left edge as a fraction of the period (mod 1). It shifts only the phases of the diffracted orders.
-
n_periods(int) –Number of ridges drawn.
-
length_um(float) –Ridge length along y in µm.
-
origin_um(tuple[float, float]) –Layout position
(x, y)of the first ridge's lower-left corner, so the stack beneath it can be sampled.
UnitCell
dataclass
¶
The repeating unit of a 2D-periodic pattern.
Attributes:
-
period_um(tuple[Any, Any] | None) –(Λx, Λy)in µm for a rectangular lattice;Nonewhenlattice_umgives another. -
polygons(tuple[Any, ...]) –The shapes of one cell, each
[V, 2]in µm relative to the cell origin. They may extend past the cell; the solver periodises them. May be JAX values, for optimisation. -
n_cells(tuple[int, int]) –(n₁, n₂)cells drawn in the layout, alonga₁anda₂. -
origin_um(tuple[float, float]) –Layout position of the first cell's origin, so the stack beneath it can be sampled.
-
lattice_um(tuple[tuple[Any, Any], tuple[Any, Any]] | None) –Primitive vectors
((a1x, a1y), (a2x, a2y))in µm, for any lattice (hexagonal, oblique); overridesperiod_um.
lattice
property
¶
The cell's lattice, for :func:hyperbolic_optics.rcwa2d.solve_crossed_grating.
Oriented
dataclass
¶
A material and its crystal orientation.
Attributes:
-
material(MaterialSpec) –Any material specification.
-
rotation_deg(Sequence) –(rotationX, rotationY, rotationZ)in degrees, the payload API's convention: a uniaxial crystal's optic axis (crystal z) points at polar anglerotationYfrom the stack normal and azimuthrotationZfrom the layout x axis.
CrossedGratingResponse
dataclass
¶
A 2D-periodic pattern's response over [wavelength, angle, order].
Attributes:
-
wavelength_um,(angle_deg) –The sweep axes;
azimuth_degthe fixed plane of incidence, from the lattice's x axis. -
orders(ndarray) –[N, 2], the diffraction orders(m, n)kept. -
r,((t, R, T)) –[F, A, N, out, in], 0 = p and 1 = s, in each order's own p/s basis; R and T are diffraction efficiencies.
Methods:
-
mueller–Mueller matrices
[F, A, 4, 4]of one diffraction order.
mueller
¶
Mueller matrices [F, A, 4, 4] of one diffraction order.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
GratingResponse
dataclass
¶
A line grating's response over [wavelength, angle, order].
Attributes:
-
wavelength_um,(angle_deg) –The sweep axes;
azimuth_degthe fixed plane of incidence relative to the grating vector. -
orders(ndarray) –The diffraction orders kept.
-
r,((t, R, T)) –[F, A, order, out, in], 0 = p, 1 = s; R and T are diffraction efficiencies.
Methods:
-
mueller–Mueller matrices
[F, A, 4, 4]of one diffraction order.
mueller
¶
Mueller matrices [F, A, 4, 4] of one diffraction order.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
PlanarResponse
dataclass
¶
A planar stack's response over [wavelength, angle, azimuth].
Attributes:
-
wavelength_um,((angle_deg, azimuth_deg)) –The sweep axes. The azimuth turns the sample about the stack normal (every layer's tensor), as the payload API's
rotationZdoes; the plane of incidence stays x-z. -
r,(t) –Complex Jones matrices
[F, A, B, out, in], 0 = p, 1 = s. -
R,(T) –The corresponding powers.
Methods:
-
mueller–Mueller matrices
[F, A, B, 4, 4]of the reflected (or transmitted) light. -
ellipsometry–Generalized ellipsometry:
Psi, DeltaandPsi_ps, Delta_ps, Psi_sp, Delta_sp.
mueller
¶
Mueller matrices [F, A, B, 4, 4] of the reflected (or transmitted) light.
The transmitted one describes amplitudes, not flux: its M₀₀ equals the transmittance only when the incident and exit media match.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
ellipsometry
¶
Generalized ellipsometry: Psi, Delta and Psi_ps, Delta_ps, Psi_sp, Delta_sp.
StackLayer
dataclass
¶
StackLayer(
thickness_um,
material,
background=None,
rotation_deg=(0.0, 0.0, 0.0),
name="",
polygons=None,
)
One layer of the vertical stack, from the incident side down.
Attributes:
-
thickness_um(Any) –Thickness in µm (may be a JAX value for optimisation).
-
material(MaterialSpec | Oriented) –The layer's material -- the ridges or shapes, if
backgroundis set. -
background(MaterialSpec | Oriented | None) –Material around them.
Nonemakes the layer unpatterned (a uniform film ofmaterial). -
rotation_deg(Sequence) –Orientation of the layer's crystals,
materialandbackgroundalike (payload-style(x, y, z), degrees), applied after an :class:Orientedmaterial's own cut: a twist. -
name(str) –Label, e.g. the PDK level it came from.
-
polygons(tuple | None) –The layer's own shapes (vertices
[V, 2]in µm, cell coordinates) for a 2D-periodic cell whose layers are patterned differently;Noneto use the unit cell's.
Methods:
-
tensors–Lab-frame
(material, background)tensors;backgroundis None if uniform.
tensors
¶
Lab-frame (material, background) tensors; background is None if uniform.
Source code in hyperbolic_optics/integrations/gdsfactory/stack.py
VerticalStack
dataclass
¶
Half-spaces and layers, incident side first.
Attributes:
-
layers(tuple[StackLayer, ...]) –The finite layers, from the incident side down.
-
incident(MaterialSpec) –Material of the incident half-space (isotropic, lossless).
-
exit(MaterialSpec) –Material of the exit half-space: isotropic and lossless, or for 2D-periodic solves a crystal or absorbing wafer (:meth:
exit_medium).
Methods:
-
half_space_permittivity–Real scalar ε; invalid half-spaces raise eagerly and return NaN under JIT.
-
exit_medium–The exit half-space for 2D-periodic solves (:mod:
~hyperbolic_optics.rcwa2d).
half_space_permittivity
¶
Real scalar ε; invalid half-spaces raise eagerly and return NaN under JIT.
Source code in hyperbolic_optics/integrations/gdsfactory/stack.py
exit_medium
¶
The exit half-space for 2D-periodic solves (:mod:~hyperbolic_optics.rcwa2d).
A real scalar ε where it is isotropic and lossless; otherwise its 3×3
tensor -- a crystal, hyperbolic or absorbing substrate, whose two
transmitted modes then replace p and s. Decided at wavelength_um, or
under jit at a representative wavelength of the material.
Source code in hyperbolic_optics/integrations/gdsfactory/stack.py
extract_line_grating
¶
Read a line grating back from the polygons of component on layer.
Every polygon must be an axis-aligned rectangle; all must span the same y
range, have the same width, and start at equally spaced x. Anything else
raises ValueError naming what failed, because a solver fed a guessed
geometry returns a confident, wrong answer.
Parameters:
-
component(Component) –A gdsfactory component, e.g. from
gf.import_gds. -
layer(LayerSpec) –The layer the ridges are drawn on.
-
tolerance_um(float | None, default:None) –Allowed deviation; defaults to one database unit.
Returns:
-
The(LineGrating) –class:
LineGrating, with the period from a least-squares fit to the -
LineGrating–ridge positions.
Source code in hyperbolic_optics/integrations/gdsfactory/geometry.py
line_grating
¶
PCell: n_periods ridges of width fill · period_um and length length_um.
The period and the ridge width are snapped to the layout grid (the active
PDK's database unit), so every period drawn is identical; the snapped values
are recorded in component.info and are what :func:extract_line_grating
recovers.
Source code in hyperbolic_optics/integrations/gdsfactory/geometry.py
crossed_grating_layers
¶
:mod:~hyperbolic_optics.rcwa2d layers for a unit cell etched into a stack.
A patterned layer uses its own polygons if it has them, else the
cell's shapes (a single etch); cell may be None when every
patterned layer has its own. Polygons, thicknesses, orientations and the
wavelength may be JAX values.
Source code in hyperbolic_optics/integrations/gdsfactory/lattice.py
crossed_grating_stack
¶
crossed_grating_stack(
component,
pattern_layer,
layer_stack,
materials=None,
ambient=1.0,
period_um=None,
samples=3,
lattice_um=None,
)
A 2D-periodic pattern and the patterned stack its etch makes in the PDK's LayerStack.
The stack is sampled at points inside every shape and around them, in the
first cell and in one in the middle of the array; every inside sample must
agree, and every outside one, or another layer is patterned differently and
a ValueError says so. Where the two columns differ, the layer is
patterned (one etch shared by every patterned layer).
Source code in hyperbolic_optics/integrations/gdsfactory/lattice.py
extract_unit_cell
¶
Read a 2D-periodic pattern back from the polygons of component on layer.
The polygons are grouped into translated copies of one another. Each group
must fill the same complete n₁ × n₂ lattice, so every cell holds the
same motif. Shapes must not overlap, even across cell edges, and must not
have holes. Anything else raises ValueError, because a solver fed a
guessed geometry returns a confident, wrong answer.
Parameters:
-
component(Component) –A gdsfactory component, e.g. from
gf.import_gds. -
layer(LayerSpec) –The layer the pattern is drawn on.
-
period_um(tuple[float, float] | None, default:None) –A rectangular lattice's period.
-
lattice_um(tuple[tuple[float, float], tuple[float, float]] | None, default:None) –Any lattice's primitive vectors
((a1x, a1y), (a2x, a2y)). Without either, the lattice is inferred -- rectangular, hexagonal or oblique, motifs that repeat a shape (a dimer) included: the shortest basis under which the drawing is one motif on a complete parallelogram of cells. Pass it to impose a lattice instead.
Source code in hyperbolic_optics/integrations/gdsfactory/lattice.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | |
periodic_array
¶
periodic_array(
period_um=(1.0, 1.0),
polygons=(
(
(0.25, 0.25),
(0.75, 0.25),
(0.75, 0.75),
(0.25, 0.75),
),
),
n_cells=(10, 10),
layer=(1, 0),
lattice_um=None,
)
PCell: the polygons of one cell, repeated n_cells times on a lattice.
The lattice is rectangular at period_um, or given by its primitive
vectors lattice_um = ((a1x, a1y), (a2x, a2y)) -- e.g. a hexagonal one,
((a, 0), (a/2, a·√3/2)). The lattice vectors and every vertex are
snapped to the layout grid (the database unit), so every cell drawn is an
exact translate of the first; the snapped values are in component.info
and are what :func:extract_unit_cell recovers. Pass polygon vertices as
nested tuples (a PCell's arguments must be hashable), e.g.
tuple(map(tuple, rcwa2d.ellipse(...).tolist())).
Source code in hyperbolic_optics/integrations/gdsfactory/lattice.py
material_tensor
¶
Lab-frame permittivity tensor [..., 3, 3] for a material specification.
Parameters:
-
spec(MaterialSpec | Oriented) –A material specification or :class:
Oriented. An oriented crystal is cut first, then turned byrotation_deg: a layer's twist turns the crystal as cut. -
wavelength_um(Array) –Vacuum wavelength in µm; differentiable.
-
rotation_deg(Sequence, default:(0.0, 0.0, 0.0)) –Payload-style
(rotationX, rotationY, rotationZ), degrees.
Source code in hyperbolic_optics/integrations/gdsfactory/materials.py
x_cut
¶
Optic axis in the wafer plane at axis_azimuth_deg from the layout x axis.
An x- or y-cut wafer of a uniaxial crystal such as LiNbO₃: which of the two
only matters for biaxial crystals. For a waveguide along layout y, TE light
(E along x) sees the extraordinary index when axis_azimuth_deg = 0.
Source code in hyperbolic_optics/integrations/gdsfactory/materials.py
z_cut
¶
cell_from_pdk
¶
cell_from_pdk(
component,
layer_stack,
lattice_um,
materials=None,
ambient=1.0,
*,
sidewall_slices=0,
)
Read one cell's centred lattice footprint through a PDK LayerStack.
Each z interval uses its own mask polygons, including derived layers.
Lower mesh_order wins; WAFER covers the footprint. Uncovered regions are
ambient. The lowest interval must be uniform and becomes the substrate.
A StackLayer can represent two materials per interval; more are refused.
Crystal cuts come from materials, as in :func:vertical_stack.
sidewall_slices=N approximates each nonvertical level by N midpoint
slices, respecting width_to_z and scalar bias (µm per edge).
Positive angles narrow towards increasing z. Polygon offsets snap to dbu;
refine N and the layout grid separately. The default warns and uses vertical
walls. Generic z_to_bias and directional biases are refused when slicing.
Source code in hyperbolic_optics/integrations/gdsfactory/metasurface.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
cell_layers
¶
A cell's :mod:~hyperbolic_optics.rcwa2d layers at a wavelength (traceable).
Source code in hyperbolic_optics/integrations/gdsfactory/metasurface.py
cell_sax_model
¶
A SAX model of one cell in an infinite array of itself: its zeroth-order S-matrix.
Returns model(wl, kx=0, azimuth=0) -> SDict over top@p, top@s,
bottom@p, bottom@s, from
:func:hyperbolic_optics.rcwa2d.crossed_grating_smatrix, with every
material evaluated at SAX's wl; kx is n·sin θ in the incident
medium. Only the zeroth order is a port, so the model describes a
subwavelength array (higher orders evanescent). azimuth rotates the
sample, as in stack_sax_model; the ports retain a common p/s basis.
On a crystal or absorbing substrate (:meth:~.stack.VerticalStack.exit_medium)
the bottom ports are its two power-normalised modes.
Source code in hyperbolic_optics/integrations/gdsfactory/metasurface.py
metasurface_component
¶
metasurface_component(
sites_um,
cells,
layers,
lattice_um,
rotations_rad=None,
*,
rotate_materials=True,
)
A metasurface: the cell cells[k] at each site sites_um[k].
Parameters:
-
sites_um–Cell centres
[K, 2]. -
cells(Sequence[VerticalStack]) –One per site (the same object may repeat): a :class:
~.stack.VerticalStack, levels from the top down and patterned ones withpolygonsabout the cell's centre; or agf.Componentdrawn on PDK layers about its centre, read back withread_metasurface(..., layer_stack=...). -
layers(Sequence[LayerSpec]) –The GDS layer of each level: level
kof every stack cell is drawn onlayers[k]. -
lattice_um(tuple[tuple[float, float], tuple[float, float]]) –(a1, a2): the lattice the cells were designed on; an unpatterned level is drawn as the cell's footprint. -
rotations_rad–A turn of each site's cell about its centre
[K]. -
rotate_materials(bool, default:True) –Turn the crystals with each reference (the default, e.g. placed flakes). False turns only the mask polygons, preserving the wafer axes and each layer's explicit crystal orientation. Stored in each cell's metadata for GDS read-back.
Returns:
-
Component–The component, a reference per site to one cell per distinct design.
-
Component–The same design gives the same component (cached like any
@gf.cell).
Source code in hyperbolic_optics/integrations/gdsfactory/metasurface.py
read_metasurface
¶
read_metasurface(
component,
materials=None,
*,
layer_stack=None,
lattice_um=None,
ambient=1.0,
sidewall_slices=0,
)
A metasurface layout read back into per-site cells.
Returns (sites_um [K, 2], cells, lattice_um). Geometry always comes from
the polygons, so what is re-simulated is what was drawn.
Without layer_stack, materials, thicknesses and orientations come from
each cell's info (named materials looked up in materials) and the
reference's turn is applied with :func:turned, turning crystals unless
the cell was drawn with rotate_materials=False.
With layer_stack, each reference's cell, turned as placed, is read
through the PDK by :func:cell_from_pdk (materials, ambient and
sidewall_slices as there): crystals keep the wafer's axes. Cells need
no info; lattice_um is required unless the layout records it.
Pass the metasurface's top cell. Nested layouts, arrays, mirrors and magnification are refused rather than reconstructed incompletely.
Source code in hyperbolic_optics/integrations/gdsfactory/metasurface.py
turned
¶
Turn a cell's polygons, optionally turning its crystals too (traceable).
The default rotates the whole cell, suitable for a placed crystal flake.
rotate_materials=False models a mask turned on a fixed wafer: material
and background tensors retain their cuts and per-layer orientations.
Half-spaces and the periodic lattice are unchanged in either case.
Source code in hyperbolic_optics/integrations/gdsfactory/metasurface.py
simulate_crossed_grating
¶
simulate_crossed_grating(
component,
pattern_layer,
layer_stack,
wavelengths_um,
angles_deg,
azimuth_deg=0.0,
max_order=(5, 5),
materials=None,
ambient=1.0,
period_um=None,
factorization="normal",
truncation="parallelogram",
lattice_um=None,
)
A 2D-periodic pattern in a layout, etched into the PDK's stack: cell, stack, response.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
simulate_grating
¶
simulate_grating(
component,
grating_layer,
layer_stack,
wavelengths_um,
angles_deg,
azimuth_deg=0.0,
max_order=20,
materials=None,
ambient=1.0,
edge_width=0.0,
)
A line grating in a layout, etched into the PDK's stack: geometry, stack, response.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
simulate_stack
¶
simulate_stack(
component,
layer_stack,
point_um,
wavelengths_um,
angles_deg,
azimuths_deg=(0.0,),
materials=None,
ambient=1.0,
solver="jax",
)
The PDK stack at one point of a layout, and its plane-wave response.
Returns the extracted :class:VerticalStack alongside the response, so what
was simulated can be inspected.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
solve_crossed_grating
¶
solve_crossed_grating(
cell,
stack,
wavelengths_um,
angles_deg,
azimuth_deg=0.0,
max_order=(5, 5),
factorization="normal",
truncation="parallelogram",
)
Diffraction by a 2D-periodic pattern etched into a stack, over wavelength and angle.
The lattice is the cell's (:attr:UnitCell.lattice): rectangular,
hexagonal or oblique. truncation="circular" suits non-rectangular ones
(see :func:hyperbolic_optics.rcwa2d.solve_crossed_grating).
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
solve_grating
¶
solve_grating(
grating,
stack,
wavelengths_um,
angles_deg,
azimuth_deg=0.0,
max_order=20,
edge_width=0.0,
)
Diffraction by a line grating etched into a stack, over wavelength and angle.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
solve_stack
¶
Reflection and transmission of an unpatterned stack.
Parameters:
-
stack(VerticalStack) –The stack, incident side first.
-
wavelengths_um(ArrayLike) –Vacuum wavelengths (µm).
-
angles_deg(ArrayLike) –Angles of incidence in the incident medium (degrees).
-
azimuths_deg(ArrayLike, default:(0.0,)) –In-plane rotations of the sample (degrees).
-
solver(str, default:'jax') –"jax"(differentiable) or"numpy"(the eigendecomposition engine, the package's reference).
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
stack_sax_model
¶
A SAX model of an unpatterned stack, e.g. from :func:vertical_stack.
Returns model(wl, kx, azimuth) -> SDict over top@p, top@s,
bottom@p and bottom@s (see :mod:hyperbolic_optics.integrations.sax),
with every material evaluated with its dispersion at SAX's wl.
Source code in hyperbolic_optics/integrations/gdsfactory/simulate.py
model_from_npz
¶
A SAX model from saved S-parameters, interpolated over wavelength, modes kept.
Returns model(wl) → SDict keyed ("port@mode", "port@mode"). Real and
imaginary parts are interpolated linearly (jnp.interp), as
gplugins.sax.read.model_from_npz does, which instead drops the mode.
Source code in hyperbolic_optics/integrations/gdsfactory/sparameters.py
write_sparameters_cell
¶
write_sparameters_cell(
cell,
lattice_um,
wavelengths_um,
max_order=(4, 4),
kx=0.0,
azimuth=0.0,
dirpath=None,
overwrite=False,
**solver_settings,
)
Cache a cell's four-port S-parameters; angles and solver settings follow cell_sax_model.
The key includes evaluated tensors, thicknesses, polygons, lattice and
truncation. Named or callable material changes therefore invalidate it.
Read the returned dictionary with :func:model_from_npz.
Source code in hyperbolic_optics/integrations/gdsfactory/sparameters.py
write_sparameters_stack
¶
write_sparameters_stack(
component,
layer_stack,
point_um,
wavelengths_um,
angle_deg=0.0,
azimuth_deg=0.0,
materials=None,
ambient=1.0,
dirpath=None,
overwrite=False,
)
The plane-wave S-matrix of the PDK stack at a point of a layout, over wavelength.
Returns {"top@p,bottom@s": …, …, "wavelengths": …}: all 16 entries of
:func:hyperbolic_optics.bcm.stack_smatrix, power-normalised, for light at
angle_deg in the ambient (including its dispersion), the sample turned by
azimuth_deg.
Source code in hyperbolic_optics/integrations/gdsfactory/sparameters.py
grating_layers
¶
:mod:~hyperbolic_optics.rcwa layers for a line grating etched into a stack.
Every patterned layer shares the grating's geometry (a single etch). Fields
of grating may be JAX values, so fill and period can be optimised.
Source code in hyperbolic_optics/integrations/gdsfactory/stack.py
grating_stack
¶
A line grating and the patterned stack its etch makes in the PDK's LayerStack.
The stack is sampled at samples points across a ridge and across a gap,
in two periods; every ridge sample must agree, and every gap sample, or the
layout is not a single line grating in this stack and a ValueError says
so. Where the ridge and gap columns differ, the layer is patterned.
Source code in hyperbolic_optics/integrations/gdsfactory/stack.py
vertical_stack
¶
The unpatterned stack at point_um: ambient above, lowest level as the exit.
Parameters:
-
component(Component) –The layout.
-
layer_stack(LayerStack) –The PDK's
LayerStack(e.g.gf.get_active_pdk().layer_stack). -
point_um(tuple[float, float]) –Layout position
(x, y)in µm. -
materials(Mapping[str, MaterialSpec] | None, default:None) –PDK material name → specification, over :data:
~hyperbolic_optics.integrations.gdsfactory.materials.DEFAULT_MATERIALS. -
ambient(MaterialSpec, default:1.0) –The incident half-space above the stack.