Skip to content

Commit 8d620e6

Browse files
committed
Fix to fully anisotropic eps_model when an array of freqs is provided
1 parent 676f351 commit 8d620e6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/test_components/test_medium.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ def test_fully_anisotropic_media():
450450
rotation=rot,
451451
)
452452

453+
# check eps_model can be called with an array of frequencies
454+
eps = m.eps_model(np.linspace(1e12, 2e12, 10))
455+
453456
assert np.allclose(m.permittivity, perm)
454457
assert np.allclose(m.conductivity, cond)
455458

tidy3d/components/medium.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,6 +3606,9 @@ def eps_model(self, frequency: float) -> complex:
36063606
"""Complex-valued permittivity as a function of frequency."""
36073607
perm_diag, cond_diag, _ = self.eps_sigma_diag
36083608

3609+
if not np.isscalar(frequency):
3610+
perm_diag = perm_diag[:, None]
3611+
cond_diag = cond_diag[:, None]
36093612
eps_diag = AbstractMedium.eps_sigma_to_eps_complex(perm_diag, cond_diag, frequency)
36103613
return np.mean(eps_diag)
36113614

0 commit comments

Comments
 (0)