kqcircuits.util.library_helper

Helper module for building KLayout libraries.

Typical usage example:

from kqcircuits.elements.airbridges import Airbridge
from kqcircuits.util.library_helper import load_libraries
load_libraries(path=Airbridge.LIBRARY_PATH)
cell = Airbridge.create(layout, **kwargs)
kqcircuits.util.library_helper.load_libraries(flush=False, path='')[source]

Load all KQCircuits libraries from the given path.

Parameters
  • flush – If True, old libraries will be deleted and new ones created. Otherwise old libraries will be used. (if old libraries exist)

  • path – path (relative to SRC_PATH) from which the pcell classes and cells are loaded to libraries

Returns

A dictionary of libraries that have been loaded, keys are library names and values are libraries.

kqcircuits.util.library_helper.delete_all_libraries()[source]

Delete all KQCircuits libraries from KLayout memory.

kqcircuits.util.library_helper.delete_library(name=None)[source]

Delete a KQCircuits library.

Calls library.delete() and removes the library from _kqc_libraries dict. Also deletes any libraries which have this library as a dependency.

Parameters

name – name of the library

kqcircuits.util.library_helper.to_module_name(class_name=None)[source]

Converts class name to module name.

Converts PascalCase class name to module name with each word lowercase and separated by space.

Parameters

class_name – Class name.

Returns

A lowercase and spaced by word string.

For example::

> module_name = _to_module_name(“QualityFactor”) > print(module_name) “quality_factor”

kqcircuits.util.library_helper.to_library_name(class_name=None)[source]

Converts class name to library name.

Converts PascalCase class name to library name with each word titled and separated by space. Single letter words are attached to the following word.

Parameters

class_name – Class name.

Returns

A titled and spaced by word string which may be used as library name.

For example::

> library_name = to_library_name(“QualityFactor”) > print(library_name) “Quality Factor”

../_images/kqcircuits.util.library_helper.png