11.1.12.9. Library

class PySpice.Spice.Library.SpiceLibrary(root_path, recurse=False, section=None)[source]

Bases: object

This class implements a Spice sub-circuits and models library.

A library is a directory which is recursively scanned for ‘.lib’ file and parsed for sub-circuit and models definitions.

Example of usage:

spice_library = SpiceLibrary('/some/path/')

If the directory hierarchy contains a file that define a 1N4148 sub-circuit then we can retrieve the file path using:

spice_library['1N4148']
EXTENSIONS = ('.spice', '.lib', '.mod', '.lib@xyce', '.mod@xyce')
property models

Dictionary of models

search(s)[source]

Return dict of all models/subcircuits with names matching regex s.

property subcircuits

Dictionary of sub-circuits