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

Use default td.ModeSpec in mode monitors #2058

Open
wants to merge 1 commit into
base: pre/2.8
Choose a base branch
from
Open
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Enabled the user to set the `ModeMonitor.colocate` field and changed to `True` by default (fields were actually already returned colocated even though this field was `False` previously).
- More robust mode solver at radio frequencies.
- Disallow very small polygons when subdividing 2D structures.
- `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.
- `ModeMonitor` and `ModeSolverMonitor` now use the default `td.ModeSpec()` when `mode_spec` is not provided.

### Fixed
- Significant speedup for field projection computations.
Expand Down
13 changes: 6 additions & 7 deletions tests/test_components/test_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,16 @@ 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.DirectivityMonitor(
m8 = td.PermittivityMonitor(size=size, center=center, freqs=FREQS, name="perm")
m9 = td.DirectivityMonitor(
size=size,
center=center,
theta=thetas,
Expand All @@ -355,12 +355,11 @@ def test_monitor():
freqs=FREQS,
name="directivity",
)
m10 = 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, m8]:
# m.plot(y=2)
# plt.close()
for m in [m1, m2, m3, m4, m5, m6, m7, m8, m9, m10]:
m.storage_size(num_cells=100, tmesh=tmesh)

for m in [m2, m4]:
Expand Down
2 changes: 1 addition & 1 deletion tidy3d/components/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,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
Loading