pingspice.util.Formatter(object)
class documentation
Part of pingspice.util
(View In Hierarchy)
I provide a few methods that ensure your node names conform with Ngspice canonical format and your values are all strings with Booleans converted to "1" or "0".
You can specify a numbered node with "v" (or "V") followed immediately by the number and that will be converted to V(<number>). For example,:
v5 -> V(5)
That is especially useful for specifying numbered nodes in keywords or attribute names, since you can't use numbers or parentheses in those cases.
Since a number as a node name cannot be anything but equivalent to 'V(xxx)' where 'xxx' is the number, you might think that supplying just a number will convert to that. But, due to the way Ngspice parses the name, that doesn't work. It wouldn't be a good practice to just use the integer digits, anyhow, as that couldn't work for specifying a numbered nodes in keywords or attribute names.
Vector or node names are converted to lowercase, except for the "V" in those specified in (or converted to) "V(<name>)" format.
Method | sanitize | Ultimately, all space-delimited tokens, array values, and wrapped arguments and keywords get run through this function. |
Method | toTokens | Returns a list of string tokens from the supplied arguments. Blank
strings and None objects are ignored and Wrapper
objects are parsed into strings. |
Method | toCanonical | Ensures that the supplied vector or node name is in Ngspice-canonical format. |
Method | prettify | For removing ugly superfluous junk from a netlist line and wrapping with continuation lines if necessary. |
Ultimately, all space-delimited tokens, array values, and wrapped arguments and keywords get run through this function.
Returns a list of string tokens from the supplied arguments. Blank
strings and None
objects are ignored and Wrapper
objects are parsed into strings.