Add optika.vignetting.PolynomialVignettingModel#155
Merged
Conversation
Introduce the `optika.vignetting` subpackage, which maps scene coordinates (wavelength + field position) to the fraction of light transmitted by the optical system: - `AbstractVignettingModel` defines the `__call__` interface and an `inverse` (1 / transmission) helper. - `AbstractInterpolatedVignettingModel` adds the calibration-point interface (`coordinates_scene`, `transmission`, axes). - `PolynomialVignettingModel` fits a mean-centered polynomial to the measured transmission, exposed via the public `fit` property, and provides `plot_residual()` to visualize the fit residual vs. field angle with a subplot per wavelength. Register the subpackage in `optika/__init__.py` and add tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #155 +/- ##
==========================================
+ Coverage 99.29% 99.31% +0.01%
==========================================
Files 111 114 +3
Lines 5537 5675 +138
==========================================
+ Hits 5498 5636 +138
Misses 39 39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Plot the calibration transmission as a function of field angle (one subplot per wavelength), mirroring `plot_residual`. Factor the shared plotting machinery into a private `_plot` helper used by both methods, and demonstrate `plot()` in the class example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Make `AbstractVignettingModel.__call__`/`inverse` accept `na.SpectralPositionalVectorArray` instead of `optika.vectors.SceneVectorArray`, matching the distortion models so scene coordinates share one named-arrays vector type across both. Updates the example, plots, and tests accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Adds the
optika.vignettingsubpackage for mapping scene coordinates (wavelength + field position) to the fraction of light transmitted by the optical system. Mirrors the structure ofoptika.distortion(#154).AbstractVignettingModel— defines the__call__(coordinates) -> scalarinterface (the transmitted fraction) plus aninverse(coordinates)helper returning1 / transmission(the vignetting-correction factor).inverseis defined on the abstract base since it only depends on the forward call.AbstractInterpolatedVignettingModel— adds the calibration-point interface (coordinates_scene,transmission,axis_wavelength,axis_field).PolynomialVignettingModel— fits a mean-centered polynomial to the measured transmission (center = scene.mean(axis_scene)), exposed via the publicfitcached property, and providesplot_residual()to visualize the absolute fit residual vs. field angle with a subplot per wavelength (auto-sized figure,figsize/cmap/vmin/vmaxarguments).Registers the subpackage in
optika/__init__.py.Testing
pytest optika/vignetting/_vignetting_test.py— 22 passed (call, inverse, fit, properties, andplot_residualacrossdegree∈ {1, 2}).black --checkandruff checkclean.🤖 Generated with Claude Code