Skip to content

Commit

Permalink
Silence graphene warning from checking fit at high freq
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyflex authored and momchil-flex committed Nov 5, 2024
1 parent d18c2df commit a764a75
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bug when adding 2D structures to the `Simulation` that are composed of multiple overlapping polygons.
- Fields stored in `ModeMonitor` objects were computed colocated to the grid boundaries, but the built-in `ModeMonitor.colocate=False` was resulting in wrong results in some cases, most notably if symmetries are also involved.
- Small inaccuracy when applying a mode solver `bend_radius` when the simulation grid is not symmetric w.r.t. the mode plane center. Previously, the radius was defined w.r.t. the middle grid coordinate, while now it is correctly applied w.r.t. the plane center.
- Silence warning in graphene from checking fit quality at large frequencies.

## [2.7.2] - 2024-08-07

Expand Down
9 changes: 9 additions & 0 deletions tests/test_package/test_parametric_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
Graphene,
)

from ..utils import AssertLogLevel

# bounds for MU_C
GRAPHENE_MU_C_MIN = 0
GRAPHENE_MU_C_MAX = 3
Expand Down Expand Up @@ -56,3 +58,10 @@ def test_graphene(rng_seed, log_capture):
sigma1 = graphene.medium.sigma_model(freqs)
sigma2 = graphene.intraband_drude.sigma_model(freqs)
assert np.allclose(sigma1, sigma2, rtol=0, atol=GRAPHENE_FIT_ATOL)

gamma = 10 / 8065.54429
temp = 300
mu_c = 0.55

with AssertLogLevel(log_capture, None):
_ = Graphene(gamma=gamma, mu_c=mu_c, temp=temp).medium
3 changes: 2 additions & 1 deletion tidy3d/material_library/parametric_materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def interband_pole_residue(self) -> PoleResidue:

pole_residue = self._fit_interband_conductivity(flattened_freqs, sigma_inds, inds)
pole_residue_filtered = self._filter_poles(pole_residue)
sigma_fit = pole_residue_filtered.sigma_model(freqs)
# silence warnings associated with frequency range just for checking fit
sigma_fit = pole_residue_filtered.updated_copy(frequency_range=None).sigma_model(freqs)
if not np.allclose(sigma, sigma_fit, rtol=0, atol=GRAPHENE_FIT_ATOL):
log.warning(
"Graphene fit may not be good. Try changing the physical or fitting parameters."
Expand Down

0 comments on commit a764a75

Please sign in to comment.