Generate Layout

Generate Layout#

The first step is to create a layout and test manifest for your project, so that you can relate measurements and analyses back to your source layout.

You can generate the layout with any layout tool. In this notebook you can use gdsfactory.

Generate layout#

You can download this generate_layout.py file

We will sweep the width of a 20um long sheet to measure sheet resistance.

from generate_layout import top

c = top()
c.write_gds("test_chip.gds")
c.plot()
../../../_images/8cc365078fe001d202cd5a77e1ea5754815ccac6b4dcdc425fdeffd85bbe232b.png

Generate design manifest#

In your sample GDS, you have the device settings annotated on the GDS. Here you can read them from the GDS and write a design manifest, which we can use to associate measurement data with the devices on the GDS. However, you can use any method you prefer to generate your test manifest.

import kfactory as kf
import csv

sweep = c.kcl["resistance"]
csvpath = "design_manifest.csv"

analysis = "[iv_resistance]"
analysis_parameters = "[{}]"
length = 20

with open(csvpath, "w") as f:
    writer = csv.writer(f)
    writer.writerow(
        [
            "cell",
            "x",
            "y",
            "width_um",
            "length_um",
            "analysis",
            "analysis_parameters",
        ]
    )
    iterator = sweep._kdb_cell.begin_instances_rec()
    iterator.targets = "resistance*"
    while not iterator.at_end():
        _c = c.kcl[iterator.inst_cell().cell_index()]
        name = _c.name
        if "resistance_" in name:
            _disp = (iterator.trans() * iterator.inst_trans()).disp
            params = name.split("_")  # we extract the width from the device name
            writer.writerow(
                [
                    name,
                    _disp.x,
                    _disp.y,
                    float(params[-1][1:]),
                    length,
                    analysis,
                    analysis_parameters,
                ]
            )
        iterator.next()
params
['resistance', 'sheet', 'W100']

You can take a look a the contents of the device manifest you created.

import pandas as pd

df = pd.read_csv(csvpath)
df
cell x y width_um length_um analysis analysis_parameters
0 resistance_sheet_W10 0 52500 10.0 20 [iv_resistance] [{}]
1 resistance_sheet_W20 0 157500 20.0 20 [iv_resistance] [{}]
2 resistance_sheet_W100 0 262500 100.0 20 [iv_resistance] [{}]