|
44 | 44 | "from rich.logging import RichHandler\n",
|
45 | 45 | "from scipy import constants\n",
|
46 | 46 | "from sklearn.linear_model import LinearRegression\n",
|
47 |
| - "from tqdm.notebook import trange, tqdm\n", |
| 47 | + "from tqdm.notebook import tqdm, trange\n", |
48 | 48 | "\n",
|
49 | 49 | "import gplugins.sax as gs\n",
|
50 | 50 | "import gplugins.tidy3d as gt\n",
|
|
788 | 788 | " mmi_in = gf.components.mmi1x2()\n",
|
789 | 789 | " mmi_out = gf.components.mmi2x2()\n",
|
790 | 790 | " bend = gf.components.bend_euler()\n",
|
791 |
| - " half_delay_straight = gf.components.straight(length=delta_length/2)\n", |
| 791 | + " half_delay_straight = gf.components.straight(length=delta_length / 2)\n", |
792 | 792 | "\n",
|
793 | 793 | " # references\n",
|
794 | 794 | " mmi_in = c.add_ref(mmi_in, name=\"mmi_in\")\n",
|
|
1061 | 1061 | " fn = f\"{wl=:.2f}-{n_box=:.2f}-{n_clad=:.2f}-{n_core=:.2f}-{t_slab=:.3f}-{t_soi=:.3f}-{w_core=:.3f}-{du=:.3f}-{n_modes=}.json\"\n",
|
1062 | 1062 | " path = os.path.join(cache_path, fn)\n",
|
1063 | 1063 | " if not replace_cached and os.path.exists(path):\n",
|
1064 |
| - " return [mw.Mode.parse_obj(mode) for mode in json.load(open(path, \"r\"))]\n", |
| 1064 | + " return [mw.Mode.parse_obj(mode) for mode in json.load(open(path))]\n", |
1065 | 1065 | "\n",
|
1066 | 1066 | " # fmt: off\n",
|
1067 | 1067 | " m_core = mw.SampledMaterial(name=\"slab\", n=np.asarray([n_core, n_core]), params={\"wl\": np.asarray([1.0, 2.0])}, meta={\"color\": (0.9, 0, 0, 0.9)})\n",
|
1068 |
| - " m_clad = mw.SampledMaterial(name=\"clad\", n=np.asarray([n_clad, n_clad]), params={\"wl\": np.asarray([1.0, 2.0])}) \n", |
| 1068 | + " m_clad = mw.SampledMaterial(name=\"clad\", n=np.asarray([n_clad, n_clad]), params={\"wl\": np.asarray([1.0, 2.0])})\n", |
1069 | 1069 | " m_box = mw.SampledMaterial(name=\"box\", n=np.asarray([n_box, n_box]), params={\"wl\": np.asarray([1.0, 2.0])})\n",
|
1070 | 1070 | " box = mw.Structure(material=m_box, geometry=mw.Box(x_min=- 2 * w_core - delta, x_max= 2 * w_core + delta, y_min=- 2 * t_soi - delta, y_max=0.0, z_min=0.0, z_max=length))\n",
|
1071 | 1071 | " slab = mw.Structure(material=m_core, geometry=mw.Box(x_min=-2 * w_core - delta, x_max=2 * w_core + delta, y_min=0.0, y_max=t_slab, z_min=0.0, z_max=length))\n",
|
1072 | 1072 | " clad = mw.Structure(material=m_clad, geometry=mw.Box(x_min=-2 * w_core - delta, x_max=2 * w_core + delta, y_min=0, y_max=3 * t_soi + delta, z_min=0.0, z_max=length))\n",
|
1073 | 1073 | " core = mw.Structure(material=m_core, geometry=mw.Box(x_min=-w_core / 2, x_max=w_core / 2, y_min=0.0, y_max=t_soi, z_min=0.0, z_max=length))\n",
|
1074 |
| - " \n", |
| 1074 | + "\n", |
1075 | 1075 | " cell = mw.Cell(structures=[box, clad, slab, core], mesh=mw.Mesh2D( x=np.arange(-2*w_core, 2*w_core, du), y=np.arange(-2*t_soi, 3*t_soi, du), ), z_min=0.0, z_max=10.0)\n",
|
1076 | 1076 | " cross_section = mw.CrossSection.from_cell(cell=cell, env=env)\n",
|
1077 | 1077 | " modes = mw.compute_modes(cross_section, num_modes=n_modes)\n",
|
|
0 commit comments