Add optika.wavefields: physical-optics propagation through a SequentialSystem#173
Open
jacobdparker wants to merge 6 commits into
Open
Add optika.wavefields: physical-optics propagation through a SequentialSystem#173jacobdparker wants to merge 6 commits into
jacobdparker wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## feature/zernike-sag #173 +/- ##
=======================================================
- Coverage 99.37% 98.64% -0.74%
=======================================================
Files 120 127 +7
Lines 6248 6849 +601
=======================================================
+ Hits 6209 6756 +547
- Misses 39 93 +54
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…eld kernel Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Surface.wavefield_samples generates stratified random samples of a surface's aperture, Surface.propagate_wavefield evaluates the Rayleigh-Sommerfeld integral between surfaces, and SequentialSystem.wavefield/psf orchestrate the propagation from the source through every surface to the sensor. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The ruling phase function is evaluated by integrating the local groove density along the chord from the local origin to each sample point with Gauss-Legendre quadrature, which is exact for constant ruling spacing and accurate for smooth variable-line-spacing profiles. Validated against the geometric raytrace of a concave grating in first order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Surfaces near an intermediate focus concentrate the wavefield in a region much smaller than their aperture, so the sampling region must be restricted for the field to be resolved. The new bound parameter of SequentialSystem.wavefield (and Surface.propagate_wavefield) allows this. Also document that brute-force Rayleigh-Sommerfeld propagation is only well-sampled between near-conjugate surfaces, and add an end-to-end demo computing the Huygens PSF of the ESIS flight-1 design. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Update the wavefield test to construct ZernikeSag with `base=` after the attribute was renamed from `sag` on the parent branch. - Reformat the new wavefield modules with the current `black` stable release (parenthesized union types, collapsed short calls). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4f496ec to
8455e8d
Compare
5e98d24 to
60267ad
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #172 (which is stacked on #171; will retarget as they merge). The aperture-bounds fix in #171 is required for correct sampling of apertures with internal transformations (covered by a regression test here).
Adds a physical-optics path that mirrors the geometric raytrace: the complex scalar field is sampled on every surface with stratified random samples and propagated surface-by-surface with the Rayleigh-Sommerfeld (RS-I) diffraction integral, producing Huygens PSFs on the sensor.
optika.wavefields:WavefieldVectorArray(complex amplitude, position, surface normal, sample area; transformation dunders mirrorRayVectorArray) andrayleigh_sommerfeld(), a chunked, numexpr-fused kernel whose peak memory is bounded bychunk_size x N_src x 16 Binstead of the full N_src x N_dst outer product.Surface.wavefield_samples/propagate_wavefield: stratified random sampling of each aperture (viana.Cartesian2dVectorStratifiedRandomSpace, which converts aliasing into broadband noise), with an optional per-surfaceboundto window surfaces near an intermediate focus.2 pi m N(r)is applied at each sample, with the groove-counting functionN(r)computed as a Gauss-Legendre line integral of the local groove density - exact for polynomial (VLS) ruling spacings and consistent with the sign convention ofoptika.rulings.incident_effective.SequentialSystem.wavefield/psf: orchestration over the surface chain, plane- or spherical-wave initial conditions from the system object, and a sensor grid auto-centered on the geometric image centroid.The docstring Notes document the key sampling constraint: the brute-force RS sum is only well-sampled between near-conjugate surfaces; flat masks in collimated space are better folded into the pupil than treated as propagation steps.
Validation
🤖 Generated with Claude Code