Metasurfaces API¶
metasurfaces
¶
Metasurface design by local periodicity: cell libraries, phase maps, focusing.
Each cell transmits as it would in an infinite array of itself, so its
zeroth-order Jones matrix from :mod:hyperbolic_optics.rcwa2d stands for it.
Layouts: :func:hyperbolic_optics.integrations.gdsfactory.metasurface_component.
Functions:
-
cell_library–Zeroth-order transmission Jones matrices of a batch of cells, at normal incidence.
-
choose_cells–The library entry at each site that best realises the target phase.
-
geometric_phase_jones–Ideal normal-incidence rotation
R·J·Rᵀ, with the lattice turning too. -
square_sites–Cell centres
[K, 2]of a square lattice inside a circular aperture about 0. -
lens_phase–φ = −(2π n/λ)(√(x² + y² + f²) − f): a plane wave focused atf. -
sample_grid–Site values on a square grid, each cell
subsamples²pixels, zero-padded. -
focus–A field on a uniform grid
[N, M]propagated bydistance_um(angular spectrum).
cell_library
¶
cell_library(
cell,
parameters,
lattice,
wavelength_um,
eps_incident,
eps_exit,
max_order=(4, 4),
batch_size=None,
**kwargs,
)
Zeroth-order transmission Jones matrices of a batch of cells, at normal incidence.
Parameters:
-
cell(Callable) –parameters → layers(:class:~hyperbolic_optics.rcwa2d.PatternedLayers from the incident side down), written injax.numpy. Every entry of the batch must give the same structure (layers, shapes, vertex counts); pad with zero-thickness layers to vary the number of layers. -
parameters–A batch
[P, ...](an array, or a pytree of arrays with a common leading axis). -
lattice–A :class:
~hyperbolic_optics.rcwa2d.Latticeor(Λx, Λy). -
batch_size(int | None, default:None) –Cells solved at once (
jax.lax.map); all at once if omitted. -
wavelength_um, eps_incident, eps_exit, max_order, **kwargs–As in :func:
hyperbolic_optics.rcwa2d.solve_crossed_grating.
Returns:
-
Array–t[P, 2, 2]([out, in], x/p and y/s), whose -
Array–|t|²·n_exit/n_incidentis the transmitted power. Differentiable in -
Array–parameters.
Source code in hyperbolic_optics/metasurfaces.py
choose_cells
¶
The library entry at each site that best realises the target phase.
Chooses argmax Re(a† t p · e^{−iφ}): the cell whose transmitted field,
projected on the analyzer a (by default the incident p), is largest
in phase with the target. Returns (indices [...], realised amplitude [...]).
Source code in hyperbolic_optics/metasurfaces.py
geometric_phase_jones
¶
Ideal normal-incidence rotation R·J·Rᵀ, with the lattice turning too.
Turning only a shape in a fixed lattice generally requires a new cell solve.
Source code in hyperbolic_optics/metasurfaces.py
square_sites
¶
Cell centres [K, 2] of a square lattice inside a circular aperture about 0.
Source code in hyperbolic_optics/metasurfaces.py
lens_phase
¶
φ = −(2π n/λ)(√(x² + y² + f²) − f): a plane wave focused at f.
Source code in hyperbolic_optics/metasurfaces.py
sample_grid
¶
Site values on a square grid, each cell subsamples² pixels, zero-padded.
Returns (coordinates [N], field [N, N]) with N = pad·(2n + 1)·subsamples
for sites within ±n pitches of the origin. Differentiable in values.
Source code in hyperbolic_optics/metasurfaces.py
focus
¶
A field on a uniform grid [N, M] propagated by distance_um (angular spectrum).