I take care of getting data from Ngspice.

NgspiceRunner constructs an instance of me with a reference to itself.

ParametersallVectorsSet True to have me also look for vectors inside subcircuits. Only done if Ngspice is to save a full suite of all of its simulation vectors. See util.Config.
Instance Variable N The length of the simulation vector currently being parsed in an active call to getVector. Only valid while that method is underway with the lock dLock acquired; set to None at all other times.
Method __init__ Getter(r, allVectors=False)
Method shutdown Returns a Deferred that fires when Ngspice has fulfilled all requests for data.
Method clear Called to clear my activeVectors dict after running a simulation of a different type or different number of active vectors than the last one.
Method parseRealValue Parses an index and real value from the supplied line of response text and assigns the item of my X values array accordingly.
Method parseComplexValue Parses an index and complex value from the supplied line of response text and assigns the item of my X values array accordingly.
Method makeArg Returns the vector name with bracketed item-selecting expression appended (if my k, k0, k1 attributes determine there will be one), and the length N of the vector as retrieved.
Method getVector Returns a Deferred that fires with a 1-D Numpy array of values for the specified simulation vector if all went OK.
Method __call__ Returns a Deferred that fires with one or more 1-D numpy arrays containing the values of the specified Ngspice vectors.
Method _display Called by getVector (with its lock acquired) to ask Ngspice to display the active vectors and set my activeVectors dict based on its result.
N =
The length of the simulation vector currently being parsed in an active call to getVector. Only valid while that method is underway with the lock dLock acquired; set to None at all other times.
def __init__(self, r, allVectors=False):

Getter(r, allVectors=False)

def shutdown(self):

Returns a Deferred that fires when Ngspice has fulfilled all requests for data.

NgspiceRunner calls this as part of its shutdown procedure.

def clear(self):

Called to clear my activeVectors dict after running a simulation of a different type or different number of active vectors than the last one.

def _display(self):

Called by getVector (with its lock acquired) to ask Ngspice to display the active vectors and set my activeVectors dict based on its result.

Each entry is keyed by node name and contains a tuple with (1) the type of values in the node's vector ['voltage', 'current', 'frequency', or 'time'], (2) True if the vector is complex-valued or False if real-valued, and (3) the length of the vector.

Returns a Deferred that fires with the Result of the Ngspice call once my activeVectors dict has been populated or if there was an error.

def parseRealValue(self, line):

Parses an index and real value from the supplied line of response text and assigns the item of my X values array accordingly.

If the line has 'nan' in it, it is ignored.

def parseComplexValue(self, line):

Parses an index and complex value from the supplied line of response text and assigns the item of my X values array accordingly.

If the line has 'nan' in it, it is ignored.

def makeArg(self, vector, N):

Returns the vector name with bracketed item-selecting expression appended (if my k, k0, k1 attributes determine there will be one), and the length N of the vector as retrieved.

@defer.inlineCallbacks
def getVector(self, vector):

Returns a Deferred that fires with a 1-D Numpy array of values for the specified simulation vector if all went OK.

If there was a problem, or if a np.nan value was present, the Deferred fires with the Result of the failed Ngspice call.

A lock/release mechanism ensures that the underlying Ngspice process only has to deal with one of these requests at a time. Somewhat redundant concurrency protection, since this method is currently only called by my __call__ method, which does so strictly sequentially.

@defer.inlineCallbacks
def __call__(self, *vectors, **kw):

Returns a Deferred that fires with one or more 1-D numpy arrays containing the values of the specified Ngspice vectors.

The (deferred) result will be a list of arrays. A single string argument returns a single array, but still in a list.

Fires with the Result object of the failed Ngspice call if there was a problem.

You can specify a single element of each vector to be returned with the k keyword, or a slice of elements with the k0 and k1 keywords.

ParameterskThe index of a single element to be returned from each vector. (type: int)
k0The first (lower) index of a slice of elements to be returned from each vector. (Same indexing scheme as Python uses, with 0 being the first element.) (type: int)
k1The second (upper) index of a slice of elements to be returned from each vector. (Same indexing scheme as Python uses, with -1 being an alternative way to reference the last element.) (type: int)
API Documentation for pingspice, generated by pydoctor at 2021-09-18 08:41:11.