Skip to content

feat: Mode selection update#162

Merged
lorenzsp merged 33 commits into
masterfrom
mode-selection-update
Sep 20, 2025
Merged

feat: Mode selection update#162
lorenzsp merged 33 commits into
masterfrom
mode-selection-update

Conversation

@cchapmanbird

@cchapmanbird cchapmanbird commented Jul 10, 2025

Copy link
Copy Markdown
Member

This PR overhauls the mode selection framework in FEW used to identify dominant waveform modes in order to speed up the waveform generation. The new implementation better estimates the importance of each mode, particularly when noise-weighting, and is more efficient in cases when a pre-determined list of modes is required.

The few.utils.modeselector.ModeSelector class now takes amplitude and ylm modules as input, and handles the generation of mode amplitudes. This has two main benefits:

  • When mode content is pre-determined, only these modes are generated, with significant computational savings (particularly for shorter waveforms with few harmonic modes).
  • The waveform build is now significantly simpler, with the trajectory being passed directly to the mode selector and mode amplitudes / ylms being obtained in a single step.

Rather than sorting the mode power at each trajectory step, the SNR of each mode is approximated by folding in the duration of each spline segment, under the assumption of mode orthogonality (which is not quite true for higher-order l modes, but is still a reasonable approximation). This both reduces the cost of mode selection (as now only one set of values must be sorted, rather than 50-100 as before) and is far more accurate. The previous method assigned too high an importance to modes that only appeared in the final moments of inspiral, but contribute negligibly to the waveform SNR. With this change, the mode_selection_threshold parameter now closely matches the mismatch in the waveform obtained, which is significantly more intuitive for the end user and performs more consistently over the parameter space.

Finally, this also includes a utility few.utils.modeselector.get_selected_modes_from_initial_conditions that takes trajectory and mode selection modules as well as initial conditions and returns the sorted modes, which is useful for directly examining the mode content as a function of parameter space in one function call.


📚 Documentation preview 📚: https://fastemriwaveforms--162.org.readthedocs.build/en/162/

@cchapmanbird cchapmanbird requested a review from lorenzsp July 10, 2025 21:22
@cchapmanbird

Copy link
Copy Markdown
Member Author

To be merged after #160 as this directly follows those changes.

@lorenzsp lorenzsp self-assigned this Jul 12, 2025
@cchapmanbird cchapmanbird force-pushed the mode-selection-update branch from f7e3df2 to 1085380 Compare August 7, 2025 09:31
lorenzsp and others added 2 commits August 14, 2025 15:48
…-selection-update

Resolved conflicts by accepting incoming changes:
- examples/modeselect.ipynb
- src/few/amplitude/ampinterp2d.py
- src/few/amplitude/romannet.py
- src/few/utils/modeselector.py
- tests/test_mode_selector.py
@lorenzsp lorenzsp merged commit ce6e56a into master Sep 20, 2025
40 checks passed
@lorenzsp lorenzsp deleted the mode-selection-update branch September 20, 2025 06:45

@lorenzsp lorenzsp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Final Assessment: Mode Selection Update Branch Review
Based on my comprehensive analysis of the mode-selection-update branch, here's my assessment of whether it's ready to merge into master:

✅ READY TO MERGE - with minor cleanup recommended
Summary of Changes
The branch contains a significant update to the mode selection functionality with 30+ commits adding 742 lines and removing 1,013 lines across 18 files. Key improvements include:

Code Quality Assessment
Architecture: Well-structured refactoring that moves common amplitude functionality to a base class
New Features: Enhanced mode selector with better negative m-mode handling and improved user interface
Documentation: Comprehensive docstrings and updated tutorial examples
Error Handling: Robust input validation and meaningful error messages
Testing Status ✅
All tests passing: Mode selector tests and full test suite run successfully

Clean API design with backward compatibility
Proper handling of edge cases (negative m-modes, duplicate modes)
Performance optimizations and user warnings for large mode selections
Good separation of concerns between amplitude generation and mode selection

Merge Readiness Checklist
✅ No merge conflicts with master
✅ All tests passing
✅ Code follows project conventions
✅ Documentation updated appropriately
✅ Backward compatibility maintained
✅ New functionality properly tested

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