grating_interf op• Data kinds: table → table
• Call: import fullseye as fs; fs.ledger.dpc_integrate(dpc_rad, pixel_um, distance_mm, analyzer_period_um, wavelength_nm=None, energy_kev=None, axis=1, baseline='left', baseline_px=8, delta=None) (to call the implementation directly, import gratinginterf; gratinginterf.dpc_integrate(dpc_rad, pixel_um, distance_mm, analyzer_period_um, wavelength_nm=None, energy_kev=None, axis=1, baseline='left', baseline_px=8, delta=None); from the registry, opsoptics.get("dpc_integrate"))
Integrates the differential phase (fringe phase shift φ) along the grating's sensitive direction back to the wavefront phase Φ [rad].
> The detailed description below is the original text — the summary and the headings are translated.
屈折角 α = φ·p2/(2π d)(Weitkamp ら 2005 の式 1)、∂Φ/∂x = (2π/λ)·α。画素の中で平均した α を画素の幅で足すと、画素の境界での Φ が出る(np.cumsum)。返すのは隣り合う境界の平均(画素の中心)。dpc_rad は 2-D の図か、grating_three_image_retrieve の返り値(表。dpc_rad を取り出す)。delta(屈折率の 1 からのずれ δ)を渡すと、投影の厚さ t = −Φ·λ/(2π δ) [µm] も返す。
積分の定数(と、基準と試料の間の格子のずれによる微分位相の一定のずれ)は baseline で決める:
"left" 各行の最初の baseline_px 画素(試料の無い縁)で Φ = 0
"both" 両端の baseline_px 画素で Φ = 0 になるように、行ごとに一次式を引く
(微分位相の一定のずれ = 位相の傾きを消す。試料が両端に掛からないことが前提)
"none" 何も引かない(最初の境界で Φ = 0)
★折り返し(fail-closed): 微分位相は (−π, π] に折り返されている。本当の φ が π を超えた画素では隣と 2π 近く跳ぶ。積分の向きに隣り合う画素の差が π(Itoh の条件。数学で決まる値なのでつまみにしない)を超える画素が 1 つでもあれば、どれだけ足すべきか決まらないので値を返さずに拒否する(縞の位相を大きくしない —— 距離 d を短くするか、細かい画素で撮る)。NaN(grating_three_image_retrieve の無効画素)も拒否する。
正直な限界: 折り返しは「隣との跳び」でしか見えない。平らな背景の隣にある 1 画素だけが π を超え、折り返した値が背景と π 以内に収まる場合(縁の 1 画素など)は、折り返した図だけからは見分けられない(本当の跳びが π を超える = 標本化が足りない、という Itoh の条件の外)。
返り値 dict: phase_rad(H, W)/ thickness_um(δ があるとき)/ refraction_urad / max_jump_rad(実測の隣との差の最大)/ baseline。Raises ValueError: 2-D でない・NaN/Inf、正でない画素・距離・周期・波長、wavelength_nm と energy_kev の両方 / どちらも無い、axis が 0/1 でない、未知の baseline、baseline_px が幅の半分を超える、δ ≤ 0、隣との差が π を超える。
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.
• grating_interferometry — py -3.11 examples/grating_interferometry.py
• poc_grating_interferometry — py -3.11 examples/poc_grating_interferometry.py
table as input)abcd_matrix · wavefront_stats · sfr_from_edge · paraxial_trace · seidel_coefficients · spot_stats · tolerance_analysis · wavefront_from_opd
grating_interf)talbot_grating_design · grating_stepping_simulate · grating_three_image_retrieve · darkfield_scatter_relation · talbot_carpet · talbot_source_visibility · grating_step_period_estimate
*Provenance: gratinginterf.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.