Skip to content

Commit

Permalink
example: netlist_import.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafacc committed Aug 7, 2020
1 parent d69e557 commit 2bd58d0
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
Binary file added examples/netlist_import/MZI.GDS
Binary file not shown.
31 changes: 31 additions & 0 deletions examples/netlist_import/netlist_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from opics.library import libraries
from opics.network import Network
from opics.utils import netlistParser, NetlistProcessor
from opics.globals import c_
import time, os
from pathlib import Path
#warnings.filterwarnings('ignore') #ignore all/complex number warnings from numpy or scipy

sim_start = time.time()

# read netlist
spice_filepath = Path(os.path.dirname(__file__) + r"\\spice_netlist.spi")

# get netlist data
circuitData = netlistParser(spice_filepath).readfile()

# process netlist data
subckt = NetlistProcessor(spice_filepath, Network, libraries, c_, circuitData)

#simulate network
subckt.simulate_network()

#get input and output net labels
inp_idx = subckt.sim_result.nets[0].index(circuitData["inp_net"])
out_idx = [subckt.sim_result.nets[0].index(each) for each in circuitData["out_net"]]

ports = [[each_output, inp_idx] for each_output in out_idx]

#plot results
subckt.sim_result.plot_sparameters(ports=ports)

26 changes: 26 additions & 0 deletions examples/netlist_import/spice_netlist.spi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
* Spice output from KLayout SiEPIC-Tools v0.4.0, 2020-06-05 08:54:54.

.subckt spice_netlist ebeam_gc_te1550_laser1 ebeam_gc_te1550_detector2 ebeam_gc_te1550_detector3

ebeam_gc_te1550_0 ebeam_gc_te1550_laser1 N$0 GC library="Design kits/ebeam" lay_x=-233.61999999999986E-6 lay_y=-10.639999999999993E-6 sch_x=-9.31169884E0 sch_y=-424.0924389999999E-3
ebeam_y_1550_1 N$0 N$1 N$None Y library="Design kits/ebeam" lay_x=-209.71999999999986E-6 lay_y=-10.639999999999993E-6 sch_x=-8.359085184E0 sch_y=-424.0924389999999E-3
ebeam_y_1550_2 N$1 N$2 N$3 Y library="Design kits/ebeam" lay_x=-194.9199999999999E-6 lay_y=-7.889999999999996E-6 sch_x=-7.769182167E0 sch_y=-314.48208099999994E-3
ebeam_gc_te1550_3 ebeam_gc_te1550_detector2 N$2 GC library="Design kits/ebeam" lay_x=-171.0199999999999E-6 lay_y=-5.139999999999997E-6 sch_x=-6.816568511E0 sch_y=-204.87172299999995E-3 sch_r=180
ebeam_wg_integral_1550_4 N$3 N$4 Waveguide library="Design kits/ebeam" wg_length=62.517u wg_width=0.500u points="[[-187.52,-10.64],[-180.37,-10.64],[-180.37,-60.55],[-188.93,-60.55]]" radius=5.0 lay_x=-184.2749999999999E-6 lay_y=-35.59499999999998E-6 sch_x=-7.344890436E0 sch_y=-1.418756614E0
ebeam_gc_te1550_5 ebeam_gc_te1550_detector3 N$4 GC library="Design kits/ebeam" lay_x=-205.42999999999986E-6 lay_y=-60.54999999999997E-6 sch_x=-8.188093026E0 sch_y=-2.413420789E0
.ends spice_netlist

spice_netlist ebeam_gc_te1550_laser1 ebeam_gc_te1550_detector2 ebeam_gc_te1550_detector3 spice_netlist sch_x=-1 sch_y=-1


.ona input_unit=wavelength input_parameter=start_and_stop
+ interconnect_loss = -0.5
+ analysis_type = scattering_data
+ orthogonal_identifier = 1
+ start = 0.00000153
+ stop = 0.00000158
+ number_of_points = 2000
+ input = spice_netlist,ebeam_gc_te1550_laser1
+ output(1) = test2_2,ebeam_gc_te1550_detector2
+ output(2) = test2_2,ebeam_gc_te1550_detector3

15 changes: 15 additions & 0 deletions examples/netlist_import/test_main.spi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* Spice output from KLayout SiEPIC-Tools v0.4.0, 2020-05-21 11:23:25.

* Optical Network Analyzer:
.ona input_unit=wavelength input_parameter=start_and_stop
+ minimum_loss=80
+ analysis_type=scattering_data
+ multithreading=user_defined number_of_threads=1
+ orthogonal_identifier=1
+ start=1500.000e-9
+ stop=1600.000e-9
+ number_of_points=2000
+ input(1)=test,ebeam_gc_te1550_detector2
+ output=test,ebeam_gc_te1550_laser1
.INCLUDE "C:\Users\root\AppData\Local\Temp\tmpwqbdaq9f\test.spi"

0 comments on commit 2bd58d0

Please sign in to comment.