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

Removing restriction for near2far monitors with symmetry #497

Merged
merged 1 commit into from
Sep 6, 2022
Merged
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
14 changes: 0 additions & 14 deletions tests/test_near2far.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,6 @@ def test_n2f_monitors():
medium=MEDIUM,
)

# Make sure server-side n2f monitors raise an error in the presence of symmetry
with pytest.raises(SetupError):
sim = td.Simulation(
size=sim_size,
grid_spec=grid_spec,
structures=[],
sources=[source],
monitors=all_monitors,
run_time=run_time,
boundary_spec=boundary_spec,
medium=MEDIUM,
symmetry=[1, 0, 0],
)


def test_n2f_data():
"""Make sure all the near-to-far data structures can be created."""
Expand Down
17 changes: 1 addition & 16 deletions tidy3d/components/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .structure import Structure
from .source import SourceType, PlaneWave, GaussianBeam, AstigmaticGaussianBeam
from .monitor import MonitorType, Monitor, FreqMonitor
from .monitor import AbstractFieldMonitor, AbstractNear2FarMonitor
from .monitor import AbstractFieldMonitor
from .viz import add_ax_if_none, equal_aspect

from .viz import MEDIUM_CMAP, PlotParams, plot_params_symmetry
Expand Down Expand Up @@ -437,21 +437,6 @@ def _warn_monitor_simulation_frequency_range(cls, val, values):
)
return val

@pydantic.validator("monitors", always=True)
def n2f_monitors_with_symmetry(cls, val, values):
"""Error if a server-side near-to-far monitor is used with symmetry"""
monitors = val
symmetry = values.get("symmetry")
if not any(symmetry):
return val
for monitor in monitors:
if isinstance(monitor, AbstractNear2FarMonitor):
raise SetupError(
"Server-side near-to-far calculation is not available with symmetry. "
"Use the local near-to-far available through the 'RadiationVectors' class."
)
return val

@pydantic.validator("grid_spec", always=True)
def _warn_grid_size_too_small(cls, val, values): # pylint:disable=too-many-locals
"""Warn user if any grid size is too large compared to minimum wavelength in material."""
Expand Down