From 47f1e9ec6c42b663cf88bd094fd2668902079029 Mon Sep 17 00:00:00 2001 From: Martin Schubert <30735893+mfschubert@users.noreply.github.com> Date: Tue, 7 Nov 2023 16:53:14 -0800 Subject: [PATCH] Add flexible ceviche resolution (#51) --- src/invrs_gym/challenges/ceviche/challenge.py | 234 ++++++++++++++++-- src/invrs_gym/challenges/ceviche/defaults.py | 53 +--- tests/challenges/ceviche/test_defaults.py | 97 ++++++-- 3 files changed, 300 insertions(+), 84 deletions(-) diff --git a/src/invrs_gym/challenges/ceviche/challenge.py b/src/invrs_gym/challenges/ceviche/challenge.py index 135f317..5a88f9c 100644 --- a/src/invrs_gym/challenges/ceviche/challenge.py +++ b/src/invrs_gym/challenges/ceviche/challenge.py @@ -11,6 +11,18 @@ import jax import jax.numpy as jnp import numpy as onp +from ceviche_challenges import params # type: ignore[import-untyped] +from ceviche_challenges import units as u +from ceviche_challenges.beam_splitter import ( # type: ignore[import-untyped] + model as beam_splitter_model, +) +from ceviche_challenges.mode_converter import ( # type: ignore[import-untyped] + model as mode_converter_model, +) +from ceviche_challenges.waveguide_bend import ( # type: ignore[import-untyped] + model as waveguide_bend_model, +) +import ceviche_challenges.wdm.model as wdm_model # type: ignore[import-untyped] from jax import tree_util from totypes import types @@ -284,12 +296,35 @@ def _wavelength_bound( def beam_splitter( minimum_width: int = defaults.MINIMUM_WIDTH, minimum_spacing: int = defaults.MINIMUM_SPACING, + resolution_nm: int = defaults.SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Beamsplitter with 3.2 x 2.0 um design and standard simulation params.""" + """Beamsplitter with 3.2 x 2.0 um design region. + + By default, standard simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.BEAM_SPLITTER_MODEL, + ceviche_model=beam_splitter_model.BeamSplitterModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.BEAM_SPLITTER_SPEC, + ), symmetries=defaults.BEAM_SPLITTER_SYMMETRIES, minimum_width=minimum_width, minimum_spacing=minimum_spacing, @@ -303,12 +338,35 @@ def beam_splitter( def lightweight_beam_splitter( minimum_width: int = defaults.LIGHTWEIGHT_MINIMUM_WIDTH, minimum_spacing: int = defaults.LIGHTWEIGHT_MINIMUM_SPACING, + resolution_nm: int = defaults.LIGHTWEIGHT_SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.LIGHTWEIGHT_WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Beamsplitter with 3.2 x 2.0 um design and lightweight simulation params.""" + """Beamsplitter with 3.2 x 2.0 um design and lightweight simulation params. + + By default, lightweight simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.LIGHTWEIGHT_BEAM_SPLITTER_MODEL, + ceviche_model=beam_splitter_model.BeamSplitterModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.BEAM_SPLITTER_SPEC, + ), symmetries=defaults.BEAM_SPLITTER_SYMMETRIES, minimum_width=minimum_width, minimum_spacing=minimum_spacing, @@ -322,12 +380,35 @@ def lightweight_beam_splitter( def mode_converter( minimum_width: int = defaults.MINIMUM_WIDTH, minimum_spacing: int = defaults.MINIMUM_SPACING, + resolution_nm: int = defaults.SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Mode converter with 1.6 x 1.6 um design and standard simulation params.""" + """Mode converter with 1.6 x 1.6 um design and standard simulation params. + + By default, standard simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.MODE_CONVERTER_MODEL, + ceviche_model=mode_converter_model.ModeConverterModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.MODE_CONVERTER_SPEC, + ), minimum_width=minimum_width, minimum_spacing=minimum_spacing, density_initializer=density_initializer, @@ -340,12 +421,35 @@ def mode_converter( def lightweight_mode_converter( minimum_width: int = defaults.LIGHTWEIGHT_MINIMUM_WIDTH, minimum_spacing: int = defaults.LIGHTWEIGHT_MINIMUM_SPACING, + resolution_nm: int = defaults.LIGHTWEIGHT_SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.LIGHTWEIGHT_WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Mode converter with 1.6 x 1.6 um design and lightweight simulation params.""" + """Mode converter with 1.6 x 1.6 um design and lightweight simulation params. + + By default, lightweight simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.LIGHTWEIGHT_MODE_CONVERTER_MODEL, + ceviche_model=mode_converter_model.ModeConverterModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.MODE_CONVERTER_SPEC, + ), minimum_width=minimum_width, minimum_spacing=minimum_spacing, density_initializer=density_initializer, @@ -358,12 +462,35 @@ def lightweight_mode_converter( def waveguide_bend( minimum_width: int = defaults.MINIMUM_WIDTH, minimum_spacing: int = defaults.MINIMUM_SPACING, + resolution_nm: int = defaults.SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Waveguide bend with 1.6 x 1.6 um design and standard simulation params.""" + """Waveguide bend with 1.6 x 1.6 um design and standard simulation params. + + By default, standard simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.WAVEGUIDE_BEND_MODEL, + ceviche_model=waveguide_bend_model.WaveguideBendModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.WAVEGUIDE_BEND_SPEC, + ), symmetries=defaults.WAVEGUIDE_BEND_SYMMETRIES, minimum_width=minimum_width, minimum_spacing=minimum_spacing, @@ -377,12 +504,35 @@ def waveguide_bend( def lightweight_waveguide_bend( minimum_width: int = defaults.LIGHTWEIGHT_MINIMUM_WIDTH, minimum_spacing: int = defaults.LIGHTWEIGHT_MINIMUM_SPACING, + resolution_nm: int = defaults.LIGHTWEIGHT_SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.LIGHTWEIGHT_WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Waveguide bend with 1.6 x 1.6 um design and lightweight simulation params.""" + """Waveguide bend with 1.6 x 1.6 um design and lightweight simulation params. + + By default, lightweight simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.LIGHTWEIGHT_WAVEGUIDE_BEND_MODEL, + ceviche_model=waveguide_bend_model.WaveguideBendModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.WAVEGUIDE_BEND_SPEC, + ), symmetries=defaults.WAVEGUIDE_BEND_SYMMETRIES, minimum_width=minimum_width, minimum_spacing=minimum_spacing, @@ -396,12 +546,38 @@ def lightweight_waveguide_bend( def wdm( minimum_width: int = defaults.MINIMUM_WIDTH, minimum_spacing: int = defaults.MINIMUM_SPACING, + resolution_nm: int = defaults.SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Demultiplexer with 6.4 x 6.4 um design and standard simulation params.""" + """Demultiplexer with 6.4 x 6.4 um design and standard simulation params. + + By default, standard simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.WDM_MODEL, + ceviche_model=wdm_model.WdmModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.wdm_spec( + design_extent_ij=u.Array([6400, 6400], u.nm), + intended_sim_resolution=resolution_nm * u.nm, + ), + ), minimum_width=minimum_width, minimum_spacing=minimum_spacing, density_initializer=density_initializer, @@ -414,12 +590,38 @@ def wdm( def lightweight_wdm( minimum_width: int = defaults.LIGHTWEIGHT_MINIMUM_WIDTH, minimum_spacing: int = defaults.LIGHTWEIGHT_MINIMUM_SPACING, + resolution_nm: int = defaults.LIGHTWEIGHT_SIM_RESOLUTION_NM, + wavelengths_nm: Sequence[float] = defaults.LIGHTWEIGHT_WAVELENGTHS_NM, density_initializer: base.DensityInitializer = density_initializer, ) -> CevicheChallenge: - """Waveguide bend with 3.2 x 3.2 um design and lightweight simulation params.""" + """Waveguide bend with 3.2 x 3.2 um design and lightweight simulation params. + + By default, lightweight simulation parameters are used, but these may be overridden. + + Args: + minimum_width: The minimum width target for the challenge, in pixels. The + physical minimum width is approximately 80 nm. + minimum_spacing: The minimum spacing target for the challenge, in pixels. + resolution_nm: The resolution of the simulation and design grid. + wavelengths_nm: The wavelengths for which the response is computed. + density_initializer: Callable which returns the initial density, given a + key and seed density. + + Returns: + The configured `CevicheChallenge`. + """ return CevicheChallenge( component=CevicheComponent( - ceviche_model=defaults.LIGHTWEIGHT_WDM_MODEL, + ceviche_model=wdm_model.WdmModel( + params=params.CevicheSimParams( + resolution=resolution_nm * u.nm, + wavelengths=u.Array(wavelengths_nm, u.nm), + ), + spec=defaults.wdm_spec( + design_extent_ij=u.Array([3200, 3200], u.nm), + intended_sim_resolution=resolution_nm * u.nm, + ), + ), minimum_width=minimum_width, minimum_spacing=minimum_spacing, density_initializer=density_initializer, diff --git a/src/invrs_gym/challenges/ceviche/defaults.py b/src/invrs_gym/challenges/ceviche/defaults.py index 74b55df..4f7d281 100644 --- a/src/invrs_gym/challenges/ceviche/defaults.py +++ b/src/invrs_gym/challenges/ceviche/defaults.py @@ -10,7 +10,6 @@ beam_splitter, mode_converter, model_base, - params, ) from ceviche_challenges import units as u from ceviche_challenges import waveguide_bend, wdm # type: ignore[import-untyped] @@ -50,15 +49,11 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: # ----------------------------------------------------------------------------- -SIM_PARAMS = params.CevicheSimParams( - resolution=10 * u.nm, - wavelengths=u.Array([1265.0, 1270.0, 1275.0, 1285.0, 1290.0, 1295.0], u.nm), -) +SIM_RESOLUTION_NM = 10 +WAVELENGTHS_NM = [1265.0, 1270.0, 1275.0, 1285.0, 1290.0, 1295.0] -LIGHTWEIGHT_SIM_PARAMS = params.CevicheSimParams( - resolution=40 * u.nm, - wavelengths=u.Array([1270.0, 1290.0], u.nm), -) +LIGHTWEIGHT_SIM_RESOLUTION_NM = 40 +LIGHTWEIGHT_WAVELENGTHS_NM = [1270.0, 1290.0] # ----------------------------------------------------------------------------- @@ -77,7 +72,7 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: # ----------------------------------------------------------------------------- -_BEAM_SPLITTER_SPEC = beam_splitter.spec.BeamSplitterSpec( +BEAM_SPLITTER_SPEC = beam_splitter.spec.BeamSplitterSpec( wg_width=WG_WIDTH, wg_length=WG_LENGTH, wg_separation=1040 * u.nm, @@ -91,12 +86,6 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: pml_width=PML_WIDTH_GRIDPOINTS, ) -BEAM_SPLITTER_MODEL = beam_splitter.model.BeamSplitterModel( - params=SIM_PARAMS, spec=_BEAM_SPLITTER_SPEC -) -LIGHTWEIGHT_BEAM_SPLITTER_MODEL = beam_splitter.model.BeamSplitterModel( - params=LIGHTWEIGHT_SIM_PARAMS, spec=_BEAM_SPLITTER_SPEC -) BEAM_SPLITTER_TRANSMISSION_LOWER_BOUND = jnp.asarray( [ 0.0, # |S11|^2 lower bound @@ -121,7 +110,7 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: # ----------------------------------------------------------------------------- -_MODE_CONVERTER_SPEC = mode_converter.spec.ModeConverterSpec( +MODE_CONVERTER_SPEC = mode_converter.spec.ModeConverterSpec( left_wg_width=WG_WIDTH, left_wg_mode_padding=WG_MODE_PADDING, left_wg_mode_order=1, # Fundamental mode. @@ -138,12 +127,6 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: pml_width=PML_WIDTH_GRIDPOINTS, ) -MODE_CONVERTER_MODEL = mode_converter.model.ModeConverterModel( - params=SIM_PARAMS, spec=_MODE_CONVERTER_SPEC -) -LIGHTWEIGHT_MODE_CONVERTER_MODEL = mode_converter.model.ModeConverterModel( - params=LIGHTWEIGHT_SIM_PARAMS, spec=_MODE_CONVERTER_SPEC -) MODE_CONVERTER_TRANSMISSION_LOWER_BOUND = jnp.asarray( [ 0.0, # |S11|^2 lower bound @@ -162,7 +145,7 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: # ----------------------------------------------------------------------------- -_WAVEGUIDE_BEND_SPEC = waveguide_bend.spec.WaveguideBendSpec( +WAVEGUIDE_BEND_SPEC = waveguide_bend.spec.WaveguideBendSpec( wg_width=WG_WIDTH, wg_length=WG_LENGTH, wg_mode_padding=WG_MODE_PADDING, @@ -175,12 +158,6 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: pml_width=PML_WIDTH_GRIDPOINTS, ) -WAVEGUIDE_BEND_MODEL = waveguide_bend.model.WaveguideBendModel( - params=SIM_PARAMS, spec=_WAVEGUIDE_BEND_SPEC -) -LIGHTWEIGHT_WAVEGUIDE_BEND_MODEL = waveguide_bend.model.WaveguideBendModel( - params=LIGHTWEIGHT_SIM_PARAMS, spec=_WAVEGUIDE_BEND_SPEC -) WAVEGUIDE_BEND_TRANSMISSION_LOWER_BOUND = jnp.asarray( [ 0.0, # |S11|^2 lower bound @@ -201,7 +178,7 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray: # ----------------------------------------------------------------------------- -def _make_wdm_spec( +def wdm_spec( design_extent_ij: u.Array, intended_sim_resolution: u.Quantity, ) -> wdm.spec.WdmSpec: @@ -277,20 +254,6 @@ def _make_wdm_spec( ) -WDM_MODEL = wdm.model.WdmModel( - params=SIM_PARAMS, - spec=_make_wdm_spec( - design_extent_ij=u.Array([6400, 6400], u.nm), - intended_sim_resolution=SIM_PARAMS.resolution, - ), -) -LIGHTWEIGHT_WDM_MODEL = wdm.model.WdmModel( - params=LIGHTWEIGHT_SIM_PARAMS, - spec=_make_wdm_spec( - design_extent_ij=u.Array([3200, 3200], u.nm), - intended_sim_resolution=LIGHTWEIGHT_SIM_PARAMS.resolution, - ), -) WDM_TRANSMISSION_LOWER_BOUND = jnp.asarray( [ [ diff --git a/tests/challenges/ceviche/test_defaults.py b/tests/challenges/ceviche/test_defaults.py index cd03be7..8ce6aba 100644 --- a/tests/challenges/ceviche/test_defaults.py +++ b/tests/challenges/ceviche/test_defaults.py @@ -6,45 +6,96 @@ import unittest import numpy as onp +from ceviche_challenges import beam_splitter, mode_converter, params from ceviche_challenges import units as u +from ceviche_challenges import waveguide_bend, wdm from parameterized import parameterized from invrs_gym.challenges.ceviche import defaults +def beam_splitter_model(resolution): + return beam_splitter.model.BeamSplitterModel( + spec=defaults.BEAM_SPLITTER_SPEC, + params=params.CevicheSimParams( + resolution=resolution * u.nm, + wavelengths=u.Array(defaults.WAVELENGTHS_NM, u.nm), + ), + ) + + +def mode_converter_model(resolution): + return mode_converter.model.ModeConverterModel( + spec=defaults.MODE_CONVERTER_SPEC, + params=params.CevicheSimParams( + resolution=resolution * u.nm, + wavelengths=u.Array(defaults.WAVELENGTHS_NM, u.nm), + ), + ) + + +def waveguide_bend_model(resolution): + return waveguide_bend.model.WaveguideBendModel( + spec=defaults.WAVEGUIDE_BEND_SPEC, + params=params.CevicheSimParams( + resolution=resolution * u.nm, + wavelengths=u.Array(defaults.WAVELENGTHS_NM, u.nm), + ), + ) + + +def wdm_model(resolution): + return wdm.model.WdmModel( + spec=defaults.wdm_spec( + design_extent_ij=u.Array([6400, 6400], u.nm), + intended_sim_resolution=resolution * u.nm, + ), + params=params.CevicheSimParams( + resolution=resolution * u.nm, + wavelengths=u.Array(defaults.WAVELENGTHS_NM, u.nm), + ), + ) + + class CreateModelTest(unittest.TestCase): @parameterized.expand( [ - [defaults.BEAM_SPLITTER_MODEL, (320, 200)], - [defaults.LIGHTWEIGHT_BEAM_SPLITTER_MODEL, (80, 50)], - [defaults.MODE_CONVERTER_MODEL, (160, 160)], - [defaults.LIGHTWEIGHT_MODE_CONVERTER_MODEL, (40, 40)], - [defaults.WAVEGUIDE_BEND_MODEL, (160, 160)], - [defaults.LIGHTWEIGHT_WAVEGUIDE_BEND_MODEL, (40, 40)], - [defaults.WDM_MODEL, (640, 640)], - [defaults.LIGHTWEIGHT_WDM_MODEL, (80, 80)], + [beam_splitter_model, 10, (320, 200)], + [beam_splitter_model, 20, (160, 100)], + [beam_splitter_model, 40, (80, 50)], + [mode_converter_model, 10, (160, 160)], + [mode_converter_model, 20, (80, 80)], + [mode_converter_model, 40, (40, 40)], + [waveguide_bend_model, 10, (160, 160)], + [waveguide_bend_model, 20, (80, 80)], + [waveguide_bend_model, 40, (40, 40)], + [wdm_model, 10, (640, 640)], + [wdm_model, 20, (320, 320)], + [wdm_model, 40, (160, 160)], ] ) - def test_design_variable_shapes( - self, ceviche_model, expected_design_variable_shape - ): - self.assertSequenceEqual( - ceviche_model.design_variable_shape, expected_design_variable_shape - ) + def test_beam_splitter_model(self, model_fn, resolution, expected_shape): + model = model_fn(resolution) + self.assertSequenceEqual(model.design_variable_shape, expected_shape) @parameterized.expand( [ - [defaults.BEAM_SPLITTER_MODEL], - [defaults.LIGHTWEIGHT_BEAM_SPLITTER_MODEL], - [defaults.MODE_CONVERTER_MODEL], - [defaults.LIGHTWEIGHT_MODE_CONVERTER_MODEL], - [defaults.WAVEGUIDE_BEND_MODEL], - [defaults.LIGHTWEIGHT_WAVEGUIDE_BEND_MODEL], - [defaults.WDM_MODEL], - [defaults.LIGHTWEIGHT_WDM_MODEL], + [beam_splitter_model, 10], + [beam_splitter_model, 20], + [beam_splitter_model, 40], + [mode_converter_model, 10], + [mode_converter_model, 20], + [mode_converter_model, 40], + [waveguide_bend_model, 10], + [waveguide_bend_model, 20], + [waveguide_bend_model, 40], + [wdm_model, 10], + [wdm_model, 20], + [wdm_model, 40], ] ) - def test_no_structure_within_320nm_of_pml_region(self, ceviche_model): + def test_no_structure_within_320nm_of_pml_region(self, model_fn, resolution): + ceviche_model = model_fn(resolution) density = ceviche_model.density( onp.full(ceviche_model.design_variable_shape, 1.0) )