Skip to content

Commit

Permalink
Use default td.ModeSpec in mode monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
yaugenst-flex committed Nov 6, 2024
1 parent 6da4072 commit 5cf8c61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- `CustomMedium` design regions require far less data when performing inverse design by reducing adjoint field monitor size for dims with one pixel.
- Calling `.values` on `DataArray` no longer raises a `DeprecationWarning` during automatic differentiation
- Calling `.values` on `DataArray` no longer raises a `DeprecationWarning` during automatic differentiation.
- `ModeMonitor` and `ModeSolverMonitor` now use the default `td.ModeSpec()` when `mode_spec` is not provided.

### Fixed
- Regression in local field projection leading to incorrect results for `far_field_approx=True`.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_components/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,19 @@ def test_monitor():
m5 = td.ModeMonitor(
size=(1, 1, 0), center=center, mode_spec=td.ModeSpec(), freqs=FREQS, name="test_mon"
)
m6 = td.ModeSolverMonitor(
m6 = td.ModeMonitor(size=(1, 1, 0), center=center, freqs=FREQS, name="test_mon")
m7 = td.ModeSolverMonitor(
size=(1, 1, 0),
center=center,
mode_spec=td.ModeSpec(),
freqs=FREQS,
name="test_mon",
direction="-",
)
m7 = td.PermittivityMonitor(size=size, center=center, freqs=FREQS, name="perm")
m8 = td.PermittivityMonitor(size=size, center=center, freqs=FREQS, name="perm")

tmesh = np.linspace(0, 1, 10)

for m in [m1, m2, m3, m4, m5, m6, m7]:
for m in [m1, m2, m3, m4, m5, m6, m7, m8]:
# m.plot(y=2)
# plt.close()
m.storage_size(num_cells=100, tmesh=tmesh)
Expand Down
2 changes: 1 addition & 1 deletion tidy3d/components/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class AbstractModeMonitor(PlanarMonitor, FreqMonitor):
""":class:`Monitor` that records mode-related data."""

mode_spec: ModeSpec = pydantic.Field(
...,
default_factory=ModeSpec,
title="Mode Specification",
description="Parameters to feed to mode solver which determine modes measured by monitor.",
)
Expand Down

0 comments on commit 5cf8c61

Please sign in to comment.