I manage all of your AV objects. You can iterate me for all of the AV objects that have been added to me, in sequence.

ParametersknownsKnown parameter values. Each entry, keyed by parameter name, contains either a single known value or a 2-sequence defining a different (usually tighter) lower and upper bound than your ParameterFinder subclass does with its f.av calls. (type: dict)
IDA specific setup ID I am to start with. Used for unit tests. (type: int)
twpKnown twiddle percentage: Set to a non-zero percentage value to treats knowns as midpoint of range with endpoints +/- supplied percentage. See the explanation in applyKnowns. (type: float)
verboseSet True to get warnings about known values or lower/upper bounds being outside the lower/upper bound of the AV object as defined in its f.av call. Not particularly useful. (type: bool)
Method __init__ AV_Manager(knowns={}, ID=0, twp=None, verbose=False)
Method __len__ My length is the number of AV objects in my avList.
Method __iter__ I can iterate over the AV objects that are in my avLlist when you start the iteration.
Method knownParams Returns a dict of known parameters, keyed by their AV names and each containing the known AV object's default/known value.
Method namerator Generates all my AV objects, each parent and all its children, with the parameter name.
Method IDerator Generates my AV objects associated with the specified setup ID.
Method paramerator Generates the names of my parameter AV objects associated with the specified setup ID.
Method setSetupID Sets the setup ID for all AV objects added hereafter with add. Call this each time you want to add AV objects for a different setup.
Method setRelationships Sets the relationships of the supplied AV object av with respect to all others (except av) in my list.
Method applyKnowns Applies any known value or value range from my knowns dict to the supplied av object.
Method add Adds the supplied av object to me for my current setup ID, if I don't have it already.
Method addFromCall Adds the supplied av object to me for my current setup ID, from a call to an Elements instance. If it's already been added from another call, makes a copy.
Method finalize Goes over my AV list to ensure that every child of every parent has been included, both up and down the ancestry chain, even ones that weren't supplied via a call to add.
Method paramsFromText Returns a dict of parameters with their names and values parsed from the supplied text. Any known parameters are included as well.
def __init__(self, knowns={}, ID=0, twp=None, verbose=False):

AV_Manager(knowns={}, ID=0, twp=None, verbose=False)

def __len__(self):

My length is the number of AV objects in my avList.

def __iter__(self):

I can iterate over the AV objects that are in my avLlist when you start the iteration.

The iteration does not change if you add or remove AV objects to my avList during it, and doing that does not raise an exception.

def knownParams(self):

Returns a dict of known parameters, keyed by their AV names and each containing the known AV object's default/known value.

def namerator(self, name, excluded=None):

Generates all my AV objects, each parent and all its children, with the parameter name.

You can supply an AV object to be excluded.

def IDerator(self, ID):

Generates my AV objects associated with the specified setup ID.

def paramerator(self, ID):

Generates the names of my parameter AV objects associated with the specified setup ID.

def setSetupID(self, ID):

Sets the setup ID for all AV objects added hereafter with add. Call this each time you want to add AV objects for a different setup.

def setRelationships(self, av):

Sets the relationships of the supplied AV object av with respect to all others (except av) in my list.

The processing is different if av is a parent or child.

Parent AV Object

First, I have the parent av object adopt any orphan AV objects having the same name.

Then, if its vbRoot is None, it's potentially a parameter AV object. However, there can only be one parameter object for each name, so I check for any other same-name parent with None as its vbRoot. If I find one (and I only should find one), I set the supplied av object's vbRoot to that, preserving the existing AV object's status as sole parameter.

As a sanity check, I continue looking through my av list even after finding an existing parameter AV object, just to make sure that there is no second parameter AV object for the name of the supplied av object. If there is somehow, I raise an exception.

Child AV Object

If av is a child with a parent and a live ValueBasis, there's nothing that needs to be done to it. If it's an orphan or its vb attribute is boolean False, however, I look through my list to see if there's a parent of the same name and, if so, have that parent AV object adopt it. See AV.adopt.

A non-orphan child can be "adopted" with no harm done. The call to AV.adopt just has the effect of making sure its vb, index, and container are all referencing those objects of a same-name parent.

def applyKnowns(self, av):

Applies any known value or value range from my knowns dict to the supplied av object.

If I have a known value (or, more typically, a narrower range of values) for the name of an AV object, and it's not an orphan, I will call its setVB_known method with that. I don't do this for an orphan because it will eventually get its vb attribute set to reference a parent's ValueBasis.

Including a single value in knowns for a given name will completely exclude AV objects with that name from parameter finding. You usually won't want to do this, because models seldom have parameters that are 100% independent of all others. Freezing a parameter at what looks like an optimum value may seem like a good idea, and it does reduce the Differential Evolution search space, but runs the risk of hanging part of your model onto a local minimum. It's usually better to use the twp constructor keyword and let even seemingly optimal values twiddle around a bit.

Including a range (typically but not necessarily narrower) in knowns for a given name will cause parameter finding to be done for that lower/upper bound rather than the one that was used to define the AV object.

def add(self, av):

Adds the supplied av object to me for my current setup ID, if I don't have it already.

Later, after you're done adding AV objects to me, you can conduct analyses with a list of altered parameter values. The bounds and transformations of each parameter value will be defined by my AV objects that are not children of other AV objects (and do not have a known value), in the sequence they were added.

If the AV object is not a child of another AV object, it must have a ValueBasis object with either default or minMax attributes set to define its acceptable range of values.

Before appending the AV object to my avList, I do the following to it:

  1. Apply any known value or (usually tightened) value range for its name, with a call to applyKnowns.
  2. Associate it with my current setup ID, with a call to the AV object's associateWith method.
  3. Set parent and child relationships affecting it, with a call to setRelationships.
def addFromCall(self, av):

Adds the supplied av object to me for my current setup ID, from a call to an Elements instance. If it's already been added from another call, makes a copy.

Returns the AV object that was added, original or copy.

def finalize(self):

Goes over my AV list to ensure that every child of every parent has been included, both up and down the ancestry chain, even ones that weren't supplied via a call to add.

Checks to make sure that I am maintaining a known AV object for each parameter name in my knowns dict that has a definitely known value. For any that are missing, logs a line of text with a warning message.

def paramsFromText(self, text):

Returns a dict of parameters with their names and values parsed from the supplied text. Any known parameters are included as well.

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