Library

class ipkiss3.pcell.library.Library(name, **kwargs)

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:

accessed: Real, number, optional

Timestamp at which the library was accessed.

allow_empty_pcells: optional

Indicates whether empty cells are allowed.

layout: optional

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

modified: Real, number, optional

Timestamp at which the library was modified.

name: str, optional

Unique name for the library

grid: float and number > 0, optional

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

grids_per_unit: optional

Number of grid cells per design unit

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

add(obj)

Adds an object PCell or GlobalNet to the Library

Parameters:obj : PCell, PCellDict or GlobalNet object
check_references()

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

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

Removes empty PCells from the Library

clear()

Removes all cells from the Library

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

flat_copy(level=-1)

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

Parameters:level : How 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:level : How many levels deep should the layout be flattened. -1 means all levels (default)
Returns:this Library object
is_empty()

Returns True if the Library does not contain PCell

pcell_exists(pcell)

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

Parameters:pcell : PCell object or string with pcell name.
Returns:Boolean
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

referenced_structures(usecache=False)
set_referenced(cell)

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

size_info()

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

Returns:SizeInfo object
snap_coordinate(coordinate)

snaps a 2D coordinate to the library design grid

Parameters:coordinate : Coord2 or tuple
Returns:Coord2 object
snap_shape(coordinates)

snaps a shape to the library design grid

Parameters:coordinates : a Shape object or list of Coord2/tuples
Returns:a Shape object
snap_value(value)

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

Parameters:value : number
Returns:a float
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
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

unreferenced_structures(usecache=False)
class ipkiss3.pcell.library.ViewLibrary(name, **kwargs)

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:

accessed: Real, number, optional

Timestamp at which the library was accessed.

modified: Real, number, optional

Timestamp at which the library was modified.

name: str, optional

Unique name for the library

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.

clear()
referenced_views()

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

top_view()

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

unreferenced_views()

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