Skip to content

Commit

Permalink
improve notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
joamatab committed Sep 7, 2023
1 parent 91d3707 commit 8c233a3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 45 deletions.
20 changes: 12 additions & 8 deletions notebooks/10_layout.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,6 @@
"scene = c.to_3d()\n",
"scene.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "49db073e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -852,6 +844,18 @@
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
16 changes: 12 additions & 4 deletions notebooks/22_heater_fem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"import gmsh\n",
"import gdsfactory as gf\n",
"from gplugins.gmsh.mesh import create_physical_mesh\n",
"from gplugins.thermal import solve_thermal\n",
"from gplugins.femwell import solve_thermal\n",
"from gdsfactory.generic_tech import get_generic_pdk\n",
"from gdsfactory.technology import LayerStack, LayerLevel\n",
"import meshio\n",
Expand All @@ -37,7 +37,7 @@
"gf.generic_tech.LAYER_STACK.layers[\"heater\"].zmin = 2.2\n",
"\n",
"heater = gf.components.straight_heater_metal(length=50, heater_width=2)\n",
"heater"
"heater.plot()"
]
},
{
Expand Down Expand Up @@ -76,7 +76,7 @@
"\n",
"def mesh_with_physicals(mesh, filename):\n",
" mesh_from_file = meshio.read(f\"{filename}.msh\")\n",
" return create_physical_mesh(mesh_from_file, \"triangle\", prune_z=True)"
" return create_physical_mesh(mesh_from_file, \"triangle\")"
]
},
{
Expand Down Expand Up @@ -275,6 +275,14 @@
"plt.plot(currents * 1e3, neffs)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e318560a",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -298,7 +306,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
21 changes: 6 additions & 15 deletions notebooks/30_mzi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"source": [
"import gplugins as sim\n",
"import gdsfactory as gf\n",
"import gplugins.gtidy3d as gt\n",
"import gplugins.tidy3d as gt\n",
"import gdsfactory.components as pdk\n",
"from gdsfactory.config import PATH"
]
Expand All @@ -230,7 +230,7 @@
"outputs": [],
"source": [
"c = pdk.mmi1x2()\n",
"c"
"c.plot()"
]
},
{
Expand Down Expand Up @@ -279,16 +279,7 @@
"\n",
"We are going to simulate a MZI interferometer circuit.\n",
"For that we need to simulate each of the component Sparameters in tidy3d and then SAX Sparameter circuit solver to solve the Sparameters for the circuit.\n",
"\n",
"We will be using SAX which is an open source circuit simulator.\n",
"\n",
"\n",
"```\n",
"set PIP_FIND_LINKS=\"https://whls.blob.core.windows.net/unstable/index.html\"\n",
"pip install sax jax \n",
"pip install \"jaxlib[cuda111]\" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver\n",
"pip install \"gdsfactory[tidy3d,sax]\"\n",
"```"
"We will be using SAX which is an open source circuit simulator."
]
},
{
Expand All @@ -299,7 +290,7 @@
"outputs": [],
"source": [
"mzi10 = gf.components.mzi(splitter=c, delta_length=10)\n",
"mzi10"
"mzi10.plot()"
]
},
{
Expand Down Expand Up @@ -398,7 +389,7 @@
"outputs": [],
"source": [
"mzi20 = gf.components.mzi(splitter=c, delta_length=20)\n",
"mzi20"
"mzi20.plot()"
]
},
{
Expand Down Expand Up @@ -453,7 +444,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
28 changes: 10 additions & 18 deletions notebooks/31_ring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"import gdsfactory as gf\n",
"\n",
"c = gf.components.ring_single_heater(gap=0.2, radius=10, length_x=4)\n",
"c"
"c.plot()"
]
},
{
Expand Down Expand Up @@ -183,17 +183,7 @@
"source": [
"ring = gf.components.ring_single_heater(gap=0.2, radius=10, length_x=4)\n",
"ring_with_grating_couplers = gf.routing.add_fiber_array(ring)\n",
"ring_with_grating_couplers"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aeb11c83",
"metadata": {},
"outputs": [],
"source": [
"gf.routing.add_electrical_pads_top_dc(ring_with_grating_couplers)"
"ring_with_grating_couplers.plot()"
]
},
{
Expand All @@ -203,7 +193,9 @@
"metadata": {},
"outputs": [],
"source": [
"gf.routing.add_electrical_pads_top(ring_with_grating_couplers)"
"port_names = [\"r_e2\", \"l_e1\"]\n",
"c = gf.routing.add_pads_top(ring_with_grating_couplers, port_names = port_names)\n",
"c.plot()"
]
},
{
Expand Down Expand Up @@ -242,7 +234,7 @@
" gf.routing.add_fiber_array(ring) for ring in rings_heater\n",
"]\n",
"rings_with_pads = [\n",
" gf.routing.add_electrical_pads_top(ring)\n",
" gf.routing.add_pads_top(ring, port_names=port_names)\n",
" for ring in rings_heater_with_grating_couplers\n",
"]\n",
"\n",
Expand All @@ -259,7 +251,7 @@
"\n",
"\n",
"m = reticle(cache=False)\n",
"m"
"m.plot()"
]
},
{
Expand All @@ -281,7 +273,7 @@
" gf.routing.add_fiber_array(ring) for ring in rings_heater\n",
"]\n",
"rings_with_pads = [\n",
" gf.routing.add_electrical_pads_top(ring)\n",
" gf.routing.add_pads_top(ring, port_names=port_names)\n",
" for ring in rings_heater_with_grating_couplers\n",
"]\n",
"\n",
Expand All @@ -302,7 +294,7 @@
"\n",
"\n",
"m = reticle(cache=False)\n",
"m"
"m.plot()"
]
},
{
Expand Down Expand Up @@ -380,7 +372,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 8c233a3

Please sign in to comment.