First simple circuit design


The goal of this sample is to give you a first idea of the principles behind IPKISS through the design of a simple functional circuit: a ring resonator connected to grating couplers.

Layout of a connected ring_resonator.

Layout of a ring resonator connected to grating couplers.

Circuit simulation of the  connected ring_resonator.

Transmission and reflection spectra of a ring resonator connected to grating couplers, obtained by circuit simulation.


  1. how to import a technology file.
  2. how to use the Layout of an existing component.
  3. how to use the circuit model of an existing component.
  4. how to build a circuit using place and auto-route.
  5. how to perform a circuit simulation of a circuit.

Files (see: samples/ipkiss3/samples/athermal_mzi)

There is 1 file contained in this sample.

How to run this example

To run the example, run ‘’

# 1.  Importing the technology file.
from technologies import silicon_photonics
from ipkiss3 import all as i3

# 2. Import other python libraries.
import numpy as np
import pylab as plt

# 3. Creating the ring resonator
from picazzo3.filters.ring import RingRect180DropFilter
my_ring = RingRect180DropFilter()

# 4. Setting the layout properties of the ring.
my_ring_layout = my_ring.Layout(bend_radius=10.0) # We set the bend radius of the ring to 10.
my_ring_layout.visualize() # We visualize the layout of the ring

# 5. Setting the properties of the caphemodel (circuit model) of the ring.
cp = dict(cross_coupling1=1j*0.3**0.5,
          straight_coupling1=0.7**0.5) #The coupling from bus to ring and back

my_ring_cm = my_ring.CircuitModel(ring_length=2 * np.pi * my_ring_layout.bend_radius, # we can manually specify the ring length,                                                                                    #we be take it from the layout
                                  coupler_parameters=[cp, cp]) # 2 couplers

# 6. Simulating the ring.
wavelengths =  np.linspace(1.50, 1.6, 2001)
S = my_ring_cm.get_smatrix(wavelengths=wavelengths)

plt.plot(wavelengths, np.abs(S['in1', 'out1'])**2, 'b', label="pass")
plt.plot(wavelengths, np.abs(S['in1', 'out2'])**2, 'r', label="drop")
plt.plot(wavelengths, np.abs(S['in1', 'in2'])**2, 'g', label="add")

plt.xlabel("Wavelength ($\mu m$)")
plt.ylabel("Power transmission")

# 7. Creating the grating coupler.
from picazzo3.fibcoup.curved import FiberCouplerCurvedGrating
my_grating = FiberCouplerCurvedGrating()

# 8. Setting the layout properties of the grating layout.
my_grating_layout = my_grating.Layout(n_o_lines=24, period_x=0.65, box_width=15.5)

# 9. Setting the properties of the circuit model and simulate.
my_grating_cm = my_grating.CircuitModel(center_wavelength=1.55,

S = my_grating_cm.get_smatrix(wavelengths=wavelengths)
plt.plot(wavelengths, np.abs(S['vertical_in', 'out'])**2, 'b', label="pass")

# 10. Create the place and auto-route.
from picazzo3.routing.place_route import PlaceAndAutoRoute
my_circuit = PlaceAndAutoRoute(child_cells={"in_grating": my_grating,
                                            "pass_grating": my_grating,
                                            "add_grating" : my_grating,
                                            "drop_grating" : my_grating,
                                            "ring" : my_ring},

                                   links=[("in_grating:out", "ring:in1"),
                                          ("pass_grating:out", "ring:out1"),
                                          ("add_grating:out", "ring:in2"),
                                          ("drop_grating:out", "ring:out2")]

# 11. Setting the transformations of the childcells in the layoutview..
distance_x = 100.0
distance_y = 30.0
my_circuit_layout = my_circuit.Layout(child_transformations={"ring": (0, 0),
                                                             "in_grating": i3.Rotation(rotation=0) + i3.Translation((-distance_x, -distance_y)),
                                                             "pass_grating": i3.Rotation(rotation=180) + i3.Translation((distance_x, -distance_y)),
                                                             "add_grating": i3.Rotation(rotation=180) + i3.Translation((distance_x, distance_y)),
                                                             "drop_grating": i3.Rotation(rotation=0) + i3.Translation((-distance_x, distance_y)),

# 12. Simulate
my_circuit_cm = my_circuit.CircuitModel()
S = my_circuit_cm.get_smatrix(wavelengths=wavelengths)

plt.plot(wavelengths, np.abs(S['in_grating_vertical_in', 'pass_grating_vertical_in'])**2, 'b', label="pass")
plt.plot(wavelengths, np.abs(S['in_grating_vertical_in', 'drop_grating_vertical_in'])**2, 'r', label="drop")
plt.plot(wavelengths, np.abs(S['in_grating_vertical_in', 'add_grating_vertical_in'])**2, 'g', label="add")
plt.plot(wavelengths, np.abs(S['in_grating_vertical_in', 'in_grating_vertical_in'])**2, 'k', label="reflection")