-
Notifications
You must be signed in to change notification settings - Fork 66
feat: Add EMEInterfaceSMatrixMonitor (FXC-4275) #3024
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
63523e6 to
637e8d4
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, 2 comments
637e8d4 to
2c77070
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.
11 files reviewed, 1 comment
457f0b8 to
2f737c7
Compare
2f737c7 to
b46cdad
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.
11 files reviewed, no comments
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
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 @caseyflex just some minor comments!
| """Dataset storing interface s-matrices. | ||
| The s-matrix at ``eme_cell_index=i`` is between cells ``i`` and ``i+1``. |
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 should capitalize "S-matrix" here? I noticed the spelling is a bit inconsistent and I think capital S is most common.
| title="EME Interface S Matrix Monitor", | ||
| description="EME interface s matrix monitor associated with this data.", |
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.
Inconsistent spelling here too
Thanks! Will incorporate these, but I’m going to change the api significantly after some discussions so will close this in favor of a new PR |
|
Partially subsumed by #3032 (just the easy stuff) The actual interface S matrices will come in a separate PR |
This PR:
num_sweepfrom1toNoneforEMECoefficientMonitorNote: the interface s matrices are not currently normalized. To normalize S21 for example, you need to multiply by
sqrt(abs(real(flux2)/real(flux1))), where flux1 and flux2 are the flux in cell 1 and cell 2, respectively. In the future, we can add a flagnormalizeto this monitor andEMECoefficientMonitor, and maybe make it default toTrue.Greptile Overview
Greptile Summary
This PR adds
EMEInterfaceSMatrixMonitorto record cell-interface S-matrices in the EME solver, which is useful for structure optimization. The implementation follows established patterns in the codebase by creating the full class hierarchy (monitor, data array, dataset, and monitor data classes) and properly exporting them in the public API.Key changes:
EMEInterfaceSMatrixMonitorwith appropriate field overrides forinterval_space,eme_cell_interval_space, andnum_sweepEMEInterfaceSMatrixDataArray(5D with dimensions for f, sweep_index, eme_cell_index, mode_index_out, mode_index_in),EMEInterfaceSMatrixDataset, andEMEInterfaceSMatrixDatanum_sweepfrom1toNoneinEMECoefficientMonitorto record all sweep indices by defaultConfidence Score: 5/5
Important Files Changed
File Analysis
EMEInterfaceSMatrixMonitorclass with fields and storage size calculation; movednum_sweepfrom baseEMEMonitorto specific monitor classesEMEInterfaceSMatrixDataclass that combines monitor with dataset, following standard patternEMEInterfaceSMatrixDataArrayclass with 5-dimensional structure for interface S-matrix dataEMEInterfaceSMatrixDatasetwith S11, S12, S21, S22 fields mirroringEMESMatrixDatasetstructureSequence Diagram
sequenceDiagram participant User participant EMESimulation participant EMEInterfaceSMatrixMonitor participant EMEInterfaceSMatrixData participant EMEInterfaceSMatrixDataset participant EMEInterfaceSMatrixDataArray User->>EMESimulation: Create simulation with EMEInterfaceSMatrixMonitor EMESimulation->>EMEInterfaceSMatrixMonitor: Validate monitor configuration EMEInterfaceSMatrixMonitor->>EMEInterfaceSMatrixMonitor: Check num_modes, freqs, num_sweep EMEInterfaceSMatrixMonitor->>EMESimulation: Calculate storage_size() User->>EMESimulation: Run simulation EMESimulation->>EMESimulation: Solve EME cells and compute interface S-matrices EMESimulation->>EMEInterfaceSMatrixDataArray: Create data arrays for S11, S12, S21, S22 Note over EMEInterfaceSMatrixDataArray: Dimensions: (f, sweep_index, eme_cell_index, mode_index_out, mode_index_in) EMEInterfaceSMatrixDataArray->>EMEInterfaceSMatrixDataset: Populate S11, S12, S21, S22 fields EMEInterfaceSMatrixDataset->>EMEInterfaceSMatrixData: Combine with monitor reference EMEInterfaceSMatrixData->>User: Return simulation data User->>EMEInterfaceSMatrixData: Access interface S-matrices Note over User,EMEInterfaceSMatrixData: S-matrix at eme_cell_index=i<br/>is between cells i and i+1