I fully specify an alterable device value or device or model parameter value. Values are uniquely identified by the name assigned to them.

For my default to represent a known, unchanging value, set known True.

Children inherit a reference to the setup of their parent. During Ngspice circuit or Python parameter analyzer definition, the AV_Manager will ensure there is exactly one parent for each parameter name. All other instances of me with the same name will be children of that parent and inherit its ValueBasis.

Construct these only via the av method of an AV_Maker.

Method __init__ AV(name, *args)
Method __repr__ My string representation shows a unique integer ID, my name (with a "*" if I'm a child or "**" if orphan), setup ID if any, and device/model/parameter info.
Method __float__ Returns my known value (or default value, if no known) as a float, after mods have been done.
Method dmpLabel Undocumented
Method __getstate__ For pickling.
Method __setstate__ For unpickling.
Method default 0 Property: Specifically set default value or midpoint between minimum and maximum.
Method default Property setter: Specifically sets the default value.
Method minMax 0 Property: 2-sequence with minimum and maximum.
Method minMax Undocumented
Method known 0 Property: True if this parameter has a known value.
Method known Undocumented
Method enum 0 A sequence of enumerated values if my underlying continuous range is mapped to them.
Method enum Property setter: Maps the supplied sequence seq of enumerated values to my underlying continuous range.
Method logSpace 0 Property: True if my value is to be evaluated in log space (base 10) rather than linearly.
Method logSpace Undocumented
Method setVB_known Sets my ValueBasis object vb to a known value x, with its known flag set True.
Method setVB_enum Sets my ValueBasis object vb to a sequence of enumerated values.
Method setVB_range Sets my ValueBasis object vb to a minimum and maximum range.
Method value2enum Uses a value in the range 0-1 to select one of my enumerated values.
Method isParent Returns True if I am a parent, i.e, I have no parent and am not an orphan.
Method isParam Returns True if I am a parent, without a known value, and holding the ValueBasis instance vb that determines my value in the value of my children.
Method adopt Designates the supplied other AV object as my child if I am not a child myself (no grandchildren are allowed) or, if I am, as the child of our common parent.
Method copy Returns a copy of me for doing mods on in the same setup definition.
Method __eq__ I am equal to another object if it is also an instance of my class and has all the same values for name, parent, children, vb, setup, dev, model, and param.
Method sameAlteration Undocumented
Method am Append another (<operation>, <other object>) tuple to my list of mods to be performed.
Method __neg__ Returns a copy of me with its value destined to be negated.
Method __add__ Returns a copy of me with other destined to be added to its value.
Method __sub__ Returns a copy of me with other destined to be subtracted from its value.
Method __mul__ Returns a copy of me with its value destined to be multiplied by other.
Method __div__ Returns a copy of me with its value destined to be divided by other.
Method __pow__ Returns a copy of me with its value destined to be raised to the power other.
Method inf Call this to return a copy of me with a forcedValue if one of my mods produces a result of np.inf.
Method clip Returns a copy of me with its value destined to be clipped to +/- limit.
Method exp Returns a copy of me with its value converted to exp(value).
Method ln Returns a copy of me with its value converted to the natural logarithm of my value.
Method associateWith Associates me with the provided setup ID if I'm not already.
Method doMods Performs all of the mods in my list of mods and returns the final value. If no valueGetter is supplied, uses a default-value extractor: lambda x: x.default.
Method _enforceBounds Undocumented
def __init__(self, name, *args):

AV(name, *args)

def __repr__(self):

My string representation shows a unique integer ID, my name (with a "*" if I'm a child or "**" if orphan), setup ID if any, and device/model/parameter info.

def __float__(self):

Returns my known value (or default value, if no known) as a float, after mods have been done.

@property
def dmpLabel(self):
Undocumented
def __getstate__(self):

For pickling.

def __setstate__(self, state):

For unpickling.

@property
def default 0(self):

Property: Specifically set default value or midpoint between minimum and maximum.

If my known property is True, my default will be my known value.

@default.setter
def default(self, value):

Property setter: Specifically sets the default value.

@property
def minMax 0(self):

Property: 2-sequence with minimum and maximum.

@minMax.setter
def minMax(self, value):
Undocumented
@property
def known 0(self):

Property: True if this parameter has a known value.

@known.setter
def known(self, yes):
Undocumented
@property
def enum 0(self):

A sequence of enumerated values if my underlying continuous range is mapped to them.

@enum.setter
def enum(self, seq):

Property setter: Maps the supplied sequence seq of enumerated values to my underlying continuous range.

@property
def logSpace 0(self):

Property: True if my value is to be evaluated in log space (base 10) rather than linearly.

@logSpace.setter
def logSpace(self, yes):
Undocumented
def _enforceBounds(self, x):
Undocumented
def setVB_known(self, x):

Sets my ValueBasis object vb to a known value x, with its known flag set True.

def setVB_enum(self, x):

Sets my ValueBasis object vb to a sequence of enumerated values.

My value during doMods will appear to have a discretized value selected from that sequence, with the index determined by the underlying value which occupies a range from zero to one. My default value will be the middle of the range, 0.5.

def setVB_range(self, lower, upper):

Sets my ValueBasis object vb to a minimum and maximum range.

def value2enum(self, value):

Uses a value in the range 0-1 to select one of my enumerated values.

If I am not a parent with an enumeration index to go with an enumeration sequence, just returns the supplied value as-is.

As an example, here's how a value of 0.3 would select from enumerated values (0.1, 0.22, 0.47, 1.0):

   +---------+---------+---------+---------+
   |   0.1   |  0.22   |   0.47  |   1.0   |
   +---------+---------+---------+---------+
   |   |   |   |   |   |   |   |   |   |   |
  0.0                 0.5                 1.0
              /|\
               |   value 0.3 --> enum 0.22
def isParent(self):

Returns True if I am a parent, i.e, I have no parent and am not an orphan.

def isParam(self):

Returns True if I am a parent, without a known value, and holding the ValueBasis instance vb that determines my value in the value of my children.

Non-parameter AV objects are children, have known values and thus don't need to participate in parameter finding, or have a vbRoot attribute that points to the ValueBasis of a parameter AV object. (You can assume that all child AV objects will have such a linked vbRoot attribute.)

def adopt(self, other):

Designates the supplied other AV object as my child if I am not a child myself (no grandchildren are allowed) or, if I am, as the child of our common parent.

Gives it references to the same ValueBasis object, index array, and container I have, or our common parent has.

Repeated calls on the same AV object have no additional effect.

def copy(self):

Returns a copy of me for doing mods on in the same setup definition.

The copy is designated as my child if I am not a child myself (no grandchildren are allowed), or as the child of our common parent if I am a child.

The copy has the same setup and vb objects as I do, representing association with the same setup and the same default, minMax, known, and enum properties. It also gets a copy of my index array.

The child copy also receives its own copy of what is currently in my mods list (not the list itself). The child can then have additional mods applied to it by being subject to its own arithmetic operations and that won't affect me.

def __eq__(self, other):

I am equal to another object if it is also an instance of my class and has all the same values for name, parent, children, vb, setup, dev, model, and param.

def sameAlteration(self, other):
Undocumented
def am(self, op, other):

Append another (<operation>, <other object>) tuple to my list of mods to be performed.

Only called on an instance of me by the mod operations of another instance.

def __neg__(self):

Returns a copy of me with its value destined to be negated.

def __add__(self, other):

Returns a copy of me with other destined to be added to its value.

If other is 0.0, just returns a reference to my instance rather than a copy.

def __sub__(self, other):

Returns a copy of me with other destined to be subtracted from its value.

If other is 0.0, just returns a reference to my instance rather than a copy.

def __mul__(self, other):

Returns a copy of me with its value destined to be multiplied by other.

If other is 1.0, just returns a reference to my instance rather than a copy.

def __div__(self, other):

Returns a copy of me with its value destined to be divided by other.

If other is 1.0, just returns a reference to my instance rather than a copy.

def __pow__(self, other):

Returns a copy of me with its value destined to be raised to the power other.

If other is 1.0, just returns a reference to my instance rather than a copy.

def inf(self, forcedValue):

Call this to return a copy of me with a forcedValue if one of my mods produces a result of np.inf.

def clip(self, limit):

Returns a copy of me with its value destined to be clipped to +/- limit.

Call this to returns a copy of me that will be set to the limit, positive, if one of my mods produces a result that exceeds it, or the negated limit if one of my mods produces a result that is less than -limit.

def exp(self):

Returns a copy of me with its value converted to exp(value).

def ln(self):

Returns a copy of me with its value converted to the natural logarithm of my value.

def associateWith(self, ID):

Associates me with the provided setup ID if I'm not already.

def doMods(self, valueGetter=None):

Performs all of the mods in my list of mods and returns the final value. If no valueGetter is supplied, uses a default-value extractor: lambda x: x.default.

Note that, if I have an enumerated value, this is the only time I will return that instead of a continuous value in the range 0-1, when it's time to set or alter Ngspice parameters. As far as ADE is concerned, in that case, I am just another continuously alterable value with a minimum of 0.0 and a maximum of 1.0.

Similarly, if I am in logSpace, this is the only time I will return 10^x instead of x. ADE will happily tweak my value from -9 down to -10 or up to -8 without caring that those both evaluate as really tiny numbers.

The currently supported mod operations are:

  • negate, where the current value becomes the negative value of the other object (this means that negation must be performed first in the mod list, and that indeed appears to always be the case),
  • add, where the value of the other object is added,
  • subtract, where the value of the other object is subtracted,
  • multiply, where the value is multiplied by the other object,
  • divide, where the value is divided by the other object,
  • power, where the value is raised to the power of the other object, which in this case must be an int or float. If the other object is zero, the current value becomes inf,
  • inf, where the current value becomes the other object if the current value is inf, but otherwise is left alone,
  • clip, where the current value is clipped to be no greater than the other object's positive value and no less than the other object's negative value.
  • exp, where the value is converted to exp(value).
  • log, where the value is converted to log(value).

These are evaluated in the order that Python processes the arithmetic expression containing them. When in doubt, use parentheses!

Division is performed by multiplying the current value by the other object raised to the -1 power.

Sometimes you may want me to evaluate as exactly zero even if I'm in logSpace because that has a special significance for some Ngspice parameter. If so, just set my log value to -99 (or less).

API Documentation for pingspice, generated by pydoctor at 2021-09-18 08:41:11.