Skip to content

Added SequentialSystem.vignetting(), a method to fit a polynomial vignetting model#184

Merged
roytsmart merged 3 commits into
mainfrom
feature/system-vignetting
Jul 11, 2026
Merged

Added SequentialSystem.vignetting(), a method to fit a polynomial vignetting model#184
roytsmart merged 3 commits into
mainfrom
feature/system-vignetting

Conversation

@roytsmart

Copy link
Copy Markdown
Collaborator

Replaces #183, which GitHub closed when its base branch (feature/system-distortion, #181) was squash-merged and deleted; the branch is rebased onto main so only the vignetting commits remain.

Summary

  • Add AbstractSequentialSystem.vignetting(), the vignetting counterpart of distortion(): the relative illumination at each scene coordinate is estimated from the fraction of unvignetted rays in the pupil, normalized so that its average over the field of view is unity, and fit with an optika.radiometry.PolynomialVignettingModel.
  • Same interface as distortion(): custom wavelength/field/pupil grids (traced with rayfunction(), so grids left as None inherit the corresponding component of grid_input), normalized_field/normalized_pupil flags, polynomial degree, and a clear ValueError when the wavelength grid has no logical axis.
  • The grid resolution and axis normalization shared between the two methods is factored into a private _rayfunction_and_axes() helper instead of duplicating ~30 lines.

Tests

test_vignetting mirrors test_distortion: parametrized over both grid sources and two polynomial degrees, asserting the model type, degree, the scalar-wavelength error branch, non-negative illumination, and that the illumination averages to unity over the field axes.

pytest optika/systems/_sequential_test.py -k "test_vignetting or test_distortion": 48 passed; black --check and ruff check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Lm9SxSpyNg9hx8dNL9pUXc

roytsmart and others added 2 commits July 11, 2026 10:07
…tting model

The relative illumination at each scene coordinate is estimated from
the fraction of unvignetted rays in the pupil, normalized to its
maximum over the field of view, and fit with a
PolynomialVignettingModel.

The grid resolution and axis normalization shared with distortion() is
factored into a private helper, _rayfunction_and_axes().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lm9SxSpyNg9hx8dNL9pUXc
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.37%. Comparing base (db4ccce) to head (db21db6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #184   +/-   ##
=======================================
  Coverage   99.37%   99.37%           
=======================================
  Files         116      116           
  Lines        6230     6257   +27     
=======================================
+ Hits         6191     6218   +27     
  Misses         39       39           
Flag Coverage Δ
unittests 99.37% <100.00%> (+<0.01%) ⬆️

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.

Pass where to PolynomialVignettingModel so that field points with no
unvignetted rays are excluded from the polynomial fit, and compute the
unity normalization from the average over only the included points.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lm9SxSpyNg9hx8dNL9pUXc
@roytsmart roytsmart merged commit a727eb0 into main Jul 11, 2026
12 checks passed
@roytsmart roytsmart deleted the feature/system-vignetting branch July 11, 2026 20:41
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