Skip to content

Add beam-footprint utilities and PSF metrics for the wavefield path#174

Open
jacobdparker wants to merge 1 commit into
feature/wavefieldsfrom
feature/wavefield-footprint
Open

Add beam-footprint utilities and PSF metrics for the wavefield path#174
jacobdparker wants to merge 1 commit into
feature/wavefieldsfrom
feature/wavefield-footprint

Conversation

@jacobdparker

Copy link
Copy Markdown
Contributor

Summary

Stacked on #173. Promotes the patterns proven while modeling ESIS into general utilities, so a physical-optics model of a real (multi-channel, obscured) instrument is a few lines instead of a page:

  • SequentialSystem.footprint(surface, ...): positions where a dense pupil grid of rays traced through the entire system (all masks active) intersects a given surface, in local surface coordinates, plus the mask of rays that reach the sensor - i.e. the used portion of each optic. Useful for geometric work independently of wavefields.
  • optika.apertures.footprint_aperture(position, where): a PolygonalAperture from the convex hull of a footprint - the constructor for an effective channel pupil (e.g. the sector of the ESIS primary delimited by the obscuration hub, the octagon edge, and the projected grating trapezoid).
  • wavefield(bound="footprint", padding_relative=..., padding_absolute=...): automatic per-surface sampling regions from the beam footprint. The absolute padding floor handles intermediate-focus surfaces, where the geometric footprint collapses to a point but the diffraction pattern needs a finite window.
  • PSF metrics (optika.wavefields.encircled_energy_radius, ensquared_energy, fwhm): image-quality numbers that were previously recomputed by hand for every analysis; ensquared_energy is the natural pixel-limited criterion. Validated against an analytic Gaussian, including broadcasting over extra axes.
  • A jupyter-execute example on SequentialSystem.psf (footprint-bounded Huygens PSF of a parabolic telescope).
  • scipy promoted from transitive to explicit dependency (scipy.spatial.ConvexHull).

Validation

Reproducing the hand-built ESIS f1 channel model through this API (footprint + footprint_aperture + bound="footprint" with padding_absolute=50 um) matches the reference results: image centroid within 0.13 um of the geometric raytrace and EE50 = 3.97 um vs the 3.98 um reference.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.98995% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.62%. Comparing base (60267ad) to head (3010b30).

Files with missing lines Patch % Lines
optika/wavefields/_metrics.py 95.52% 3 Missing ⚠️
optika/apertures/_apertures.py 95.83% 1 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/wavefields     #174      +/-   ##
======================================================
- Coverage               98.64%   98.62%   -0.02%     
======================================================
  Files                     127      129       +2     
  Lines                    6849     7046     +197     
======================================================
+ Hits                     6756     6949     +193     
- Misses                     93       97       +4     
Flag Coverage Δ
unittests 98.62% <97.98%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- SequentialSystem.footprint(): the positions where a dense grid of rays
  traced through the entire system intersects a given surface, in local
  surface coordinates, with a mask selecting rays that reach the sensor.
- optika.apertures.footprint_aperture(): a PolygonalAperture from the
  convex hull of a footprint, for building the effective pupil of one
  channel of a multi-channel instrument.
- SequentialSystem.wavefield(bound="footprint"): automatic per-surface
  sampling regions from the beam footprint, padded by a relative fraction
  and an absolute minimum (which handles intermediate-focus surfaces).
- optika.wavefields.encircled_energy_radius / ensquared_energy / fwhm:
  image-quality metrics of sampled point-spread functions, validated
  against an analytic Gaussian.
- jupyter-execute example on SequentialSystem.psf demonstrating the
  footprint-bounded Huygens PSF of a parabolic telescope.

Validated end-to-end on the ESIS flight-1 design: the channel pupil built
from footprint() + footprint_aperture() with bound="footprint" matches
the geometric image centroid to ~0.1 um and reproduces the expected
diffraction-limited EE50.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jacobdparker jacobdparker force-pushed the feature/wavefield-footprint branch from 79bcb98 to 3010b30 Compare June 15, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant