-
Notifications
You must be signed in to change notification settings - Fork 66
feat: add EMESimulationData.coeffs (FXC-4275) #3049
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
base: develop
Are you sure you want to change the base?
Conversation
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.
7 files reviewed, 3 comments
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
9bff29c to
98b5483
Compare
98b5483 to
be32d2a
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.
8 files reviewed, no comments
d4e40a8 to
54f45d3
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, 3 comments
54f45d3 to
e16d683
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
e16d683 to
ad087ee
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, 1 comment
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!
yaugenst-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.
Thanks looks good! Just some questions on compatibility.
bbdef0b to
d0f925f
Compare
d0f925f to
171b8b5
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, no comments
| """ | ||
|
|
||
| __slots__ = () | ||
| _dims = ("f", "sweep_index", "eme_cell_index", "mode_index_out", "mode_index_in") |
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.
How big could this reasonably get? Also, f is over all requested frequencies or over the interpolation frequencies only?
If it's the latter, then something like 100 x 100 x 100 x 20 x 20 could be something that a user could still reasonably try? And that's 400M complex numbers, and we s tore multiple such arrays by default with no option to turn it off. Sounds like it could be a problem?
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.
Thanks for taking another look.
first, I did add the option to turn it off via the Boolean sim.store_coeffs
second, it is over all frequencies, but whether sweep_index appears depends on the exact sweep. For example the overlaps only vary for the deprecated EMEFreqSweep. The interface s matrices don’t vary for EMELengthSweep.
so yes in theory it is possible to request GB of data here, but I think it’s far from typical?
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.
I guess I can add warning / validator here like we do for monitors
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.
Or, have this off by default. What do you think?
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.
I will say store_port_modes is on by default and that can be even more of an issue
that is handled by existing validators
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.
I guess we could go back to the old api of having the coeffs monitor (so it only selects desired cell indices too)
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.
It’s just that most of the size of this data isn’t from spatial extent, it’s from many non-spatial dimensions combined
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.
I would say have it on by default but add validators sounds good?
Replaces #3024.
This PR extends
EMECoefficientDatasetto store additional data:Furthermore, instead of using a monitor, this data is always stored in
EMESimulationData.coeffs(it is always computed and is not very large) as long asEMESimulation.store_coeffsisTrue(the default). SoEMECoefficientMonitoris deprecated.Greptile Overview
Greptile Summary
This PR extends
EMECoefficientDatasetto store additional EME solver data including interface S-matrices, mode overlaps, complex propagation indices, and mode flux. Instead of using a monitor, this data is now always stored inEMESimulationData.coeffswhenEMESimulation.store_coeffs=True(the default), deprecatingEMECoefficientMonitor.Key Changes:
EMEInterfaceSMatrixDataArrayandEMEFluxDataArraydata array classesEMEInterfaceSMatrixDatasetandEMEOverlapDatasetto organize interface dataEMECoefficientDatasetwith optional fields:n_complex,flux,interface_smatrices,overlapsnormalized_copycached property for flux-normalized coefficients and S-matricesstore_coeffsboolean field toEMESimulation(defaults toTrue)EMECoefficientMonitorwith appropriate warning messagecoeffsfield toEMESimulationDatato store the coefficient datasetThe implementation follows established patterns in the codebase and provides useful debugging/optimization data to users without requiring explicit monitor configuration.
Confidence Score: 5/5
Important Files Changed
File Analysis
EMEInterfaceSMatrixDataArrayandEMEFluxDataArray) with proper dimensions and units. Clean implementation following existing patterns.EMECoefficientDatasetwith new optional fields (interface S-matrices, overlaps, n_complex, flux) and addednormalized_copyproperty for flux normalization. Implementation is solid with proper null checks.store_coeffsboolean field (defaults to True) and deprecation warning forEMECoefficientMonitor. Simple and appropriate changes.coeffsfield to storeEMECoefficientDataset. Straightforward addition with proper typing and documentation.Sequence Diagram
sequenceDiagram participant User participant EMESimulation participant Solver as EME Solver participant EMESimulationData participant EMECoefficientDataset User->>EMESimulation: Create simulation with store_coeffs=True User->>EMESimulation: Run simulation EMESimulation->>Solver: Execute EME solver Note over Solver: Compute mode coefficients (A, B) Note over Solver: Compute interface S-matrices Note over Solver: Compute mode overlaps Note over Solver: Compute n_complex and flux Solver->>EMECoefficientDataset: Create dataset with all coefficients EMECoefficientDataset->>EMECoefficientDataset: Store A, B coefficients EMECoefficientDataset->>EMECoefficientDataset: Store interface_smatrices EMECoefficientDataset->>EMECoefficientDataset: Store overlaps EMECoefficientDataset->>EMECoefficientDataset: Store n_complex, flux Solver->>EMESimulationData: Create simulation data EMESimulationData->>EMESimulationData: Store smatrix EMESimulationData->>EMESimulationData: Store coeffs (if store_coeffs=True) EMESimulationData->>EMESimulationData: Store port_modes EMESimulationData->>EMESimulationData: Store monitor data EMESimulationData-->>User: Return results alt User wants normalized coefficients User->>EMECoefficientDataset: Access normalized_copy property EMECoefficientDataset->>EMECoefficientDataset: Normalize A, B by sqrt(flux) EMECoefficientDataset->>EMECoefficientDataset: Normalize S12, S21 by sqrt(flux ratio) EMECoefficientDataset->>EMECoefficientDataset: Set flux=None to prevent double normalization EMECoefficientDataset-->>User: Return normalized dataset end