-
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
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