tidy3d.plugins.klayout.DRCRunner#

class DRCRunner[source]#

Bases: Tidy3dBaseModel

A class for running KLayout DRC. Can be used to run DRC on a Tidy3D object or a GDS file.

Parameters:
  • attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields, attrs are mutable. For example, the following is allowed for setting an attr obj.attrs['foo'] = bar. Also note that Tidy3D` will raise a TypeError if attrs contain objects that can not be serialized. One can check if attrs are serializable by calling obj.json().

  • drc_runset (Path) – Path to the KLayout DRC runset file.

  • verbose (bool) – Whether to print logging.

  • drc_runset – The path to the KLayout DRC runset file.

  • verbose – Whether to print logging. Default is True.

Example

>>> # Running DRC on a GDS file:
>>> from tidy3d.plugins.klayout.drc import DRCRunner
>>> runner = DRCRunner(drc_runset="my_drc_runset.drc", verbose=True) 
>>> results = runner.run(source="my_layout.gds", resultsfile="drc_results.lyrdb") 
>>> print(results) 
>>> # Running DRC on a Tidy3D object:
>>> import tidy3d as td
>>> from tidy3d.plugins.klayout.drc import DRCRunner
>>> vertices = [(-2, 0), (-1, 1), (0, 0.5), (1, 1), (2, 0), (0, -1)]
>>> geom = td.PolySlab(vertices=vertices, slab_bounds=(0, 0.22), axis=2)
>>> runner = DRCRunner(drc_runset="my_drc_runset.drc", verbose=True) 
>>> results = runner.run(source=geom, td_object_gds_savefile="geom.gds", resultsfile="drc_results.lyrdb", z=0.1, gds_layer=0, gds_dtype=0) 
>>> print(results) 

Attributes

Methods

run(source[, td_object_gds_savefile, ...])

Runs KLayout's DRC on a GDS file or a Tidy3D object.

Inherited Common Usage

drc_runset#
verbose#
run(source, td_object_gds_savefile=PosixPath('layout.gds'), resultsfile=PosixPath('drc_results.lyrdb'), **to_gds_file_kwargs)[source]#

Runs KLayout’s DRC on a GDS file or a Tidy3D object. The Tidy3D object can be a Geometry, Structure, or Simulation.

Parameters:
  • source (Union[Geometry, Structure, Simulation, Path]) – The Geometry, Structure, Simulation, or GDS file to run DRC on.

  • td_object_gds_savefile (Path) – The path to save the Tidy3D object to. Defaults to "layout.gds".

  • resultsfile (Path) – The path to save the KLayout DRC results file to. Defaults to "drc_results.lyrdb".

  • **to_gds_file_kwargs – Additional keyword arguments to pass to the Tidy3D object-specific to_gds_file() method.

Returns:

The DRC results object containing violations and status.

Return type:

DRCResults

Example

Running DRC on a GDS file: >>> from tidy3d.plugins.klayout.drc import DRCRunner >>> runner = DRCRunner(drc_runset=”my_drc_runset.drc”, verbose=True) # doctest: +SKIP >>> results = runner.run(source=”my_layout.gds”) # doctest: +SKIP >>> print(results) # doctest: +SKIP

Running DRC on a Tidy3D object: >>> import tidy3d as td >>> from tidy3d.plugins.klayout.drc import DRCRunner >>> vertices = [(-2, 0), (-1, 1), (0, 0.5), (1, 1), (2, 0), (0, -1)] >>> geom = td.PolySlab(vertices=vertices, slab_bounds=(0, 0.22), axis=2) >>> runner = DRCRunner(drc_runset=”my_drc_runset.drc”, verbose=True) # doctest: +SKIP >>> results = runner.run(source=geom, z=0.1, gds_layer=0, gds_dtype=0) # doctest: +SKIP >>> print(results) # doctest: +SKIP

__hash__()#

Hash method.