Note
Click here to download the full example code
Simulating an aperture with CAMFR¶
This simple example illustrates the integration of SlabSim in IPKISS. It requires the IPKISS AWG Designer module. We make a simple aperture and run a CAMFR simulation on it.
Note: do not use this aperture in a real design, this is only for illustration purposes and not designed optimally.
Getting started¶
We start by importing the technology with other required modules:
from si_fab import all as pdk
import numpy
import pylab as plt
From IPKISS’ AWG Designer and si_fab_awg, we import the following:
from awg_designer.all import SimpleSlabMode
from si_fab_awg.all import SiRibAperture, SiSlabTemplate
The Environment object is needed to specify the wavelength of interest.
from pysics.basics.environment import Environment
Template for the free propagation region. This defines the layers, slab modes, etc.
slab_t = SiSlabTemplate()
slab_t.Layout()
slab_t.SlabModes(modes=[SimpleSlabMode(name="TE0", n_eff=2.8, n_g=3.2, polarization="TE")])
<SiSlabTemplate.SlabModes view 'TEMPLATE_1:slabmodes'>
Specify the wavelength of interest
environment = Environment(wavelength=1.55)
The aperture¶
Make an aperture consisting of a transition between two trace templates. Trace template at the aperture
ap_wg_t = pdk.SiRibWaveguideTemplate()
ap_wg_t.Layout(core_width=2.0)
<SiRibWaveguideTemplate.Layout view 'SI_FAB_RIB_WGTEMPLATE_1:layout'>
Trace template at the waveguide port
wg_t = pdk.SiWireWaveguideTemplate()
wg_t.Layout(core_width=0.4)
<SiWireWaveguideTemplate.Layout view 'SI_FAB_WIRE_WGTEMPLATE_6:layout'>
The aperture
ap = SiRibAperture(
slab_template=slab_t,
aperture_trace_template=ap_wg_t,
trace_template=wg_t,
taper_length=30,
)
ap_lo = ap.Layout() # the length is calculated by default
ap_lo.visualize()
ap_lo.visualize_2d()
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_elements.py:132: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
shapely_polygon = cascaded_union(MultiPolygon(shapely_polygons))
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:112: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(mp)
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:115: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(p)
/bbotworker/DEPLOY_IPKISSDOC/build/_blddoc/lib/python3.8/site-packages/descartes/patch.py:63: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
concatenate([asarray(t.exterior)[:, :2]] +
<Figure size 640x480 with 1 Axes>
Get the field profile at the aperture¶
This will execute a CAMFR simulation. By putting verbose=True, the simulation prints the wavelength and effective indices used for the simulation.
ap_sm = ap.FieldModelFromCamfr()
f = ap_sm.get_fields(environment=environment, verbose=True)
f.visualize()

/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_elements.py:132: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
shapely_polygon = cascaded_union(MultiPolygon(shapely_polygons))
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_elements.py:227: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
shape = shapely_geom_to_shape(geom)
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:112: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(mp)
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:115: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(p)
Running camfr simulation:
* Device: <LayoutCell.Layout view 'PCELL_1:layout'>
* Wavelength = 1.55 um
* Effective indices used:
- Oxide: 1.444023622
- 220nm Si: 2.848214685217785
- 100nm Si: 2.1894098805166937
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/plugins/vfabrication/geometry.py:144: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
shape = shapely_geom_to_shape(geom)
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_shapely.py:77: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
s = shapely_geom_to_shape(poly)
<Figure size 640x480 with 1 Axes>
Show the far field
ff = ap_sm.get_far_field(environment=environment)
ff.visualize()

<Figure size 640x480 with 1 Axes>
Plot the full field inside the waveguide aperture:
f2d = ap_sm.get_aperture_fields2d(environment=environment)
f2d.visualize()

/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_elements.py:132: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
shapely_polygon = cascaded_union(MultiPolygon(shapely_polygons))
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:112: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(mp)
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:115: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(p)
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/plugins/vfabrication/geometry.py:144: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
shape = shapely_geom_to_shape(geom)
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_shapely.py:77: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
s = shapely_geom_to_shape(poly)
<Figure size 640x480 with 1 Axes>
CircuitModel: Check the backreflection of the aperture¶
The circuitmodel will get this directly from the CAMFR simulation
ap_cm = ap.CircuitModel()
wavelengths = numpy.linspace(1.5, 1.6, 21)
s_matrix = ap_cm.get_smatrix(wavelengths=wavelengths)
refl_aperture = 20.0 * numpy.log10(numpy.abs(s_matrix["in", "in"]))
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_elements.py:132: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
shapely_polygon = cascaded_union(MultiPolygon(shapely_polygons))
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:112: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(mp)
/bbotworker/DEPLOY_IPKISSDOC/build/dependencies/shapely_wrapper.py:115: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
up = cascaded_union(p)
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/plugins/vfabrication/geometry.py:144: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
shape = shapely_geom_to_shape(geom)
/bbotworker/DEPLOY_IPKISSDOC/build/ipkiss/boolean_ops/boolean_ops_shapely.py:77: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
s = shapely_geom_to_shape(poly)
Plot the reflection of the aperture.
plt.plot(wavelengths, refl_aperture)
plt.xlabel("wavelength")
plt.ylabel("reflection [dB]")
plt.show()

Total running time of the script: ( 13 minutes 12.810 seconds)