-
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.
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 the EME (Eigenmode Expansion) simulation capabilities by storing additional coefficient data directly in
EMESimulationData.coeffsrather than requiring a separate monitor. The implementation adds new data array types (EMEInterfaceSMatrixDataArray,EMEFluxDataArray) and extendsEMECoefficientDatasetto store interface S-matrices, mode propagation indices, and flux values. The PR also deprecatesEMECoefficientMonitorsince the data is now always available whenEMESimulation.store_coeffs=True.Key changes include:
EMEInterfaceSMatrixDataArrayandEMEFluxDataArrayclasses with proper dimension definitionsEMECoefficientDatasetwith optional fields forn_complex,flux, andinterface_smatricesnormalized_copyproperty for flux-normalized coefficientsstore_coeffsflag toEMESimulation(defaults toTrue)EMECoefficientMonitorIssues found:
eme_port_indexdimension from coefficient arrays may not align properly with flux arrays during normalizationConfidence Score: 4/5
tidy3d/components/eme/data/dataset.py- verify the normalization logic handles theeme_port_indexdimension correctlyImportant Files Changed
File Analysis
EMEInterfaceSMatrixDataArrayandEMEFluxDataArray) with proper dimensions and examplesEMECoefficientDatasetwith new fields and normalization logic - one potential dimension mismatch issue in normalizationstore_coeffsflag and deprecation warning forEMECoefficientMonitor- clean implementationSequence Diagram
sequenceDiagram participant User participant EMESimulation participant Solver as EME Solver participant EMESimulationData participant EMECoefficientDataset User->>EMESimulation: Create simulation with store_coeffs=True User->>Solver: Run EME simulation Note over Solver: Compute EME modes Solver->>Solver: Calculate A & B coefficients Solver->>Solver: Calculate mode n_complex Solver->>Solver: Calculate mode flux Solver->>Solver: Calculate interface S-matrices alt store_coeffs=True Solver->>EMECoefficientDataset: Create dataset with all coefficients EMECoefficientDataset->>EMECoefficientDataset: Store A, B, n_complex, flux, interface_smatrices Solver->>EMESimulationData: Attach coeffs dataset else store_coeffs=False Solver->>EMESimulationData: coeffs=None end EMESimulationData->>User: Return simulation results opt User requests normalized coefficients User->>EMECoefficientDataset: Access normalized_copy EMECoefficientDataset->>EMECoefficientDataset: Check flux is not None EMECoefficientDataset->>EMECoefficientDataset: Normalize A, B by sqrt(flux_out) EMECoefficientDataset->>EMECoefficientDataset: Normalize S12, S21 by sqrt(flux ratios) EMECoefficientDataset->>EMECoefficientDataset: Set flux=None to prevent double normalization EMECoefficientDataset->>User: Return normalized dataset end