-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from gdsfactory/add_models
add models
- Loading branch information
Showing
60 changed files
with
1,651 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
install: | ||
pip install -e .[dev] | ||
pre-commit install | ||
|
||
dev: | ||
pip install -e .[dev,docs] | ||
|
||
test: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,67 @@ | ||
from __future__ import annotations | ||
|
||
from functools import partial | ||
|
||
from gplugins.sax import models as sm | ||
from gplugins.sax.models import ( | ||
attenuator, | ||
bend, | ||
coupler, | ||
grating_coupler, | ||
mmi1x2, | ||
mmi2x2, | ||
phase_shifter, | ||
straight, | ||
) | ||
|
||
nm = 1e-3 | ||
|
||
straight_sc = partial(sm.straight, neff=2.34, ng=4.2, wl0=1.55) | ||
straight_so = partial(sm.straight, neff=2.34, ng=4.2, wl0=1.31) | ||
|
||
gc_rectangular_sc = partial(sm.grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.55) | ||
gc_rectangular_so = partial(sm.grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.31) | ||
straight_sc = partial(straight, wl0=1.55, neff=2.4, ng=4.2) | ||
straight_so = partial(straight, wl0=1.31, neff=2.4, ng=4.2) | ||
straight_rc = partial(straight, wl0=1.55, neff=2.4, ng=4.2) | ||
straight_ro = partial(straight, wl0=1.31, neff=2.4, ng=4.2) | ||
straight_nc = partial(straight, wl0=1.55, neff=2.4, ng=4.2) | ||
straight_no = partial(straight, wl0=1.31, neff=2.4, ng=4.2) | ||
|
||
bend_sc = partial(bend, loss=0.03) | ||
bend_so = partial(bend, loss=0.03) | ||
bend_rc = partial(bend, loss=0.03) | ||
bend_ro = partial(bend, loss=0.03) | ||
bend_nc = partial(bend, loss=0.03) | ||
bend_no = partial(bend, loss=0.03) | ||
|
||
bend_sc = partial(sm.bend, loss=0.03) | ||
bend_so = partial(sm.bend, loss=0.03) | ||
bend_rc = partial(sm.bend, loss=0.03) | ||
bend_ro = partial(sm.bend, loss=0.03) | ||
bend_nc = partial(sm.bend, loss=0.03) | ||
bend_no = partial(sm.bend, loss=0.03) | ||
gc_rectangular_sc = partial(grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.55) | ||
gc_rectangular_so = partial(grating_coupler, loss=6, bandwidth=35 * nm, wl0=1.31) | ||
|
||
|
||
models = dict( | ||
straight_sc=straight_sc, | ||
straight_so=straight_so, | ||
gc_rectangular_sc=gc_rectangular_sc, | ||
gc_rectangular_so=gc_rectangular_so, | ||
bend_sc=bend_sc, | ||
bend_so=bend_so, | ||
bend_rc=bend_rc, | ||
bend_ro=bend_ro, | ||
attenuator=attenuator, | ||
bend_euler=bend, | ||
bend_nc=bend_nc, | ||
bend_no=bend_no, | ||
bend_rc=bend_rc, | ||
bend_ro=bend_ro, | ||
bend_sc=bend_sc, | ||
bend_so=bend_so, | ||
coupler=coupler, | ||
gc_rectangular_sc=gc_rectangular_sc, | ||
gc_rectangular_so=gc_rectangular_so, | ||
mmi1x2=mmi1x2, | ||
mmi2x2=mmi2x2, | ||
phase_shifter=phase_shifter, | ||
straight=straight, | ||
straight_sc=straight_sc, | ||
straight_so=straight_so, | ||
straight_rc=straight_rc, | ||
straight_ro=straight_ro, | ||
straight_nc=straight_nc, | ||
straight_no=straight_no, | ||
taper=straight, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
import gplugins.sax as gs | ||
|
||
gs.plot_model(grating_coupler) | ||
# gs.plot_model(coupler) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import jax.numpy as jnp | ||
import matplotlib.pyplot as plt | ||
import sax | ||
|
||
import cspdk | ||
from cspdk.models import models | ||
|
||
if __name__ == "__main__": | ||
c = cspdk.cells.mzi_nc(delta_length=20) | ||
netlist = c.get_netlist() | ||
circuit, _ = sax.circuit(netlist, models=models) | ||
wl = jnp.linspace(1.5, 1.6) | ||
|
||
S = circuit(wl=wl) | ||
plt.figure(figsize=(14, 4)) | ||
plt.title("MZI") | ||
plt.plot(1e3 * wl, jnp.abs(S["o1", "o2"]) ** 2) | ||
plt.xlabel("λ [nm]") | ||
plt.ylabel("T") | ||
plt.grid(True) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
sample_pads = """ | ||
name: pads | ||
pdk: cspdk | ||
instances: | ||
bl: | ||
component: pad | ||
tl: | ||
component: pad | ||
br: | ||
component: pad | ||
tr: | ||
component: pad | ||
placements: | ||
tl: | ||
x: -200 | ||
y: 500 | ||
br: | ||
x: 400 | ||
y: 400 | ||
tr: | ||
x: 400 | ||
y: 600 | ||
routes: | ||
electrical: | ||
settings: | ||
cross_section: xs_metal_routing | ||
separation: 20 | ||
width: 10 | ||
path_length_match_loops: 2 | ||
end_straight_length: 100 | ||
links: | ||
tl,e3: tr,e1 | ||
bl,e3: br,e1 | ||
optical: | ||
settings: | ||
cross_section: xs_sc | ||
radius: 100 | ||
links: | ||
bl,e4: br,e3 | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
import gdsfactory as gf | ||
|
||
c = gf.read.from_yaml(sample_pads) | ||
c.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.