Imports

from pathlib import Path

import gdsfactory as gf
import gdsfactoryplus as gfp

pdk = gfp.get_pdk()
gfp.get_settings()
{'api': {'host': 'https://api.gdsfactory.com',
  'key': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGlfa2V5IjoiZWQyYjUyNjMtZDZlZi00MjY3LTk0YTMtMTAxYmE2NTdjMTczIiwiYXVkIjoiR0RTRmFjdG9yeTphcGkta2V5cyJ9.mIw4BVVcN9EUebRoxsXi_6KyV1OIbrHLFnSR_NogWjo'},
 'drc': {'host': 'https://dodeck.gdsfactory.com',
  'pdk': '',
  'process': '',
  'timeout': 60},
 'external': {'axiomatic': {'api': {'key': ''}}},
 'gpt': {'host': 'https://doitforme.gdsfactory.com', 'pdk': ''},
 'ignore': [],
 'log': {'debug_level': 'DEBUG', 'level': 'WARNING'},
 'lvs': {'engine': 'kfactory'},
 'name': 'gdsfactoryplus',
 'pdk': {'name': 'cspdk.si220.cband'},
 'server': {'host': 'http://localhost'},
 'sim': {'x': {'max': 1.6, 'min': 1.5, 'name': 'wl', 'num': 300}},
 'workspace': False}

Intro

For running this DRC examples you will require to open Klayout and make sure you have klive extension installed.

image.png

GDSFactory+ needs to be installed as well.

pip install gdsfactoryplus --upgrade

Then you need to configure your PDK, URLs and keys to point to the correct deployment.

To do this, ensure you create a config file in ~/.gdsfactory/gdsfactoryplus.toml with the default gdsfactoryplus settings. For example:

[tool.gdsfactoryplus.api]
key = "<your-api-key>"

Note

You can also use this as a template for your own global gdsfactoryplus config or your per-project pyproject.toml file.

A cell with errors

Let us create a GDS with some DRC errors, run DRC on the remote server and review the results locally on your computer.

@gf.cell
def width_min(size=(0.1, 0.1)):
    return gf.components.rectangle(size=size, layer="WG")
c = width_min()
c

png

Check DRC

gdspath = c.write_gds()
lyrdb = gfp.check_drc(gdspath)
lyrdb_path = Path("errors.lyrdb")
lyrdb_path.write_text(lyrdb);
uploading '/tmp/gdsfactory/width_min_S0p1_0p1.gds'...


2f25f35904c474ef.gds
running DRC... [pdk='cspdk.si220.cband' process='']...


job_2f25f35904c474ef
Job will time out after approximately 60 seconds.
You can change this by setting 'timeout' in [tool.gdsfactoryplus.drc] in your project's pyproject.toml.
RUNNING


SUCCEEDED
print(lyrdb_path.read_text())
<?xml version="1.0" encoding="utf-8"?>
<report-database>
 <description>DRC Results</description>
 <original-file/>
 <generator/>
 <top-cell/>
 <tags>
 </tags>
 <categories>
  <category>
   <name>Width_WG</name>
   <description>Min width for WG is 0.2 um</description>
   <categories>
   </categories>
  </category>
  <category>
   <name>Width_Si_Etch2_LF_120nm</name>
   <description>Min width for Si_Etch2_LF_120nm is 0.35 um</description>
   <categories>
   </categories>
  </category>
  <category>
   <name>WG_area_min</name>
   <description>WG area must be greater than 0.05 um^2</description>
   <categories>
   </categories>
  </category>
 </categories>
 <cells>
  <cell>
   <name>width_min_S0p1_0p1</name>
   <variant/>
   <layout-name/>
   <references>
   </references>
  </cell>
 </cells>
 <items>
  <item>
   <tags/>
   <category>Width_WG</category>
   <cell>width_min_S0p1_0p1</cell>
   <visited>false</visited>
   <multiplicity>1</multiplicity>
   <comment>Min width for WG is 0.2 um</comment>
   <image/>
   <values>
    <value>polygon: (0,0;0,0.1;0.1,0.1;0.1,0)</value>
   </values>
  </item>
  <item>
   <tags/>
   <category>Width_Si_Etch2_LF_120nm</category>
   <cell>width_min_S0p1_0p1</cell>
   <visited>false</visited>
   <multiplicity>1</multiplicity>
   <comment>Min width for Si_Etch2_LF_120nm is 0.35 um</comment>
   <image/>
   <values>
    <value>polygon: (0,0;0,0.1;0.1,0.1;0.1,0)</value>
   </values>
  </item>
  <item>
   <tags/>
   <category>WG_area_min</category>
   <cell>width_min_S0p1_0p1</cell>
   <visited>false</visited>
   <multiplicity>1</multiplicity>
   <comment>WG area must be greater than 0.05 um^2</comment>
   <image/>
   <values>
    <value>polygon: (0,0;0,0.1;0.1,0.1;0.1,0)</value>
   </values>
  </item>
 </items>
</report-database>

If you have a valid API key you can now browse through the errors in klayout.