Express the stop rays in the object's local frame before flipping their direction - #198
Open
jacobdparker wants to merge 2 commits into
Open
Express the stop rays in the object's local frame before flipping their direction#198jacobdparker wants to merge 2 commits into
jacobdparker wants to merge 2 commits into
Conversation
Preserved from the fix/linear-weights-area-unit working tree when that branch was merged upstream as PR #194: the direction flip must be applied to the rays already expressed in the local coordinates of the object surface, since that is the frame in which _calc_rayfunction_input interprets the field and pupil coordinates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A finite-conjugate relay whose object surface is rotated 180 degrees about y, with a decentered circular aperture as the field stop. Without the object-local frame fix, the field bounds come back mirrored (field_min/field_max centered on -3 mm instead of +3 mm) and every traced ray vignettes at the field stop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #198 +/- ##
==========================================
+ Coverage 99.57% 99.61% +0.03%
==========================================
Files 118 118
Lines 6829 6947 +118
==========================================
+ Hits 6800 6920 +120
+ Misses 29 27 -2
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:
|
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.
Problem
_calc_rayfunction_stopscomputesobj.transformation.inverse(rays)but only uses the localized rays for the direction-flip test — the flip itself is applied toresult.outputs, which stays in global coordinates. Downstream,_calc_rayfunction_inputinterprets the field and pupil coordinates of the input grid in the object-local frame.Any system whose object surface carries a rotation therefore breaks two ways:
For a decentered field stop this vignettes every traced ray. Translation-only object transformations are unaffected, which is why existing tests never caught it. (Found via a MUSE spectrograph-only model whose object surface — the slit plane — is rotated 180° about$y$ to face the grating: all 35 slits vignetted completely.)
Changes
obj.transformation.inverse, apply the direction flip to the localized rays and store them back toresult.outputs, so the stop rays are expressed in the same frame the input grid is interpreted in.Tests
Adds$y$ with a decentered circular aperture as the field stop, running the full
TestSequentialSystemRotatedObject: a finite-conjugate relay whose object surface is rotated 180° aboutAbstractTestAbstractSequentialSystembattery plus two focused assertions (field bounds match the decentered aperture in the object-local frame; a healthy fraction of rays reaches the sensor). Both focused tests fail onmainand pass with the fix; the full_sequential_test.pyfile (509 tests) passes.🤖 Generated with Claude Code