Skip to content

Add mode_average=True to the capillary and waveguide interfaces - #28

Merged
jtravs merged 1 commit into
mainfrom
feature/capillary-mode-average
Oct 26, 2026
Merged

jtravs merged 1 commit into
mainfrom
feature/capillary-mode-average

Conversation

@jtravs

@jtravs jtravs commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Summary

prop_capillary, prop_waveguide, Simulation.from_capillary and Simulation.from_waveguide take mode_average=True to run their one gas-filled mode mode-averaged: a uniform disc of the mode's effective area instead of the radial rule. Until now this took a five-line recipe (dataclasses.replace(settings, quadrature=None, components=None, stats=default_spec("mode_averaged"))); Luna.jl makes it a switch.

  • The default is unchanged: modes=1 still resolves HE₁₁ on the radial rule.
  • The keyword selects the existing one-node transform, so the run is bitwise the hand-built one.
  • Default statistics are the capillary's own (plasma, species, pressure/density/core radius, on-axis peak_intensity), less quadrature_error. The recipe's default_spec("mode_averaged") dropped the plasma and species statistics. A same-process A/B showed no measurable cost from the extra statistics.
  • Refused by name beside the switch: more than one mode, n_r, n_theta, a non-default radial_rule, and provider= (the general modal route).

Docs and examples

  • The mode-averaging guide, model selection, spatial decompositions and the spatial introduction name the switch.
  • Coming from Luna: the mapping table listed Luna's modes=:HE11 (mode-averaged) next to solprop's resolved modes=1. It now maps to mode_average=True.
  • The MI ensemble (plot_03) and Raman comb (plot_04) examples use the switch. Both were re-run; their figures are byte-identical.
  • CHANGELOG updated.

Not changed

  • benchmarks/builders.py keeps the recipe, so the suite's timed cases record the same statistics as their baselines.
  • TDSE beside the switch is not refused (the recipe allowed it) and not tested here.

Tests

tests/driver/test_mode_average.py covers recipe equivalence, the default statistics, the taper, envelope, antiresonant and prop_waveguide cases, and the refusals. test_general_modal.py's keyword lock gains the new keyword. Locally the new tests and the capillary, waveguide, optmat-rates, tools and guide-snippet modules pass; ruff, basedpyright and numpydoc are clean; poe docs-examples passed under -W. The full gate runs in CI.

🤖 Generated with Claude Code

prop_capillary, prop_waveguide and their Simulation constructors take
mode_average=True to run their one gas-filled mode mode-averaged, as a
uniform disc of its effective area: the one-node transform a Simulation
without a transverse quadrature already took. The run is bitwise the
hand-built one, and its default statistics are the capillary's own
(plasma, species, profiles) less the quadrature estimate. More than one
mode, n_r, n_theta and radial_rule are refused beside it, and so is the
general modal route. The default stays the resolved single mode.

The mode-averaging guide, the setup pages, the Luna mapping (whose
modes=:HE11 is the mode-averaged run) and the MI ensemble and Raman comb
examples use the switch; both examples were re-run and their figures are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 19:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jtravs
jtravs merged commit e1b98e6 into main Oct 26, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants