Skip to content

Commit 5400f7b

Browse files
committed
v0.1.3
1 parent f15266c commit 5400f7b

File tree

8 files changed

+155
-7
lines changed

8 files changed

+155
-7
lines changed

contra_directional_couplers/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ packages = [
44
"siepic_contradc",
55
]
66

7+
[tool.setuptools.dynamic]
8+
version = {attr = "siepic_contradc.__version__"}
9+
710

811
[project]
912
name = "siepic_contradc"
10-
version = "0.1.2"
13+
#version = "0.1.2"
14+
dynamic = ["version"]
1115
authors = [
1216
{ name="Mustafa Hammood", email="mustafastation@gmail.com" },
1317
]

contra_directional_couplers/siepic_contradc/ContraDC.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#%%
2-
from modules import *
3-
from utils import *
2+
from .modules import *
3+
from .utils import *
44

55

66
class ContraDC():
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import examples

contra_directional_couplers/siepic_contradc/Tutorial/examples.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
os.environ["QT_QPA_PLATFORM"] = "xcb" # because lumerical's being weird in linux
1010

1111
# import ContraDC module
12-
from ContraDC import *
12+
# from ContraDC import *
1313

14+
from ..ContraDC import ContraDC
15+
from ..modules import *
1416

1517
def examples(num):
1618
""" Function implements 4 use-case examples """
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
print("Python package: SiEPIC_ContraDC. ")
2-
#__version__ = "0.2.0"
1+
__version__ = "0.1.3"
32

3+
print("Python package: SiEPIC_ContraDC, v%s" % __version__)
4+
5+
6+
from . import ContraDC, modules, utils

contra_directional_couplers/siepic_contradc/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
jonathan.cauchon.2@ulaval.ca
66
"""
77

8-
from modules import *
8+
from .modules import *
99

1010
"""
1111
Basic

example.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import siepic_contradc
3+
import siepic_contradc.ContraDC as ContraDC
4+
from siepic_contradc import Tutorial
5+
Tutorial.examples.examples(1)
6+

examples.py

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
2+
import siepic_contradc
3+
from siepic_contradc.ContraDC import ContraDC
4+
from siepic_contradc.modules import *
5+
6+
7+
def examples(num):
8+
""" Function implements 4 use-case examples """
9+
10+
""" Example 1: regular SOI Contra-DC """
11+
if num ==1:
12+
13+
# instantiate, simulate and show result
14+
device = ContraDC().simulate().displayResults()
15+
16+
# calculate thimpe group delay
17+
device.getGroupDelay()
18+
19+
# plot group delay
20+
plt.figure()
21+
plt.plot(device.wavelength*1e9, device.group_delay*1e12)
22+
plt.xlabel("Wavelength (nm)")
23+
plt.ylabel("Tg (ps)")
24+
25+
plt.show()
26+
27+
28+
29+
""" Example 2: Full chirped example.
30+
Create a CDC with chirped w1, w2, period, temperature.
31+
"""
32+
if num == 2:
33+
34+
# Waveguide chirp
35+
w1 = [.56e-6, .56e-6]
36+
w2 = [.44e-6, .44e-6]
37+
w_chirp_step = .1e-9
38+
39+
# Period chirp
40+
period = [310e-9, 320e-9]
41+
42+
43+
# apod shape
44+
apod_shape = "gaussian"
45+
46+
N = 10000
47+
48+
device = ContraDC(N=N, w1=w1, w2=w2, apod_shape=apod_shape, period_chirp_step=1e-9,
49+
w_chirp_step=w_chirp_step, period=period, N_seg=1500,
50+
kappa = 10000, a=0, alpha=1.5, wvl_range=[1500e-9,1600e-9])
51+
52+
device.simulate().displayResults()
53+
54+
55+
56+
""" Example 3: defining custom chirp profiles
57+
"""
58+
if num == 3:
59+
60+
device = ContraDC(apod_shape="tanh")
61+
62+
z = np.linspace(0, device.N_seg, device.N_seg)
63+
device.w1_profile = device.w1*np.cos(z/600)
64+
device.w2_profile = device.w2*np.cos(z/600)
65+
66+
device.simulate().displayResults()
67+
68+
69+
70+
""" Example 4: using custom supermode indices.
71+
You might want to use this if you are designing
72+
with silicon nitride, of using other waveguide specs than
73+
SOI, 100-nm gap.
74+
"""
75+
if num == 4:
76+
77+
import os
78+
current_dir = os.path.dirname(__file__)
79+
polyfit_file_path = os.path.join(current_dir, "SiN_1550_TE_w1_850nm_w2_1150nm_thickness_400nm.txt")
80+
device = ContraDC(polyfit_file=polyfit_file_path, period=335e-9)
81+
device.simulate().displayResults()
82+
83+
84+
85+
"""Example 5: Lumerical-assisted flow
86+
"""
87+
if num == 5:
88+
89+
apod_shape = "tanh"
90+
period = 318e-9
91+
w1 = 560e-9
92+
w2 = 440e-9
93+
94+
device = ContraDC(w1= w1, w2=w2, apod_shape=apod_shape, period=period)
95+
96+
device.simulate()
97+
plt.plot(device.wavelength*1e9, device.drop)
98+
plt.plot(device.wavelength*1e9, device.thru)
99+
plt.show()
100+
101+
# Generate compact model for Lumerical INTERCONNECT
102+
device.gen_sparams() # this will create a ContraDC_sparams.dat file to import into INTC
103+
104+
"""Example 6: Complete Lumerical flow - simulate coupling coefficient (not simulating mode profiles)
105+
"""
106+
if num == 6:
107+
108+
apod_shape = "tanh"
109+
period = 318e-9
110+
w1 = 560e-9
111+
dw1 = 25e-9
112+
w2 = 440e-9
113+
dw2 = 50e-9
114+
gap = 100e-9
115+
116+
device = ContraDC(w1= w1, dw1=dw1, w2=w2, dw2=dw2, gap=gap, apod_shape=apod_shape, period=period)
117+
118+
device.simulate_kappa()
119+
device.simulate().displayResults()
120+
plt.plot(device.wavelength*1e9, device.drop)
121+
plt.plot(device.wavelength*1e9, device.thru)
122+
plt.show()
123+
124+
# Generate compact model for Lumerical INTERCONNECT
125+
device.gen_sparams() # this will create a ContraDC_sparams.dat file to import into INTC
126+
127+
128+
if __name__ == "__main__":
129+
examples(3)
130+
131+
132+

0 commit comments

Comments
 (0)