-
Notifications
You must be signed in to change notification settings - Fork 65
feat: add interpolation to EME (FXC-4152) #2973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bdd7b09 to
aedc3a9
Compare
ead0cff to
0b23b05
Compare
3571d01 to
73e8ac0
Compare
0c72776 to
3676cf9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9 files reviewed, 4 comments
455b032 to
5a642c9
Compare
dbochkov-flexcompute
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, don't really have anything to add
5a642c9 to
e21d0e5
Compare
e21d0e5 to
867e00f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16 files reviewed, 1 comment
867e00f to
4172586
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16 files reviewed, 1 comment
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
tidy3d/components/data/dataset.pytidy3d/components/eme/simulation.pytidy3d/components/monitor.py |
momchil-flex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
4172586 to
ad6dc55
Compare
ad6dc55 to
0fef33d
Compare
Interpolation in EME can greatly speed up multi-frequency EME simulations.
Greptile Overview
Greptile Summary
This PR adds frequency interpolation support to EME simulations to significantly speed up multi-frequency simulations. The implementation replaces the deprecated
track_freqfield inEMEModeSpecwith a newinterp_specfield that defaults to Chebyshev interpolation with 3 sampling points and data reduction enabled.Key changes:
ModeInterpSpec.sampling_points()) and interpolates to full frequency ranges when needed_interpolated_copies_if_needed()method ensures consistent interpolation when computing overlaps between mode datasets with different interpolation specsnum_points >= len(freqs)- interpolation is now skipped naturally by returning all frequenciesEMEFreqSweepis deprecated in favor of usingEMESimulation.freqsdirectly withinterp_specconfigurationThe implementation properly handles edge cases like when interpolation specs differ between datasets, and includes comprehensive test updates reflecting the new behavior.
Confidence Score: 4/5
track_freqinstead ofsort_spec.track_freq), which needs correction to avoid user confusion. The removal of validation warnings is intentional and properly tested. The interpolation logic correctly falls back to computing all frequencies whennum_points >= len(freqs), and the coordination between different interpolation specs is handled appropriately.track_freqfield referenceImportant Files Changed
File Analysis
track_freqfield withinterp_specinEMEModeSpec, defaulting to Chebyshev interpolation with 3 points. Docstring incorrectly references removedtrack_freqfield.>to>=insampling_points()to allow interpolation even whennum_points == len(freqs). Added_same_nontrivial_interp_spec()helper method.smatrix_in_basis()to handle interpolation: uses_interpolated_copies_if_needed()and applies interpolation to overlap calculations when needed.num_points. Updated storage size calculation to use_stored_freqswhich accounts for interpolation reduction._warn_interp_num_points()andvalidate_interp_num_points()functions as warnings are no longer needed with new interpolation behavior.Sequence Diagram
sequenceDiagram participant User participant EMESimulation participant EMEModeSpec participant ModeInterpSpec participant ModeSolver participant ModeSolverData participant EMESimulationData User->>EMESimulation: Create simulation with freqs EMESimulation->>EMEModeSpec: Initialize with default interp_spec Note over EMEModeSpec: Default: ModeInterpSpec.cheb(num_points=3, reduce_data=True) User->>EMESimulation: Run simulation EMESimulation->>EMEModeSpec: Get sampling frequencies EMEModeSpec->>ModeInterpSpec: sampling_points(freqs) alt num_points >= len(freqs) ModeInterpSpec-->>EMEModeSpec: Return all freqs (no interpolation) else num_points < len(freqs) ModeInterpSpec-->>EMEModeSpec: Return reduced freq set (Chebyshev points) end EMESimulation->>ModeSolver: Solve modes at sampling freqs only ModeSolver-->>EMESimulation: Return mode data (reduced) User->>EMESimulationData: Access mode data / compute S-matrix alt Data needs interpolation EMESimulationData->>ModeSolverData: _interpolated_copies_if_needed(other) alt Same nontrivial interp_spec ModeSolverData-->>EMESimulationData: Return originals (no interp needed) else Different interp_specs ModeSolverData->>ModeSolverData: interpolated_copy ModeSolverData->>ModeSolverData: interp_in_freq(all freqs) ModeSolverData-->>EMESimulationData: Return interpolated copies end EMESimulationData->>EMESimulationData: Compute overlaps with interpolated data end EMESimulationData-->>User: Return S-matrix resultsContext used:
dashboard- Keep docstrings and comments synchronized with code changes to ensure they are always accurate and n... (source)