Layer Stack

Overview

A LayerStack is a class that is used to handle a series of LayerInfo objects. It contains a dict that uses unique user-defined layer_number as key for its respective LayerInfo value.

In summary, each layer in your fabrication process corresponds to a LayerInfo object. In a general form a layer stack can be repsented with the following diagram:

Layer Stack Organization
A graphical representation of a generic layer stack.
  • Space below the minimum z_min is considered substrate.

  • Space above the maximum z_max is considered background.

  • If cladding material is not specified it defaults to background.

  • By default substrate and background defaults to Air_default.

  • z_min determines the order in which the layers are stacked.

  • Layer number must match those in the .gds file.

  • Cladding will be used for empty spaces inside the layer as well, not just at the edges.

  • Every material in a particular layer must derive from the Material object.

  • Care should be taken to avoid overlapping layers.

Layer Stack and Layer Info Considerations

Following are a few considerations to take into account when adding layers to the layer stack.

  • Each layer must have a unique layer number;

  • Care should be taken so that z_min and thickness attributes of multiple LayerInfo dont end up overalping;

  • If a cladding material is not defined when instantiating or adding a layer to the layer stack, it will be considered as background, and the default background material of the layer stack will be used.

  • Materials are automatically an uniquely added to an internal MaterialLibrary inside the LayerStack instance;

  • By default background and substrate are set to Air.

Examples

The following examples will cover some specific settings of the LayerStack and at the end it aggregates all the example snipets into a complete setup. For more deatails please check the API documentation.

Defining Material Objects

This is example is just a reminder on how to define material objects to be used by layers in a simulation script. Such material will be used in subsequent examples for creating LayerInfo and LayerStack objects.

from pyOptiShared.Material import ConstMaterial

myindex1p45 = ConstMaterial(mat_name="myindex1p45", epsReal=1.45**2)
myindex3p5 = ConstMaterial(mat_name="myindex3p5", epsReal=3.5**2)

Defining Side Wall Angle Functions

The side wall functions must follow the python signature of the method defined by the GetOffset method. This guarantees the correct evaluation of the side wall offset at a given z height at a particular layer. A negative offset erodes the wall, while a positive one dilates it.

import numpy as np

def offset_erode(z:float, zmin:float, zmax:float, layer:int, datatype:int) -> float:
    offset = -0.1*np.sin(np.pi*(z-zmin)/(zmax-zmin)) # Half sinusoid profile - Erode (-ve offset)
    return offset
def offset_dilate(z:float, zmin:float, zmax:float, layer:int, datatype:int) -> float:
    offset = 0.1*np.sin(np.pi*(z-zmin)/(zmax-zmin)) # Half sinusoid profile - Dilation (+ve offset)
    return offset

Once this methods are defined they can be passed as the argument for sideWallFunct in the addLayer, as will be demonstrated in the next example.

Adding Layers to a LayerStack

from pyOptiShared.LayerInfo import LayerStack

layer_stack = LayerStack()
layer_stack.addLayer(name="L1", number=1, thickness=0.25, zmin=0.0,
                    material=myindex3p5, cladding=myindex1p45,
                    sideWallFunct=offset_erode)
layer_stack.addLayer(name="L2", number=2, thickness=0.25, zmin=0.25,
                    material=myindex3p5, cladding=myindex1p45,
                    sideWallFunct=offset_dilate)

Setting Background and Substrate Materials

Once the LayerStack is defined, we can set the appropriate background and substrate material using the setBGandSub method.

layer_stack.setBGandSub(background=myindex1p45, substrate=myindex1p45)

Visualizing the Layer Stack

The layer stack can be visualized using the Show method. It also allows exporting the stack to a file if filename is specified along with the .svg extension, for example.

from pyOptiShared.DeviceGeometry import DeviceGeometry
from pyOptiShared.LayerInfo import LayerStack
from pyOptiShared.Material import ConstMaterial

#Specifying Materials and Colors
si02_mat = ConstMaterial(mat_name="SiO2", epsReal=1.45**2,color='lightgreen')
si_mat = ConstMaterial(mat_name="Si", epsReal=3.5**2,color='lightblue')
air_mat = ConstMaterial(mat_name="Air", epsReal=1**2,color='lightyellow')

layer_stack = LayerStack()
layer_stack.addLayer(name="L1", number=1, thickness=0.22, zmin=0.0,
                    material=si_mat, cladding=si02_mat,
                    sideWallAng=20)
layer_stack.addLayer(name="L2", number=2, thickness=0.22, zmin=0.0,
                    material=si02_mat, cladding=si02_mat,
                    sideWallAng=0)

layer_stack.setBGandSub(background=air_mat, substrate=si02_mat)

layer_stack.Show(filename='layerstack_example.svg')
../_images/layerstack_example.svg

A Complete Layer Stack Setup

This example uses the information provided in the previous examples to construct a full instantiation and setup of a LayerStack.

import numpy as np
from pyOptiShared.LayerInfo import LayerStack
from pyOptiShared.Material import ConstMaterial

##########################################
###         Material Settings          ###
##########################################
myindex1p45 = ConstMaterial(mat_name="myindex1p45", epsReal=1.45**2)
myindex3p5 = ConstMaterial(mat_name="myindex3p5", epsReal=3.5**2)

##########################################
###       Layer Stack Settings         ###
##########################################
def offset_erode(z:float, zmin:float, zmax:float, layer:int, datatype:int) -> float:
    offset = -0.1*np.sin(2*np.pi*(z-zmin)/(zmax-zmin)) # Half sinusoid profile - Erode (-ve offset)
    return offset

def offset_dilate(z:float, zmin:float, zmax:float, layer:int, datatype:int) -> float:
    offset = 0.1*np.sin(np.pi*(z-zmin)/(zmax-zmin)) # Half sinusoid profile - Dilation (+ve offset)
    return offset

layer_stack = LayerStack()
layer_stack.addLayer(name="L1", number=1, thickness=0.25, zmin=0.0,
                    material=myindex3p5, cladding=myindex1p45,
                    sideWallFunct=offset_erode)
layer_stack.addLayer(name="L2", number=2, thickness=0.25, zmin=0.25,
                    material=myindex3p5, cladding=myindex1p45,
                    sideWallFunct=offset_dilate)
layer_stack.setBGandSub(background=myindex1p45, substrate=myindex1p45)

API Documentation

pyOptiShared.LayerInfo.LayerStack()

A class to manage a list of layers and material objects.

pyOptiShared.LayerInfo.LayerInfo()

This class defines a layer.