Fixed the stop root-finding problem for transmissive stop surfaces#170
Open
jacobdparker wants to merge 1 commit into
Open
Fixed the stop root-finding problem for transmissive stop surfaces#170jacobdparker wants to merge 1 commit into
jacobdparker wants to merge 1 commit into
Conversation
The reversed trace in `_calc_rayfunction_stops` propagates the solved stop rays back to the object by re-applying every surface from the stop backward. That is only correct when the stop is a mirror: reflection is an involution, so applying the stop surface to its own forward output turns the rays around exactly. A transmissive stop that modifies the rays (e.g. a transmission grating or a Fresnel zone plate) is not an involution — its diffraction was applied a second time instead of undone, which corrupted the computed field and pupil extents by an order of magnitude. For non-involutory stops, the stop's own diffraction/refraction is now included inside the root-finding problem (the solved variable becomes the pre-stop ray), and the stop's material and rulings are stripped on the reversed leg so only its geometry participates. A true time-reversed trace through transmissive rulings would require negating the diffraction order (reflective rulings are time-reversal symmetric with the same order); this approach sidesteps reversed traces through transmissive elements entirely. Adds a Fresnel-zone-plate regression test asserting that the recovered field half-angle matches arctan(sensor half-width / focal length). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/object-field-stop #170 +/- ##
======================================================
Coverage 99.36% 99.37%
======================================================
Files 116 116
Lines 6024 6053 +29
======================================================
+ Hits 5986 6015 +29
Misses 38 38
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.
Third PR in the stop-solver stack — stacked on #169 (the diff shown here is relative to that branch).
Problem
The reversed trace in
_calc_rayfunction_stopspropagates the solved stop rays back to the object by re-applying every surface from the stop backward. That only works when the stop is a mirror: reflection is an involution, so applying the stop surface to its own forward output turns the rays around exactly. A transmissive stop that modifies the rays — a transmission grating or a Fresnel zone plate — is not an involution: its diffraction was applied a second time instead of undone, corrupting the computed field extents by an order of magnitude (~20× for the FZP tutorial, #153).(For the record: a true time-reversed trace through transmissive rulings would require negating the diffraction order, while reflective rulings are time-reversal symmetric with the same order, because the
sign(direction · normal)factor inincident_effectiveflips along with the reflection. This PR sidesteps reversed traces through transmissive elements entirely instead.)Changes
_stop_is_involutorypredicate (mirrors and no-op vacuum surfaces qualify; surfaces with rulings or refraction do not)._ray_errornow takes explicitpropagators/transformation_lastarguments so callers control which surfaces are inside the solve.Tests
Adds
TestSequentialSystemFZP: a telescope whose only element is a transmissive Fresnel zone plate (HolographicRulingSpacing) acting as the pupil stop, asserting the recovered field half-angle equals arctan(sensor half-width / focal length) to 1e-3 deg.🤖 Generated with Claude Code