Repository navigation
Conversation
A detector keeps the hits of earlier solves, such that several sources solved one after another superpose. The hits however referred to the traced beam: `RayHit`/`PolarizedRayHit` to its ray, the beamlet hits to the beamlet and a segment index. `solve_system!` reuses the beam, its first ray and its vectors of rays, and moving a beam moves its first ray, hence solving the same beam again without initializing changed the stored hits: e.g. the field of a `GaussianBeamletHit` on the second segment of a beamlet dropped from 690 to 17 V/m after the beamlet was solved again with a moved mirror. Affected were hits on the first ray of every beam type and hits of beamlets on later rays. The hits now store `detached_copy`s: of the ray for ray hits, of the whole beamlet (with copies of its parent beamlets) for beamlet hits. The copies share the `Intersection`s, which are not changed after the tracing step that computes them. Copying the whole beamlet, not only the segments up to the hit, keeps the hits of intermediate segments (e.g. built by the OpticsBase extension) as they were. Solving a beamlet onto a detector through three lenses takes 1-4 % longer and allocates 29 % more for beamlets. Fixes #42
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd7ba007eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| struct RayHit{T} <: AbstractRayHit{T} | ||
| ray::Ray{T} | ||
| opl::T | ||
| RayHit(ray::Ray{T}, opl::Real) where {T} = new{T}(detached_copy(ray), opl) |
There was a problem hiding this comment.
Update detector-hit lifecycle guidance
The snapshotting introduced here makes the statement in skills/beamletoptics/WORKFLOW.md:46 that detector hits “reference beam state” and must be read before solving again false; the Detector docstring retains the same obsolete warning. Update that user-facing guidance to distinguish safe re-solves from the remaining caveat about evaluating old hits after moving the detector, otherwise the version-matched agent skill teaches behavior this commit intentionally removed.
AGENTS.md reference: AGENTS.md:L103-L112
Useful? React with 👍 / 👎.
The hits are copies since the previous commit: solving again or moving a beam or another object no longer changes them. What remains is that the hits are stored in world coordinates while `spot_diagram`, `electric_field` and `PlaneField(detector)` evaluate them in the current pose of the detector, hence they are read before the detector itself is moved. Updated: the `Detector` docstring, the `PlaneField(detector)` docstring of the OpticsBase extension and the agent skill (`WORKFLOW.md`).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #138 +/- ##
==========================================
+ Coverage 89.22% 89.34% +0.12%
==========================================
Files 81 81
Lines 4500 4516 +16
==========================================
+ Hits 4015 4035 +20
+ Misses 485 481 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Replaced by #164 |
A detector keeps the hits of earlier solves, such that several sources solved one after another superpose. The hits however referred to the traced beam:
RayHit/PolarizedRayHitto its ray, the beamlet hits to the beamlet and a segment index.solve_system!reuses the beam, its first ray and its vectors of rays, and moving a beam moves its first ray, hence solving the same beam again without initializing changed the stored hits: e.g. the field of aGaussianBeamletHiton the second segment of a beamlet dropped from 690 to 17 V/m after the beamlet was solved again with a moved mirror. Affected were hits on the first ray of every beam type and hits of beamlets on later rays.The hits now store
detached_copys: of the ray for ray hits, of the whole beamlet (with copies of its parent beamlets) for beamlet hits. The copies share theIntersections, which are not changed after the tracing step that computes them. Copying the whole beamlet, not only the segments up to the hit, keeps the hits of intermediate segments (e.g. built by the OpticsBase extension) as they were.Solving a beamlet onto a detector through three lenses takes 1-4 % longer and allocates 29 % more for beamlets.
Fixes #42.