pingspice.ngspice.cmd.Result(object)
class documentation
Part of pingspice.ngspice.cmd
(View In Hierarchy)
I hold the result of running an Ngspice command.
I act like a list of STDOUT lines, except that I am only nonzero if
there was no error and Ngspice is and still should be running. I also keep
track of any STDERR lines, whether there was an error, and whether Ngspice
is running. An instance of me gets returned to NgspiceRunner
,
which can return it all the way to analysis.sim.Analyzer
.
You can construct an instance of me to serve as a bogus-result
placeholder by supplying an error string (or proto/args) in the
constructor. NgspiceRunner.AlterationManager.wait
does this.
Instance Variable | cmd | The line sent to Ngspice, with trailing newline stripped. (type: str) |
Instance Variable | stdout | Lines of STDOUT produced by Ngspice. You can access this by treating me like a list. (type: list) |
Instance Variable | stderr | Lines of STDERR produced by Ngspice. (type: list) |
Instance Variable | error | Text description of an Ngspice error if one occurred, or blank if everything went OK. (type: str) |
Method | __init__ | Result() |
Method | __repr__ | My string representation indicates if Ngspice is dead or had an error, and lists the lines of STDIO and/or STDERR it produced. |
Method | __nonzero__ | I am True if Ngspice produced no error. |
Method | __eq__ | I am equal to another instance if we have the same STDOUT lines, and to
a None object if I have no STDOUT lines. |
Method | __contains__ | List-like access to stdout. |
Method | __getitem__ | List-like access to stdout. |
Method | __iter__ | List-like access to stdout. |
Method | __len__ | List-like access to stdout. |
Method | getFailure | Returns a twisted.Python.failure.Failure object constructed
with an NgspiceError
and my string representation. |
Method | s2d | Parses my STDOUT lines from a two-column table into a dict, where the first column defines the key in the second column defines the value, which is converted into a float if possible. |
My string representation indicates if Ngspice is dead or had an error, and lists the lines of STDIO and/or STDERR it produced.
I am True
if Ngspice produced no error.
I am unlike a list of STDOUT lines in that this can still evaluate
True
with no lines. It's used to determine whether Ngspice
produced a legit output.
I am equal to another instance if we have the same STDOUT lines, and to
a None
object if I have no STDOUT lines.
Returns a twisted.Python.failure.Failure
object constructed
with an NgspiceError
and my string representation.
Parses my STDOUT lines from a two-column table into a dict, where the first column defines the key in the second column defines the value, which is converted into a float if possible.
If there are single-column values, the last-converted value is made into a list if it's not already, and the single-column value is appended to that list.
The first line of STDOUT is ignored. There should be no blank lines, as
those are discarded in NgspiceProtocol.outReceived
.
The dict is returned unless I am in an error condition or there's nothing in the dict (which will happen if the sole line of output is "No matching instances or models", for example). In that case, in reference to my instance is returned instead.
Parameters | key | Set to a key of the dict to return just the value of that entry instead of the entire dict. If the key isn't there, returns a reference to my instance instead. |
See Also | NgspiceRunner.show
and NgspiceRunner.showmod . |