File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 4
4
5
5
from __future__ import annotations
6
6
from typing import List , Tuple , Dict
7
+ from math import isclose
7
8
8
9
import numpy as np
9
10
import pydantic .v1 as pydantic
@@ -642,14 +643,16 @@ def _has_fully_anisotropic_media(self) -> bool:
642
643
643
644
@cached_property
644
645
def _has_complex_eps (self ) -> bool :
645
- """Check if there are media with a complex-valued epsilon in the plane of the mode at the
646
- mode solver freqs. A separate check is done inside the solver, which looks at the actual
646
+ """Check if there are media with a complex-valued epsilon in the plane of the mode.
647
+ A separate check is done inside the solver, which looks at the actual
647
648
eps and mu and uses a tolerance to determine whether to use real or complex fields, so
648
649
the actual behavior may differ from what's predicted by this property."""
650
+ check_freqs = np .unique ([np .amin (self .freqs ), np .amax (self .freqs ), np .mean (self .freqs )])
649
651
for int_mat in self ._intersecting_media :
650
- max_imag_eps = np .amax (np .abs (np .imag (int_mat .eps_model (np .array (self .freqs )))))
651
- if not np .isclose (max_imag_eps , 0 ):
652
- return False
652
+ for freq in check_freqs :
653
+ max_imag_eps = np .amax (np .abs (np .imag (int_mat .eps_model (freq ))))
654
+ if not isclose (max_imag_eps , 0 ):
655
+ return False
653
656
return True
654
657
655
658
def to_source (
You can’t perform that action at this time.
0 commit comments