pingspice.analysis.vectors.Vectors_Ngspice(VectorsBase)
class documentation
Part of pingspice.analysis.vectors
(View In Hierarchy)
I hold Ngspice results as Numpy vectors, accessible (read-only) as my attributes or as named items, dict-style.
Construct me with an NgspiceRunner
and a list of names of
nodes whose values I am to retrieve via the runner with each call to my
instance. You can add names later via my Analyzer's addName
method.
You can access a list of all my vector names (read-only, please) via my names list.
You can specify the difference between vectors in the usual way, i.e.,
V(2,1)
is the (canonical) name of V(2)
-
V(1)
.
A canonical name is a name that has been converted into format that
Ngspice finds acceptable. Most of the time, the canonical name is the same
as the given name. But sometimes, conversion is necessary, via an indirect
call to util.Formatter.toCanonical
.
I keep track of both versions.
Instance Variable | r | My NgspiceRunner . |
Instance Variable | addedLater | A list of Ngspice-canonical vector names that were added (via addVector )
after I got constructed. |
Instance Variable | values | My underlying vector values, keyed by canonical name. (type: dict) |
Method | __init__ | Undocumented |
Method | cnames | Property: A list of my names in Ngspice-canonical format. |
Method | addName | Adds a name to my NameManager
nm. |
Method | addVector | Adds 1-D Numpy array X as a later-added vector with name. |
Method | copy | Returns a copy of me with its own copies of my NgspiceRunner, Numpy vectors, and state as it all stands right now. |
Method | __call__ | Obtain the result vectors and set my read-only attributes (or pseudo-items) with them. |
Inherited from VectorsBase:
Method | nm 0 | Property: My NameManager ,
newly constructed if I did't have one yet. |
Method | nm 1 | Undocumented |
Method | nm | Undocumented |
Method | __contains__ | Dict-like access to my values: Whether name is included. |
Method | __len__ | Dict-like access to my values: The number of vectors and perhaps
+1 for a None entry. |
Method | __iter__ | Dict-like access to my values: Iterates over vector names plus
perhaps None for a psim.Analyzer
instance. |
Method | __getitem__ | Dict-like access to my values, with scaling done from unity
except for a None item, which is an SSE from a psim.Analyzer
instance. |
Method | __setitem__ | Replace the existing numpy vector specified by name with another. |
Method | __getattr__ | A value can be accessed as an attribute if it has an attribute-friendly name. |
Method | avg | Returns the time-weighted average value of my vector name, given my time vector. |
Method | error | Call this with something to tell me that I've had an error, or with nothing to find out if I've had an error. |
Method | setValue | Sets entry cname in my values dict to x, or to its absolute value if cname is an absolute value vector. |
Method | array | Returns my data as a 2-D Numpy array, with each of my values
(except a None entry) appearing as a column vector. |
Method | save | Saves my current contents to a .npz file at the specified
filePath, with any home directory symbol ("~")
expanded. |
Method | trimmedCopy | Returns a copy of me, trimmed to omit values from TIME < tMin and from TIME > tMax. |
addVector
)
after I got constructed.
Adds a name to my NameManager
nm.
Doesn't add it to my addedLater list, so calling this will cause name to be included in the vectors fetched during my next call unless you add name to addedLater yourself.
Parameters | k | Set this to an integer to have the name inserted at a specific position in
the names list of my NameManager
object nm rather than appended. The order isn't usually important,
but does affect the result of a call to array . |
Adds 1-D Numpy array X as a later-added vector with name.
It will be included in my list of names but will not be included in the vectors fetched during my next call.
The vector's name will be appended to the names list of my NameManager
object nm.
Returns a copy of me with its own copies of my NgspiceRunner, Numpy vectors, and state as it all stands right now.
This allows somebody like the plot.Plotter
to leisurely access my vectors without concern that my analyzer will call
me again and overwrite them.
Obtain the result vectors and set my read-only attributes (or pseudo-items) with them.
Returns a Deferred
that fires (with None
) when
I've attempted to set all the attributes. If I fail to set any, my error
state gets set, checkable with a call to error
.