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

Fix to fully anisotropic eps_model when an array of freqs is provided #1290

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/test_components/test_medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ def test_fully_anisotropic_media():
rotation=rot,
)

# check eps_model can be called with an array of frequencies
eps = m.eps_model(np.linspace(1e12, 2e12, 10))

assert np.allclose(m.permittivity, perm)
assert np.allclose(m.conductivity, cond)

Expand Down
3 changes: 3 additions & 0 deletions tidy3d/components/medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -3606,6 +3606,9 @@ def eps_model(self, frequency: float) -> complex:
"""Complex-valued permittivity as a function of frequency."""
perm_diag, cond_diag, _ = self.eps_sigma_diag

if not np.isscalar(frequency):
perm_diag = perm_diag[:, None]
cond_diag = cond_diag[:, None]
eps_diag = AbstractMedium.eps_sigma_to_eps_complex(perm_diag, cond_diag, frequency)
return np.mean(eps_diag)

Expand Down