Technology Layers
Reference for Technology, LayerDefine, default layers, and layer override behavior.
Technology describes which named process layers a layout should use.
In laylight, it is a small configuration object with two roles:
- hold layer definitions in a dictionary-like form
- expose
kdb.LayerInfoobjects for geometry generation
This page is a reference for the current behavior.
Technology
Technology is a mapping from a layer name such as LAYER_WG to a LayerDefine.
The simplest form uses the built-in defaults:
from laylight.technology import Technology
tech = Technology()You can also pass a dictionary to override existing layers or add new ones:
from laylight.technology import Technology
tech = Technology(
{
"LAYER_WG": {
"layer_number": 100,
"comments": "custom waveguide layer",
},
"LAYER_LABEL": {
"layer_number": 200,
"layer_datatype": 7,
"name": "LABEL",
"color": "#ffcc00",
},
}
)LayerDefine
Each layer entry is a LayerDefine.
Required fields:
layer_number: the KLayout layer numberlayer_datatype: the KLayout datatype
Optional fields:
name: display name for the layercomments: free-form notes about the layercolor: optional color metadata stored in the definition
Example:
{
"layer_number": 0,
"layer_datatype": 0,
"name": "WG",
"comments": "waveguide core",
"color": "#4f83cc",
}Default Layers
Technology() starts with a built-in set of named layers.
Current defaults include:
LAYER_WGLAYER_SLABLAYER_DOPING_PLAYER_DOPING_PPLAYER_DOPING_PPPLAYER_DOPING_NLAYER_DOPING_NPLAYER_DOPING_NPPLAYER_HTLAYER_MT1LAYER_VIA_MT2MT1LAYER_VIA_MT2HTLAYER_MT2LAYER_PORTLAYER_PORT_INLAYER_PORT_OUT
To inspect the dictionary form directly:
tech = Technology()
wg_define = tech["LAYER_WG"]
assert wg_define["layer_number"] == 0
assert wg_define["layer_datatype"] == 0Reading Layers
Technology supports two read paths. They return different kinds of values.
Dictionary access
Use tech["LAYER_WG"] when you want the configuration data itself:
tech = Technology()
wg_define = tech["LAYER_WG"]This returns a LayerDefine dictionary.
Attribute access
Use tech.LAYER_WG when you want a kdb.LayerInfo for geometry generation:
import klayout.db as kdb
tech = Technology()
layer_info: kdb.LayerInfo = tech.LAYER_WGThis is the form most device code uses when calling cell.shapes(...) or layout.layer(...).
Class-level attribute access
Technology.LAYER_WG also works.
This returns the default kdb.LayerInfo for that layer name, without applying any instance-specific overrides.
Overriding Existing Layers
When you pass an existing layer name, Technology merges your values into the default definition for that layer.
from laylight.technology import Technology
tech = Technology(
{
"LAYER_WG": {
"layer_number": 100,
"comments": "moved to a custom process layer",
}
}
)
assert tech["LAYER_WG"]["layer_number"] == 100
assert tech["LAYER_WG"]["layer_datatype"] == 0
assert tech["LAYER_WG"]["name"] == "WG"In this example, only layer_number and comments change. The default layer_datatype and name stay in place.
Adding New Layers
You can introduce new layer names that are not part of the defaults.
from laylight.technology import Technology
tech = Technology(
{
"LAYER_LABEL": {
"layer_number": 200,
"layer_datatype": 7,
"name": "LABEL",
}
}
)
assert tech["LAYER_LABEL"]["layer_number"] == 200
assert tech.LAYER_LABEL.datatype == 7For a new layer, layer_number and layer_datatype must be provided.
Validation Rules
Technology validates each layer definition during construction.
It raises ValueError when:
- a layer definition is missing
layer_number - a layer definition is missing
layer_datatype - a layer definition contains unsupported fields
Supported fields are only:
layer_numberlayer_datatypenamecommentscolor
Immutability
Technology is immutable after construction.
The object behaves like a read-only mapping. Methods such as item assignment, update(), pop(), and clear() raise TypeError.
If you need a different layer configuration, construct a new Technology(...) object instead of mutating an existing one.
Typical Usage
The common pattern is:
- create a
Layout - create a
Technology - pass the technology into devices
- use
tech.LAYER_*when shapes need akdb.LayerInfo
import laylight
import klayout.db as kdb
from laylight.structure.wg import WGStraight
from laylight.technology import Technology
layout = laylight.Layout()
layout.dbu = 0.001
top = layout.create_cell("TOP")
tech = Technology(
{
"LAYER_WG": {
"layer_number": 100,
}
}
)
device = WGStraight(
length=50,
width=0.5,
layout=layout,
tech=tech,
)
laylight.Placer(device).into(top)
top.shapes(layout.layer(tech.LAYER_WG)).insert(kdb.DBox(0, 2, 10, -2))