Skip to content

Dataprep

When building a reticle sometimes you want to do boolean operations. This is usually known as dataprep.

You can do this at the component level or at the top reticle assembled level.

This tutorial is focusing on cleaning DRC on masks that have already been created.

import gdsfactory as gf
from gdsfactory.gpdk.layer_map import LAYER

import gplugins.klayout.dataprep as dp

You can manipulate layers using the klayout LayerProcessor to create a RegionCollection to operate on different layers.

The advantage is that this can easily clean up routing, proximity effects, acute angles.

c = gf.Component()
ring = c << gf.components.coupler_ring(radius=20)
c.write_gds("input.gds")
d = dp.RegionCollection(gdspath="input.gds")
c.plot()

png

Copy layers

You can access each layer as a dict.

# make sure you add the copy to create a copy of the layer
d[LAYER.N] = d[LAYER.WG].copy()
d.plot()

png

Remove layers

d[LAYER.N].clear()
d.plot()

png

Size

You can size layers, positive numbers grow and negative shrink.

d[LAYER.SLAB90] = d[LAYER.WG] + 2  # size layer by 4 um
d.plot()

png

Over / Under

To avoid acute angle DRC errors you can grow and shrink polygons. This will remove regions smaller

d[LAYER.SLAB90] += 2  # size layer by 4 um
d[LAYER.SLAB90] -= 2  # size layer by 2 um
d.plot()

png

Smooth

You can smooth using RDP

# smooth by 1um, Notice that klayout units are in DBU (database units) in this case 1nm, so 1um = 1e3
d[LAYER.SLAB90].smooth(1 * 1e3)
d.plot()

png

Booleans

You can derive layers and do boolean operations.

d[LAYER.DEEP_ETCH] = d[LAYER.SLAB90] - d[LAYER.WG]
d.plot()

png