Skip to content
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

Mode solver eps_complex check at central frequency only #1312

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

momchil-flex
Copy link
Collaborator

Whether eps_model works with an array of frequencies is not consistent among the various media. Earlier I had an issue with fully anisotropic which I fixed, but now I see that the same is true for (some?) custom media. Since fully clarifying that may be a mess, and for this particular check looking at the central freqeuncy is probably fine, I propose this change for now.

Of course I could also iterate over freqs, but I want this check to be very fast even in cases with e.g. large custom media / many freqs, so I chose not to.

Copy link
Collaborator

@weiliangjin2021 weiliangjin2021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remind me again what is the issue with fully anisotropic medium?

To be safe, we might as well check 3 frequenices: min, mean, and max?

for int_mat in self._intersecting_media:
max_imag_eps = np.amax(np.abs(np.imag(int_mat.eps_model(np.array(self.freqs)))))
max_imag_eps = np.amax(np.abs(np.imag(int_mat.eps_model(freq0))))
if not np.isclose(max_imag_eps, 0):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.isclose to math.isclose?

@momchil-flex momchil-flex force-pushed the momchil/eps_complex_check branch 2 times, most recently from 1d14095 to ac0211f Compare December 12, 2023 21:06
@momchil-flex
Copy link
Collaborator Author

Could you remind me again what is the issue with fully anisotropic medium?

I fixed that here: #1290

To be safe, we might as well check 3 frequenices: min, mean, and max?

Updated and also using math.isclose.

@momchil-flex momchil-flex force-pushed the momchil/eps_complex_check branch from ac0211f to 66fc51c Compare December 12, 2023 21:09
@momchil-flex momchil-flex merged commit 523df25 into pre/2.5 Dec 12, 2023
@momchil-flex momchil-flex deleted the momchil/eps_complex_check branch December 12, 2023 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants