Sweep API¶
sweep
¶
Sweep a single layer's thickness as an extra output dimension.
The canonical engine sweeps incident angle, azimuth, and frequency as the batch
axes [A, B, F] (see :mod:hyperbolic_optics.axes). A layer's thickness is a
per-layer property, not a scenario axis, so this helper sweeps it the pragmatic
way: re-run the structure once per thickness and stack the results along a new
leading index. Each run is cheap, and the output gains a thickness axis in
front of the usual presentation shape — e.g. an Incident r_pp of shape
(F, angle) becomes (n_thickness, F, angle).
This keeps the core convention untouched (no golden re-baseline). If you ever need thickness as a vectorized batch axis alongside angle/azimuth/frequency, that is a separate, larger change to the canonical layout.
Example
payload = { ... "ScenarioData": {"type": "Incident"}, ... "Layers": [ ... {"type": "Ambient Incident Layer", "permittivity": 50.0}, ... {"type": "Crystal Layer", "material": "Calcite", ... "thickness": 1.0, "rotationY": 90}, ... {"type": "Semi Infinite Isotropic Layer", "permittivity": 1.0}, ... ], ... } sweep = ThicknessSweep(payload, layer_index=1, thicknesses=[0.5, 1.0, 2.0]) sweep.r_pp.shape # (3, F, angle) sweep.transmittance("p") # (3, F, angle) sweep.layer_absorption("p") # per-interior-layer, each (3, F, angle)
Classes:
-
ThicknessSweep–Run a payload across a range of thicknesses for one layer and stack outputs.
ThicknessSweep
¶
Run a payload across a range of thicknesses for one layer and stack outputs.
The reflection coefficients and every :class:~hyperbolic_optics.fields.FieldProfile
power quantity are exposed with a leading thickness axis. Thicknesses are
in microns, matching the thickness field in a layer payload.
Execute payload once per thickness for the chosen layer.
Parameters:
-
payload(dict[str, Any]) –A complete
Structure.executepayload. -
layer_index(int) –Index into
payload["Layers"]of the layer to sweep; must be a finite layer (Crystal LayerorIsotropic Middle-Stack Layer). -
thicknesses(ndarray | list[float]) –Thicknesses to sweep, in microns.
Raises:
-
IndexError–If
layer_indexis out of range. -
ValueError–If the selected layer has no sweepable thickness, or
thicknessesis empty.
Methods:
-
reflectance–Stacked power reflectance
Rvs thickness. -
transmittance–Stacked power transmittance
Tvs thickness. -
total_absorption–Stacked total interior absorption vs thickness.
-
layer_absorption–Per-interior-layer absorptance, each stacked over thickness.
-
transmission_coefficients–Amplitude transmission coefficients, each stacked over thickness.
Attributes:
-
r_pp(ndarray) –Stacked p->p reflection coefficient, shape
(n_thickness, *r_pp). -
r_ss(ndarray) –Stacked s->s reflection coefficient.
-
r_ps(ndarray) –Stacked p->s reflection coefficient.
-
r_sp(ndarray) –Stacked s->p reflection coefficient.
Source code in hyperbolic_optics/sweep.py
reflectance
¶
Stacked power reflectance R vs thickness.
transmittance
¶
Stacked power transmittance T vs thickness.
total_absorption
¶
Stacked total interior absorption vs thickness.
layer_absorption
¶
Per-interior-layer absorptance, each stacked over thickness.
Returns a list (top->bottom) of {"index", "type", "absorptance"} where
absorptance has a leading thickness axis. Empty when there are no finite
interior layers. The swept layer's own absorptance varies with thickness.
Source code in hyperbolic_optics/sweep.py
transmission_coefficients
¶
Amplitude transmission coefficients, each stacked over thickness.