Repository navigation
Give spectral ranges and bandpasses in the units of any axis - #29
Merged
Merged
Conversation
prop_2d, spec_1d and spectrogram took their spectral window only as wavelength_range, so a frequency or angular-frequency axis could not be given a range in Hz or rad/s, nor one starting at zero. They now take spec_range in the SI units of `axis`, like get_spectral_density; left out, it is the previous default wavelength range on that axis. style.spectral_limits is replaced by wavelength_to_axis, which converts a wavelength range to any axis. No alias: nothing is public yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A bandpass pair is still a wavelength range, m. Passband(limits, axis, width) carries its own axis (m, Hz or rad/s) and edge width, and every bandpass= keyword accepts it through _as_window, so the accessors, the compressors and the plots take it with no new keywords. A frequency band may start at zero. The builder takes the same axis and its first argument is renamed to limits; the taper width stays in rad/s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The ten worked examples that pass a spectral range to prop_2d or spec_1d now say spec_range, so their committed output was stale. Re-run with `poe docs-examples` on an Apple M5 Max: 23.5 min in all. The figures are unchanged apart from round-off in the noise floor of the tapered-capillary mode-energy panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Documentation build overview
73 files changed ·
|
Main's mode_average=True rewrite of the Raman comb worked example conflicted with this branch's spec_range rename in its generated output. The merged script is main's with spec_range; the example was re-run with `poe docs-examples plot_04_raman_comb_supercontinuum` on an Apple M5 Max (2.2 min), figures unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Problem
prop_2d,spec_1dandspectrogramacceptaxis={'wavelength','f','omega'}but tooktheir spectral window only as
wavelength_range. A frequency map could not be given arange in hertz, nor one starting at 0 Hz, which is an infinite wavelength. Every
bandpass=keyword (the accessors, the compressors,time_1d,prop_2d,energy) waslikewise a wavelength range or a ready-made array.
Changes
Plot ranges in the units of the axis.
prop_2d,spec_1dandspectrogramtakespec_range, in m, Hz or rad/s asaxissays. This is the same name and meaning as
get_spectral_density(spec_range=...).spec_rangethey show their previous default wavelength range, converted tothe axis.
spec_1d's default is now the named constantDEFAULT_SLICE_WAVELENGTH_RANGE.style.spectral_limitsis replaced bywavelength_to_axis(axis, wavelength_range),which returns SI limits on any axis.
Bandpass windows on any axis.
solprop.processing.Passband(limits, axis="wavelength", width=None)carries its ownaxis and edge width. Every
bandpass=keyword accepts it throughspectra._as_window, so no function gains a keyword.bandpass(grid, limits, *, axis=..., width=...)builds the same window; its firstargument is renamed from
wavelength_limitstolimits.positive and frequency limits must not be negative.
Luna's 3-tuple does the same.
axis a plot is drawn on, so the same call selects the same light however the result
is displayed.
The design follows Luna.jl's
Processing.window_maybe, which accepts a wavelength2-tuple, a 3-tuple adding an ω edge width, a 4-tuple of taper points, a window vector or
a function. Here the wavelength pair and the array forms carry over unchanged, and the
explicit
Passbandtype replaces meaning-by-tuple-length.Breaking, with no aliases (nothing is public yet):
wavelength_range=on the three plotfunctions,
style.spectral_limits, andbandpass(..., wavelength_limits=...)as akeyword. Positional calls to
bandpassare unaffected.Docs
poe docs-exampleson anApple M5 Max (23.5 min in all), and their output is committed.
Tests
prop_2dand onspectrogram, an angular-frequencyrange on
spec_1d, and the default range on a frequency axis.wavelength_to_axis: c/λ and 2πc/λ.Passbandandbandpass(axis=...): f and ω windows equal the wavelength window, azero lower edge, refusals, and an accessor taking a
Passband.tests/processing,tests/plotting,tests/test_sol.py, the guidesnippets, and the doctests of the changed modules (756 passed); basedpyright and ruff
are clean on the changed files. CI runs the full gate.
🤖 Generated with Claude Code