-
Notifications
You must be signed in to change notification settings - Fork 40
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
Various improvements to EME solver. #1636
Conversation
f30427a
to
05692b8
Compare
05692b8
to
325f045
Compare
325f045
to
d5f290b
Compare
909a1d6
to
e68100a
Compare
bb51d14
to
9f62e61
Compare
@tylerflex the test |
@caseyflex due to some subtleties with how See the fix here: |
by the way, should I just review once the to-do items are done and it's in it's final state? |
You could wait on smatrix_in_basis and field_in_basis. Everything else
should be pretty final already.
…On Wed, May 29, 2024 at 9:07 PM Tyler Hughes ***@***.***> wrote:
by the way, should I just review once the to-do items are done and it's in
it's final state?
—
Reply to this email directly, view it on GitHub
<#1636 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3KLECNNFGN2OE22HPIKNF3ZEYYQZAVCNFSM6AAAAABGW7HU3KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGE3TQNZVG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
ok I guess ping me when it's done, thanks |
5a4d532
to
c9aa039
Compare
I think it is all ready for review now |
698eb88
to
d9458e5
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.
Thanks @caseyflex . I think this looks good overall. I left some comments.
In general it seems there are a ton of edge cases being handled here. While I'm sure it's correct, it was a bit difficult to follow the complexity in the code when reading through. More importantly, though, I am a little concerned about making sure the edge cases are tested properly to avoid unexpected issues in use. I think adding some unit tests for these various edge would go a long way towards the stability of the code.
The command I use to test coverage is:
pytest -rA tests --cov-report=html --cov=tidy3d && open htmlcov/index.html
must also pip install pytest-cov
Another general comment is that I would suggest trying to use xarray
instead of to_numpy()
and using axis manipulation. One can imagine in the future if the order of some of the data dimensions gets changed, or we add another dimension, this can quickly become unsustainable. So if there's any way to rewrite the array manipulation bits using the named axes of xarray, that would also really improve the stability and readability of the code.
Thanks a lot for these improvements to the EME solver and all of the hard work to get them out!
So currently EMESimulation supports both |
Yeah, that's right -- I should clarify in the docstrings. When both are provided, it kind of works as expected -- performs exact mode solves at all the |
3645c73
to
7d81b25
Compare
@caseyflex fyi, autograd tests are failing because of #1734 and will pass once #1736 is merged |
bc4a166
to
0fec522
Compare
836637f
to
ddb82ec
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.
As far as I'm concerned, this is good to go assuming whatever comments I had earlier are either resolved or marked somewhere for revisiting whenever possible. Thanks @caseyflex
ddb82ec
to
990aeb7
Compare
Summary of changes:
EMEFreqSweep
withfreq_scale_factors
_data_on_yee_grid_relative
eigs_to_effective_index
to avoid smallkeff
approximationsweep_index
to more EME data structures. Rearranges some of the other dims to be more consistent and user-friendly.sweep_index
insmatrix_in_basis
andfield_in_basis
sim_data.py
to avoid code duplication. The main thing here was wanting a functionplot_field_monitor_data
that takes the monitor data directly as an argument instead of taking the monitor name.normalize
field toEMESimulation
which specifies whether to normalize the port modes to unity flux (thereby normalizing the scattering matrix and expansion coefficients).True
by default, but can be set toFalse
in certain cases involving evanescent port modes.EMELengthSweep
Todo:
Later: