Skip to content

Commit

Permalink
Removing restriction for near2far monitors with symmetry
Browse files Browse the repository at this point in the history
  • Loading branch information
momchil-flex committed Sep 3, 2022
1 parent a9b0001 commit bd60009
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
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

0 comments on commit bd60009

Please sign in to comment.