Repository navigation
Window the spectrum and the trace independently; fix post_filter for SHG - #29
Open
chrisbrahms wants to merge 9 commits into
Open
chrisbrahms wants to merge 9 commits into
chrisbrahms wants to merge 9 commits into
Conversation
The fundamental spectrum was windowed by the trace's λm mapped through omega0_scale, so for SHG a trace window cut the spectrum at twice its wavelength and vice versa. load_and_clean now takes lams_lims for the spectrum (default: its full extent) and TraceData offers fundamental_window for windowing the retrieved field. Refs LupoLab#23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
apply_post_filter and the retrieve stage passed the trace window lamm_lims to post_filter, which measures it from the fundamental carrier. For SHG the window then lay above the grid and removed the whole spectrum. Both now use TraceData.fundamental_window. Refs LupoLab#22 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
PreprocParams gains lams_min_nm/lams_max_nm (None: the spectrum's full extent, which is also how older options files read back), seeded from the loaded spectrum and dropped with it. The Prepare stage gets a λs control next to λm. Refs LupoLab#23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
auto_third_order_exponent takes trace_window and spectrum_window in place of the shared window, and the marginal-check stage has one control for each. For SHG the spectrum lies an octave below the marginal, so a shared region could not hold both. Refs LupoLab#23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
- Reject a spectrum window that is reversed, empty or misses the spectrum, and fall back to the full extent when a replaced spectrum would clamp the kept window to zero width. - Raise on a half-set window in a session; take the PG/SD fallback from the interaction rather than comparing carriers. - Native-grid simulated loads window the field to the signal band. - The retrieve stage's spectral post-filter is off, and says why, when there is no window at the fundamental (SHG without a spectrum). - Regression tests through the session pipeline and the retrieve stage that fail if the trace window is passed again; drop a test that could not fail. - Name which trust window an error refers to; say that PG/SD sessions that narrowed λm lose their spectrum taper on reload. Refs LupoLab#22, LupoLab#23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
…0-1000 nm For PG and SD the trace window is the signal's measured support at the fundamental, so the post-filter keeps using it; the spectrum window serves SHG only. A measured spectrum's trust region defaults to its range within 190-1000 nm, as the shared region did, or its full range outside that band. Refs LupoLab#22, LupoLab#23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
- The spectrum window check uses filter_spectrum's open band and rejects a window without positive intensity. - The retrieve stage refreshes the spectral post-filter's availability on re-entry, so a re-prepared trace cannot leave it stale. - Text that called λs the post-filter window now says so for SHG only. - A native-grid simulated spectrum's window is its full extent. - Tests for the spectrum trust-window message and the simulated entry. Refs LupoLab#22, LupoLab#23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL
2 tasks
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.
What changed
The spectrum gets its own window (#23).
load_and_clean(..., lams_lims=None)windows the independent fundamental spectrum by its own wavelength range, stored asTraceData.lams_lims. Before, the spectrum was cut by the trace window λm mapped through the interaction's carrier scaling, so an SHG spectrum was cut at twice the trace window.Nonemeans the spectrum's full extent. Sessions gainlams_min_nmandlams_max_nm(default unset), and the Prepare stage gains a λs range control, seeded from the loaded spectrum.post_filterno longer removes an SHG result (#22). The session pipeline and the retrieve stage now window the retrieved field withTraceData.fundamental_window: for SHG, λs (or the full grid when it is unset); for PG and SD, λm as before. Before, SHG was given the trace-domain window, which lies at the second harmonic. A regression test covers SHG; PG and SD keep their behaviour.The marginal check has a trust region for each marginal (#23).
auto_third_order_exponenttakestrace_windowandspectrum_windowin place ofwindow, and the marginal-check stage has two range controls. A measured spectrum's region in the GUI still defaults to 190–1000 nm, or to its full range if it lies wholly outside that band.Behaviour changes users will notice
changed: an SHG spectrum is no longer windowed by 2λm, so its outer wings now reach the spectral regularisation target and the initial guess unless λs is narrowed. This applies to PG and SD too: a saved session that narrowed λm reads back with λs unset (the full spectrum).breaking:auto_third_order_exponent(window=...)becomestrace_window=andspectrum_window=. To reproduce the old behaviour, pass the same window to both.Verification
uv run poe checkon the final commit: ruff, pyright (0 errors), codespell, changelog check, and 1931 tests passed (2 skipped) with 100 % statement and branch coverage.uv run poe docsbuilds without warnings. Updated pages:howto/preprocessing,howto/gui,howto/grids_and_filtering,explanation/marginals,howto/marginal_checks.load_and_cleanwith independent windows in both directions, and a PG case;qtbot.Related
Closes #22. Closes #23. Touches #17 (the marginal-check numerics this changes still live partly in the GUI stage). Dispersive SHG (#24) builds on the λs window.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WM2AxMiUXc12ViRwSf2cyL