Skip to content

Commit

Permalink
Merge pull request #145 from invrs-io/swapwvl
Browse files Browse the repository at this point in the history
Fixes to meta-atom library and ceviche beamsplitter
  • Loading branch information
mfschubert authored Sep 27, 2024
2 parents 55e906c + fd545bf commit a1cb51e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "v1.4.0"
current_version = "v1.4.1"
commit = true
commit_args = "--no-verify"
tag = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# invrs-gym
`v1.4.0`
`v1.4.1`

## Overview
The `invrs_gym` package is an open-source gym containing a diverse set of photonic design challenges, which are relevant for a wide range of applications such as AR/VR, optical networking, LIDAR, and others.
Expand Down
8 changes: 4 additions & 4 deletions docs/notebooks/challenges/meta_atom_library.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@
"source": [
"# Data from figs 2a and 2b of Chen et al.\n",
"expected_conserved = (\n",
" (0.000, 0.501, 1.137, 1.910, 2.259, 3.693, 4.005, 4.641), # 450 nm\n",
" (0.000, 0.451, 1.212, 1.985, 2.471, 3.843, 4.641, 5.489), # 450 nm\n",
" (0.000, 0.925, 1.898, 2.783, 3.195, 4.354, 5.140, 5.738), # 550 nm\n",
" (0.000, 0.451, 1.212, 1.985, 2.471, 3.843, 4.641, 5.489), # 650 nm\n",
" (0.000, 0.501, 1.137, 1.910, 2.259, 3.693, 4.005, 4.641), # 650 nm\n",
")\n",
"expected_converted = (\n",
" (0.000, 0.502, 1.137, 1.945, 2.306, 3.600, 3.861, 4.843), # 450 nm\n",
" (0.000, 0.391, 1.137, 1.821, 2.194, 3.749, 4.632, 5.465), # 450 nm\n",
" (0.000, 0.900, 2.331, 2.567, 3.052, 4.308, 4.433, 5.540), # 550 nm\n",
" (0.000, 0.391, 1.137, 1.821, 2.194, 3.749, 4.632, 5.465), # 650 nm\n",
" (0.000, 0.502, 1.137, 1.945, 2.306, 3.600, 3.861, 4.843), # 650 nm \n",
")\n",
"\n",
"_, axs = plt.subplots(2, 3, figsize=(8, 5))\n",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]

name = "invrs_gym"
version = "v1.4.0"
version = "v1.4.1"
description = "A collection of inverse design challenges"
keywords = ["topology", "optimization", "jax", "inverse design"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/invrs_gym/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Copyright (c) 2023 The INVRS-IO authors.
"""

__version__ = "v1.4.0"
__version__ = "v1.4.1"
__author__ = "Martin F. Schubert <[email protected]>"

from invrs_gym import challenges as challenges
Expand Down
2 changes: 1 addition & 1 deletion src/invrs_gym/challenges/ceviche/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _linear_from_decibels(x_decibels: float) -> jnp.ndarray:
BEAM_SPLITTER_SPEC = beam_splitter.spec.BeamSplitterSpec(
wg_width=WG_WIDTH,
wg_length=WG_LENGTH,
wg_separation=1040 * u.nm,
wg_separation=1120 * u.nm,
wg_mode_padding=WG_MODE_PADDING,
port_pml_offset=PORT_PML_OFFSET,
variable_region_size=(3200 * u.nm, 2000 * u.nm),
Expand Down
55 changes: 16 additions & 39 deletions tests/challenges/library/test_reference_nanostructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,25 @@

# The nanostructure phases from Chen 2023, Figure 2a and 2b.
EXPECTED_RELATIVE_PHASE_CONSERVED = (
# 450, 550, 650 nm
(0.000, 0.000, 0.000),
(0.501, 0.925, 0.451),
(1.137, 1.898, 1.212),
(1.910, 2.783, 1.985),
(2.259, 3.195, 2.471),
(3.693, 4.354, 3.843),
(4.005, 5.140, 4.641),
(4.641, 5.738, 5.489),
(0.451, 0.925, 0.501),
(1.212, 1.898, 1.137),
(1.985, 2.783, 1.910),
(2.471, 3.195, 2.259),
(3.843, 4.354, 3.693),
(4.641, 5.140, 4.005),
(5.489, 5.738, 4.641),
)
EXPECTED_RELATIVE_PHASE_CONVERTED = (
(0.000, 0.000, 0.000),
(0.502, 0.900, 0.391),
(0.391, 0.900, 0.502),
(1.137, 2.331, 1.137),
(1.945, 2.567, 1.821),
(2.306, 3.052, 2.194),
(3.600, 4.308, 3.749),
(3.861, 4.433, 4.632),
(4.843, 5.540, 5.465),
)

ATOL_CONSERVED = (
(0.1, 0.1, 0.1),
(0.1, 0.1, 0.1),
(0.1, 0.2, 0.2),
(0.1, 0.2, 0.2),
(0.3, 0.1, 0.4),
(0.2, 0.1, 0.3),
# Final two nanostructures have larger error for some unknown reason.
(0.6, 0.1, 0.9),
(0.8, 0.2, 1.0),
)
ATOL_CONVERTED = (
(0.1, 0.1, 0.1),
(0.1, 0.1, 0.1),
(0.1, 0.2, 0.2),
(0.1, 0.1, 0.1),
(0.1, 0.1, 0.1),
(0.3, 0.2, 0.4),
(0.8, 0.1, 1.1),
(0.6, 0.2, 0.9),
(1.821, 2.567, 1.945),
(2.194, 3.052, 2.306),
(3.749, 4.308, 3.600),
(4.632, 4.433, 3.861),
(5.465, 5.540, 4.843),
)


Expand Down Expand Up @@ -128,18 +107,16 @@ def _relative_phase(t):
expected_converted = onp.asarray(EXPECTED_RELATIVE_PHASE_CONVERTED)[
:, color_idx
]
atol_conserved = onp.asarray(ATOL_CONSERVED)[:, color_idx]
atol_converted = onp.asarray(ATOL_CONVERTED)[:, color_idx]
for i in range(8):
with self.subTest(f"nanostructure_{i}_color_{color_idx}_conserved"):
onp.testing.assert_allclose(
phase_conserved[i, color_idx],
expected_conserved[i],
atol=atol_conserved[i],
rtol=0.12,
)
with self.subTest(f"nanostructure_{i}_color_{color_idx}_converted"):
onp.testing.assert_allclose(
phase_converted[i, color_idx],
expected_converted[i],
atol=atol_converted[i],
rtol=0.12,
)

0 comments on commit a1cb51e

Please sign in to comment.