Skip to content

Bugfix: GaussianBeamlet phase in media and behind lenses - #133

Merged
StackEnjoyer merged 7 commits into
masterfrom
fix/gaussian-beamlet-phase
Oct 16, 2026
Merged

StackEnjoyer merged 7 commits into
masterfrom
fix/gaussian-beamlet-phase

Conversation

@StackEnjoyer

@StackEnjoyer StackEnjoyer commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Bugfixes

  • Changes results: Gouy phase of a GaussianBeamlet restarted at every lens, 90° off behind one lens
  • Changes results: inside glass the phase of a GaussianBeamlet advanced with the vacuum wavenumber
  • Changes results: gauss_parameters(gb, z): ψ jumped at every lens, now collected as for astigmatic beamlets
  • electric_field(gauss, r, z): an element behind the point changed the phase in front of it

Doc changes

  • gauss_parameters, electric_field: ψ is the Gouy phase collected along the beam
  • Agent skill: CONVENTIONS.md updated

Internal changes

  • GaussianBeamletHit caches optical path and Gouy phase in front of its segment

Closes #125, closes #126

Hugo Uittenbosch and others added 2 commits October 7, 2026 23:56
electric_field(gauss, r, z) added the optical path of the whole beam, so an
element behind the evaluated point changed the phase in front of it, and
inside a medium the phase advanced with the vacuum wavenumber. The optical
path is now taken up to the evaluated point and the wavenumber of the medium
is used along and across the beam. GaussianBeamletHit caches the optical
path in front of its segment. Fields on the last segment in air are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The field took the Gouy phase relative to the waist of the current segment,
so the phase collected in front of a lens was lost: 20 mm behind an f = 50 mm
lens it was 88.5 deg instead of the -1.5 deg of the ABCD law. The field now
adds the steps of the local Gouy phase at every surface and from a parent to
its children, GaussianBeamletHit caches the sum. gauss_parameters keeps
returning the phase relative to the local waist. Changes the absolute phase
behind focusing optics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@StackEnjoyer StackEnjoyer added this to the v0.14.0 milestone Oct 8, 2026
@StackEnjoyer
StackEnjoyer requested a review from TacHawkes October 8, 2026 10:47
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.08%. Comparing base (2204bae) to head (dc7626d).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #133      +/-   ##
==========================================
+ Coverage   89.81%   90.08%   +0.26%     
==========================================
  Files          82       82              
  Lines        4525     4577      +52     
==========================================
+ Hits         4064     4123      +59     
+ Misses        461      454       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@StackEnjoyer StackEnjoyer added the bug Something isn't working label Oct 8, 2026
Hugo Uittenbosch and others added 5 commits October 15, 2026 11:16
gauss_parameters(gb, z) returned the Gouy phase relative to the waist of the
local segment, which jumps at every lens, while gauss_parameters(agb, z) and
the field of both models collect it along the beam. It now returns the
collected phase as well: continuous at every surface and from a parent to its
children, equal to the Gouy phase of electric_field. The local parameters are
computed by _local_gauss_parameters, which the field and _gouy_before use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…c model

The Gouy phase behind one and two lenses, the ψ of gauss_parameters and the
phase across the beam in the glass are compared with analytic ABCD values
instead of the AstigmaticGaussianBeamlet, which is another result of BMO.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
It uses only w and w0, which do not depend on the Gouy phase, so it needs
no local kernel. _local_gauss_parameters stays for _gouy_before (which
gauss_parameters calls) and for the field per detector pixel, where the hit
caches the collected Gouy phase.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The kernel _local_gauss_parameters is replaced by a positional method of
gauss_parameters that adds the offset ψ0 to the Gouy phase relative to the
local waist. Its body is the one of master apart from that. The public
gauss_parameters(gauss, z) passes the collected Gouy phase in front of the
segment, _gouy_before passes 0, and the field per detector pixel passes the
phase that the hit cached.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@StackEnjoyer
StackEnjoyer merged commit fdbbf27 into master Oct 16, 2026
7 checks passed
@StackEnjoyer
StackEnjoyer deleted the fix/gaussian-beamlet-phase branch October 16, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: GaussianBeamlet phase is wrong in and before a medium Bug: GaussianBeamlet restarts the Gouy phase behind a lens

1 participant