Add optika.systems.LinearSystem, a linear forward-model approximation to SequentialSystem#152
Open
roytsmart wants to merge 8 commits into
Open
Add optika.systems.LinearSystem, a linear forward-model approximation to SequentialSystem#152roytsmart wants to merge 8 commits into
optika.systems.LinearSystem, a linear forward-model approximation to SequentialSystem#152roytsmart wants to merge 8 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
==========================================
+ Coverage 99.54% 99.55% +0.01%
==========================================
Files 116 118 +2
Lines 6374 6553 +179
==========================================
+ Hits 6345 6524 +179
Misses 29 29
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:
|
roytsmart
force-pushed
the
feature/interpolated-system
branch
from
July 6, 2026 16:36
4b5ad3a to
c625f4b
Compare
roytsmart
force-pushed
the
feature/interpolated-system
branch
from
July 21, 2026 22:16
23ec8b0 to
33b7cd0
Compare
Rewrite the `AbstractLinearSystem` docstring to describe the full linear forward model (distortion, effective area, and optional vignetting/field stop) instead of the stale "define a distortion/vignetting method" text, and add a `LinearSystem` class docstring with a `jupyter-execute` example that assembles the component models and images a USAF-1951 target, mirroring the `SequentialSystem` example. Also document the `shape` property, clarify that `image()` expects energy spectral radiance, and add a Features bullet for the linear forward model. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CtdKmedevWkDab6BWupXqQ
optika.systems.InterpolatedSystem as an approximation to SequentialSystem.optika.systems.LinearSystem, a linear forward-model approximation to SequentialSystem
Fit the system's distortion, vignetting, and effective area models and assemble them (with the sensor) into a `LinearSystem`. The `pupil` argument is interpreted as cell vertices: the effective area fit uses the vertices to compute pupil cell areas, while the distortion and vignetting fits trace at the corresponding cell centers. The field stop is not modeled, so `field_stop` is left `None`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CtdKmedevWkDab6BWupXqQ
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
optika.systems.LinearSystem(and its abstract baseAbstractLinearSystem), a fast linear forward model that approximates aSequentialSystem.Instead of raytracing every scene, a
LinearSystemis characterized once by a set of precomputed models:distortionmodel mapping object-plane coordinates onto the detector,area_effective(effective area) model,vignettingandfield_stopmodels,sensor.image()maps a scene's energy spectral radiance to detector electrons by conservatively regridding it through the distortion model, weighting each cell by the effective area, vignetting, and field stop, then applying the sensor's exposure model. The expensive conservative-regridding operator is built once inweights()and reused byimage_from_weights(), so many scenes can be imaged through the same optics cheaply.Supporting changes
Shapedon the calibration models.AbstractDistortionModel,AbstractVignettingModel, andAbstractEffectiveAreaModelnow inherit theShapedmixin, withshapeimplemented on the concrete models (SimpleDistortionModel,PolynomialDistortionModel,PolynomialVignettingModel,InterpolatedEffectiveAreaModel). Each returns the model's batch shape (excluding the wavelength/field domain axes), which is what letsLinearSystem.shapereport the system's parametrization.Plottable/DxfWritablefromAbstractSystemtoAbstractSequentialSystem. ALinearSystemhas no geometry to plot or export to CAD, so the commonAbstractSystembase no longer forces those mixins; the geometricSequentialSystemkeeps them.Tests
_linear_test.pyaddsTestLinearSystemwith two fixtures (a minimal system, and one with vignetting and a field stop), drivingimage()end-to-end with noise on and off, plus the model interface. The distortion/vignetting/effective-area test bases gainedshapecoverage.Docs
LinearSystemhas a runnable.. jupyter-execute::example that assembles the component models and images a USAF-1951 target, mirroring theSequentialSystemexample.AbstractLinearSystemdocuments the full model, and a Features bullet was added to the landing page.Follow-ups (known limitations)
image(): the size-1 wavelength axis is dropped and the regridding cannot align the weights.LinearSystem.imageexpects energy spectral radiance, whereasSequentialSystem.imagetakes photon radiance; the twoimage()methods disagree on units.🤖 Generated with Claude Code
https://claude.ai/code/session_01CtdKmedevWkDab6BWupXqQ