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.generic_tech.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()
../_images/756f0a1b4ec267aad40bfd1136146a0afe8a0798bc8c49f912ee2f05f56438e2.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()
../_images/bdbca6320d903b36a4204c21135a0e803017b0274b00b358530bacad51de0e1b.png

Remove layers#

d[LAYER.N].clear()
d.plot()
../_images/bdbca6320d903b36a4204c21135a0e803017b0274b00b358530bacad51de0e1b.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()
../_images/bdbca6320d903b36a4204c21135a0e803017b0274b00b358530bacad51de0e1b.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()
../_images/bdbca6320d903b36a4204c21135a0e803017b0274b00b358530bacad51de0e1b.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()
../_images/bdbca6320d903b36a4204c21135a0e803017b0274b00b358530bacad51de0e1b.png

Booleans#

You can derive layers and do boolean operations.

d[LAYER.DEEP_ETCH] = d[LAYER.SLAB90] - d[LAYER.WG]
d.plot()
../_images/bdbca6320d903b36a4204c21135a0e803017b0274b00b358530bacad51de0e1b.png