Library

class ipkiss3.all.Library

The Library object manages components, and can be persisted (as GDSII). It is essentially a collections of PCell objects (in OpenAccess, this corresponds to SubMasters). The write_gdsii() function of PCell is just a shorthand: it creates a library and writes it to gdsii.

When creating a PCell, you assign it to a library (default is a library which is created at startup).

The Library object manages the PCells that belong together (e.g. tree dependencies). Also, when merging files together, you need to have multiple libraries open.

Parameters
name: str and String that contains only ISO/IEC 8859-1 (extended ASCII py3) or pure ASCII (py2) characters, required

Unique name for the library

allow_empty_pcells: ( bool, bool_, bool or int ), optional

Indicates whether empty cells are allowed.

grids_per_unit: optional

Number of grid cells per design unit

layout: ( bool, bool_, bool or int ), optional

Indicates whether the library contains a layout: in that case, there should be only 1 top-level structure.

unit: float and number > 0, optional

Design unit. Extracted by default from TECH.METRICS.UNIT

units_per_grid: optional

Ratio of grid cell and design unit

grid: float and number > 0, optional

Design grid. Extracted by default from TECH.METRICS.GRID

accessed: Real, number, optional

Timestamp at which the library was accessed.

modified: Real, number, optional

Timestamp at which the library was modified.

snap_value(value)

snaps a (length) value to the library design grid.

Parameters
valuenumber
Returns
a float
snap_coordinate(coordinate)

snaps a 2D coordinate to the library design grid

Parameters
coordinateCoord2 or tuple
Returns
Coord2 object
snap_shape(coordinates)

snaps a shape to the library design grid

Parameters
coordinatesa Shape object or list of Coord2/tuples
Returns
a Shape object
add(obj)

Adds an object PCell or GlobalNet to the Library

Parameters
objPCell, PCellDict or GlobalNet object
pcell_exists(pcell)

Returns True if a PCell object with the same name exists in the Library.

Parameters
pcellPCell object or string with pcell name.
Returns
Boolean
clean_up()

Removes empty PCells from the Library

is_empty()

Returns True if the Library does not contain PCell

size_info()

returns the SizeInfo object corresponding to the footprint of the top layout PCell of the Library.

Returns
SizeInfo object
flat_copy(level=-1)

Returns a flattened copy of the top layout PCell in the Library. (recursive)

Parameters
levelHow many levels deep should the element be flattened. -1 means all levels (default)
Returns
Library object
flatten(level=-1)

Flattens the top layout PCell in the Library. (recursive)

Parameters
levelHow many levels deep should the layout be flattened. -1 means all levels (default)
Returns
this Library object
top_layout()
unreferenced_structures(usecache=False)
referenced_structures(usecache=False)
structure_exists(structure)
top_cell()

Returns the top PCell (i.e. the cell that is not referenced by any other cell).

If more than one top cell is present:

  • if the layout property is True, a warning is generated and None is returned. In that case, use the unreferenced_cells method.

  • otherwise, the list of top-lecel cells is returned

Returns
PCell object
set_referenced(cell)

Indicates a PCell as ‘referenced’ (i.e. not a top layout)

unreferenced_cells(usecache=False)

Returns all unreferenced cells in the Library (i.e. top layouts)

Parameters
use_cache: Boolean

When True, cached values are not recalculated

Returns
PCellDict object
referenced_cells(usecache=False)

Returns all referenced cells in the Library

Parameters
use_cache: Boolean

When True, cached values are not recalculated

Returns
PCellDict object
collect_references(pcell=None)

Walks through the Library and collects all references used in the given pcell

Parameters
pcell: PCell object or None

the pcell from which all references need to be collected. When None, all pcells in the Library are used

Returns
PCellDict object
check_references()

Check if all references belong to the library (True).

Returns
Boolean: True is all references are inside the Library.
clear()

Removes all cells from the Library

class ipkiss3.pcell.library.ViewLibrary

Builds information about views and their dependency trees.

The cells and views which are managed reside in a Library object. ViewLibrary only maintains weak references to these objects

Parameters
name: str and String that contains only ISO/IEC 8859-1 (extended ASCII py3) or pure ASCII (py2) characters, required

Unique name for the library

accessed: Real, number, optional

Timestamp at which the library was accessed.

modified: Real, number, optional

Timestamp at which the library was modified.

add(obj)

Add a view to the library

If the object given is not a view but a cell or a view of another type, the default view of the correct view type of the cell will be added.

referenced_views()

build and return the list of views which are refered to by other views

unreferenced_views()

build and return the list of views which are not refered to by other views. These are the “top level” views

clear()
top_view()

return the top-level view. Returns None if there are no views or multiple top-level views