Repository navigation
Two-beam delay smearing for SHG FROG - #38
Open
chrisbrahms wants to merge 11 commits into
Open
chrisbrahms wants to merge 11 commits into
chrisbrahms wants to merge 11 commits into
Conversation
With two beams only the relative delay varies across the focus, so the smeared trace is the unsmeared one convolved along delay. shg_two_beam_kernel gives its width from the beam geometry, sigma = w0 sin(alpha) / (sqrt 2 c) with w0 the Gaussian focal waist (lambda d / (sqrt 2 pi D c) for small angles), as a SmearingKernel with no shape parameter; check_kernel refuses a shaped kernel for SHG. Both forward models convolve the unsmeared SHG trace, built with each arm's own propagator so that a crystal's arm drift is kept, and the smearing scale works as for PG/SD. Tests compare the model with a brute-force average over the focus, with and without a crystal, and NumPy with JAX. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
beam_geometry is the one place a session's beams come from, for the crystal and for the smearing: RetrieveParams gains beam_diameter_mm. With smearing on, an SHG trace gets the two-beam kernel at the pulse's wavelength (the measured spectrum's centroid, else the carrier), with the fixed width multiplier as for PG/SD; collinear beams have none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
For SHG data the Beam geometry group takes the beams' diameter and a switch for the delay smearing (the same switch as the mask group's, which is hidden for SHG), and reads out the width in rms and FWHM at the pulse's wavelength. The extras read-out reports SHG's width like PG/SD's. The visibility update runs once every group exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
- The width uses tan(alpha): each beam's profile across the crossing plane carries cos(alpha) (Taft et al. 1996, Eq. 7), which makes it exactly lambda d / (sqrt 2 pi D c). A test integrates two tilted beams for it. - The Baltuska figure is the same result (sigma_delta / sqrt 2), not a different one; the validity list names the crystal's angular acceptance. - A split smearing fit is refused for a kernel with no shape channel (two beams, SHG or SD), which it could not move. - The session fits the width only when there is a kernel (not for collinear SHG beams) and does not apply the mask's fixed multiplier to SHG. - The GUI enables SHG smearing only for crossing beams and a capable solver, keeps one smearing switch in both groups, unticks it for the focal mixture, hides the focal mixture for SHG, and greys the width fit without a kernel. - Tests no longer compare femtosecond widths in seconds within approx's default absolute tolerance; an end-to-end retrieval checks the kernel. - Solver docstrings, a settings comment, the module overview and the README describe the two-beam kernel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
- A focal mixture left on from PG/SD data is switched off, with a notice, when SHG data arrives: it cannot be modelled for SHG and its box is hidden. - The refused split fit is tested for the two-beam SD kernel in every solver that fits extras and in the covariance, documented in the split section and its table, and recorded as a changed behaviour. - The changelog gives the tan(alpha) width; the Baltuska match is stated for rms durations and 1/e^2 diameters. - The SHG smearing gate takes the solver's parameters, dropping an unreachable branch; a typo in the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX
This was referenced Nov 17, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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.
Important
This PR is part of a stack. Each PR builds on the one before it. Review and merge them in this order:
croak.crystalsand the forward modelsThis PR's base is #37's branch (
feature/shg-crystal-integration), so its diff shows only its own changes. Merge the PRs bottom-up. After each merge, retarget the next PR ontomain.What changed
The third part of #24: two-beam delay smearing for SHG FROG, with or without a crystal.
croak.smearing.shg_two_beam_kernelbuilds the delay blur of two crossing Gaussian beams. It takes the sameTwoBeamGeometrythe crystal uses, now with abeam_diameter. The RMS width is w0 tan α / (√2 c) = λd / (√2 π D c), after Taft et al. 1996. The forward models, the solvers andfit_smearingaccept this kernel for SHG.check_kernelrefuses a kernel with a shape parameter for SHG.fit_smearing_split) is refused for a kernel without a shape channel (sigma_p = 0). That covers the two-beam SD kernel and the new SHG kernel. Before, the shape multiplier could not move the trace, so it stayed at its start value and the covariance reported it as exact. The changelog records this underchanged.beam_diameter_mm. The kernel is built from the crystal's own beams at the pulse's wavelength, so phase matching and smearing cannot use different angles.Verification
uv run poe checkpasses on the final commit: the full suite at 100 % statement and branch coverage.uv run poe docsbuilds without warnings.Related
Part of #24. Stacked on #37.
Drafted by Claude (AI).
🤖 Generated with Claude Code
https://claude.ai/code/session_01WM2AxPM9w8Mg7mfKikaeCX