polarization op• Data kinds: none → cimage (an op determined by its arguments alone — it takes no image or data input)
• Call: import optics; optics.jones_element(kind='polarizer', angle_deg=0.0, retardance_deg=90.0) (or opsoptics.get("jones_element"))
A 2x2 complex Jones matrix for one polarisation element.
*kind* is one of :data:JONES_KINDS:
`"polarizer"` ideal linear polariser, transmission axis at *angle_deg*
from x · `"retarder"` linear retarder, fast axis at *angle_deg*,
retardance *retardance_deg* · `"quarter_wave" / "half_wave"`
retarders with the retardance fixed at 90 / 180 degrees (*retardance_deg*
is then ignored — stated here so a caller who passes one is not left
wondering) · `"rotator"` optical rotator turning the polarisation by
*angle_deg*.
The retarder is written symmetrically, `diag(exp(-i*d/2), exp(+i*d/2))`
before rotation, so it introduces no common phase — the fast axis leads.
Elements are built as `R(+a) @ J0 @ R(-a)`.
Returns a `(2, 2)` complex128 matrix acting on a Jones vector
`[Ex, Ey]; compose a train with J_total = J_last @ ... @ J_first` and
apply it with :func:jones_apply.
Ground truth it reproduces exactly (machine precision): two crossed ideal
polarisers multiply to the zero matrix; a polariser is idempotent
(`P @ P == P`); a half-wave plate is an involution up to a global phase
(`H @ H == -I` in this symmetric convention); a quarter-wave plate at 45
degrees turns horizontal linear light into circular (`|S3| == 1`); the
Malus law `cos^2(theta)` falls out of two polarisers at relative angle
theta.
Raises `ValueError`: an unknown *kind* (the message lists the valid
ones); non-finite *angle_deg* or *retardance_deg*.
Ideal, lossless, normal-incidence elements. A real polariser has a finite
extinction ratio and a real waveplate is chromatic; neither is modelled, and
neither is silently approximated. Jones algebra can only carry **fully
polarised** light — for partial polarisation use :func:mueller_element.
Every optics op validates its input before computing (nothing slips through silently):
• Units are baked into the argument name — _mm / _um / _deg / _mrad. Confusing mm with µm does not crash; it yields a plausible-looking wrong answer, so the name prevents it. Nothing here guesses the unit from the magnitude.
• **Strings raise ValueError** — float('50') succeeds, so an unparsed configuration value would slip through as a length (measured: thin_lens('50', '200') returned a plausible 66.667 mm). bool is refused too, as the implicit promotion True == 1.
• **complex / masked arrays raise ValueError (real-valued slots only; silently dropping the imaginary part or peeling off the mask is refused). NaN/Inf raises ValueError on every input.**
• Division by zero and its relatives are refused by name: focal length 0, radius of curvature 0, refractive index <= 0, a fully opaque aperture (all zeros, so the normalisation is 0/0), a PSF whose sum is <= 0, a Stokes vector with S0 = 0, and an object sitting at the front focal point (the image is at infinity).
• Only two ops return a non-finite value, and both state it as a contract: depth_of_field returns far_mm = inf beyond the hyperfocal distance (that is what the hyperfocal distance means), and gaussian_beam returns wavefront_radius_mm = inf at the waist (the radius of curvature of a plane wavefront). Both also return a finite companion (far_is_infinite / curvature_per_mm). **Any other silent NaN/Inf is detected internally and raises ValueError** — "float64 overflowed" and "the answer is infinite" are different claims, so the first is never returned wearing the face of the second.
• Size caps: generated grids are capped by optics.MAX_GRID (4096); supplied fields/PSFs/apertures by optics.MAX_FIELD_ELEMENTS (2^24); ABCD element chains by optics.MAX_SYSTEM_ELEMENTS (1024); Zernike by MAX_ZERNIKE_TERMS (512) / MAX_ZERNIKE_ORDER (40) / MAX_ZERNIKE_BASIS (2^25). This closes, fail-closed, the paths where a small argument triggers a huge internal allocation (measured: n_max=40 × 4096² needs 108 GB).
• Physically impossible states are refused too: a Stokes vector with degree of polarisation > 1, negative transmittance, negative intensity, and invalid Zernike indices such as n-|m| odd.
• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).
• Operator provenance and references — the sources of the research/methods this op family came from.
• The canonical algorithm (author, year) and its uses are named in the family usage guide above.
• optics_imaging — py -3.11 examples/optics_imaging.py
cimage as input)angular_spectrum_propagate · jones_apply
polarization)jones_apply · stokes_from_jones · mueller_element · mueller_apply · stokes_analyze
*Provenance: optics.py — OPTICS operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.