Previous topic

gdsii — GDSII manipulation library

Next topic

gdsii.structure — interface to a GDSII structure

This Page

gdsii.library — interface to a GDSII library

This module contains class that represents a GDSII library.

class gdsii.library.Library(version, name, physical_unit, logical_unit, mod_time=None, acc_time=None)

Bases: list

GDSII library class. This class is derived from list and can contain one one more instances of gdsii.structure.Structure.

GDS syntax for the library:
library ::=  HEADER
             BGNLIB
             [LIBDIRSIZE]
             [SRFNAME]
             [LIBSECUR]
             LIBNAME
             [REFLIBS]
             [FONTS]
             [ATTRTABLE]
             [GENERATIONS]
             [format]
             UNITS
             {structure}*
             ENDLIB
format  ::=  FORMAT
             [MASK+ ENDMASKS]
__init__(version, name, physical_unit, logical_unit, mod_time=None, acc_time=None)

Initialize the library. mod_time and acc_time are set to current UTC time by default.

Instance attributes:
version

GDSII file verion (int). Number as found in a GDSII file. For example value is 5 for GDSII v5 and 0x600 for GDSII v6.

name

Library name (bytes).

physical_unit

Size of database unit in meters (float).

logical_unit

Size of user unit in database units (float).

mod_time

Last modification time (datetime).

acc_time

Last access time (datetime).

libdirsize

Number of pages in the library directory (int, optional).

srfname

Name of spacing rules file (bytes, optional).

acls

ACL data (list of tuples (GID, UID, ACCESS), optional).

reflibs

Names of reference libraries (bytes, optional). See GDSII stream format documentation for format.

fonts

Names of font definition files (bytes, optional). The content is not parsed, see GDSII stream format documentation for format.

attrtable

Name of attribute definition file (bytes, optional).

generations

Number of copies for deleted structures (int, optional)

format
Library format (int, optional). Possible values:
  • 0 – GDSII archive format
  • 1 – GDSII filtered format
  • 2 – EDSIII archive format
  • 3 – EDSIII filtered format
masks

Masks for filtered format (list of bytes, optional).

classmethod load(stream)

Load a GDS library from a file.

Parameters:stream – a file or file-like object opened for reading in binary mode.
Returns:a new library.
save(stream)

Save the library into a file.

Parameters:stream – a file or file-like object opened for writing in binary mode.