I tabulate the sum of squared errors between a simulated result and the goals you'd set for that simulation.

Construct me with a dict of nameLists, optionally, a dict of transforms with callables keyed by vector name. If all that will ever be asked of me is the total SSE, you can omit the nameLists. (For remote evaluations, only the total SSE will ever be required.)

I am a disposable object. Use me once and throw away, to avoid concurrency problems.

Instance Variable bogus 0 True if an error occurred while producing my result, or if I've been told to abort tabulation.
Method __init__ ErrorTabulator(nameLists=None, transforms={})
Method bogus 1 Undocumented
Method bogus Undocumented
Method __nonzero__ I am True if I'm not bogus, i.e., no errors occurred while producing my result, and I haven't been told to abort tabulation.
Method __float__ Undocumented
Method __lt__ Undocumented
Method __le__ Undocumented
Method __gt__ Undocumented
Method __ge__ Undocumented
Method __eq__ Undocumented
Method __ne__ Undocumented
Method __sub__ Undocumented
Method __div__ Undocumented
Method __str__ Undocumented
Method __repr__ Undocumented
Method maybeLog If the vector x with the specified name is to be evaluated in logspace, returns its base-10 (common) logarithm.
Method total Returns my total SSE of all evals done.
Method biggestDiff Identifies the biggest per-setup SSE difference between my results and the results of another instance of me other.
Method closenessToIndepInterpolated Call this when you have a single non-enumerable independent vector that is increasing in values.
Method closenessToIndep SSE of the closest points in Y to each combination of independent values (as selected by the I index list/vector) in the 2-D array X.
Method closenessToAll Call this instead of closenessToIndep in the unlikely case that there are no independent column vectors in X.
Method closenesserator Iterator for doing math-intensive simulation post-processing in a Twisted-friendly manner.
Method add Call this with a vectors.Vectors_Ngspice or vectors.Vectors_Python instance populated with simulation result vectors, an ID, and an instance of EvalSpec.
bogus 0 =
True if an error occurred while producing my result, or if I've been told to abort tabulation.
def __init__(self, nameLists=None, transforms={}):

ErrorTabulator(nameLists=None, transforms={})

@property
def bogus 1(self):
Undocumented
@bogus.setter
def bogus(self, yes):
Undocumented
def __nonzero__(self):

I am True if I'm not bogus, i.e., no errors occurred while producing my result, and I haven't been told to abort tabulation.

def __float__(self):
Undocumented
def __lt__(self, other):
Undocumented
def __le__(self, other):
Undocumented
def __gt__(self, other):
Undocumented
def __ge__(self, other):
Undocumented
def __eq__(self, other):
Undocumented
def __ne__(self, other):
Undocumented
def __sub__(self, other):
Undocumented
def __div__(self, other):
Undocumented
def __str__(self):
Undocumented
def __repr__(self):
Undocumented
def maybeLog(self, x, evalSpec, name):

If the vector x with the specified name is to be evaluated in logspace, returns its base-10 (common) logarithm.

Any values less than or equal to zero are converted to 1/10 the minimum positive non-zero value or to 1e-30 if there are no positive non-zero values.

def total(self):

Returns my total SSE of all evals done.

def biggestDiff(self, other):

Identifies the biggest per-setup SSE difference between my results and the results of another instance of me other.

Returns 3-tuple with (1) the setup ID for the biggest SSE difference, (2) my SSE for that setup, and (3) the SSE of other for that setup. If no SSE difference was found, returns None.

def closenessToIndepInterpolated(self, X, Y, evalSpec):

Call this when you have a single non-enumerable independent vector that is increasing in values.

That will usually be the case. This method's way of evaluating is more efficient and gives a more accurate result, so use it whenever you can.

Each dependent vector value is linearly interpolated to find what its value would have been (an estimate, but a pretty close one) for each independent vector value. Then those interpolated dependent values are compared to what they are expected to be for each independent value, all in one sum-of-squares operation for each dependent vector value.

The weight of the independent vector is disregarded for this type of closeness calculation. That's because the difference between observed and expected dependent vector values is calculated at the dependent vector's exact values, not some close-by point as with closenessToIndep and closenessToAll.

If there is also an enumerable independent vector, the calculation is repeated for each unique value of that vector, with a subset of rows of X and Y where that vector has an exact match with particular unique value.

def closenessToIndep(self, X, Y, evalSpec):

SSE of the closest points in Y to each combination of independent values (as selected by the I index list/vector) in the 2-D array X.

Weights W are of the same dimensions as X. Weights of independent vector values are considered along with dependent vector values, because the SSE of each point is partially dependent on how close the selected goal point is to the simulated point.

If I manage to select a goal point whose independent-vector value(s) exactly match the simulated independent-vector values, then the independent vector value weight will be multiplied by zero (as part of the vector product) and thus irrelevant. But only in that case, for this closeness computation method. If you will have an exact match between simulation and goal at every point, for all of your independent vectors except at most one, use closenessToIndepInterpolated instead.

Except where there are just one or two goal points, independent values in X that exceed the range of independent values in Y will be disregarded. For best results, make sure your Y more than covers the range of X.

def closenessToAll(self, X, Y, evalSpec):

Call this instead of closenessToIndep in the unlikely case that there are no independent column vectors in X.

The SSE will be the minimum distance between each goal point in X and all points in Y, with weighting by W. The W array must be of the same dimensions as X, with one weight combo for each goal point.

You will probably never use this. When will you have a situation where there is no independent variable?

def closenesserator(self, ID, X, V, evalSpec):

Iterator for doing math-intensive simulation post-processing in a Twisted-friendly manner.

All the yielding involved doesn't seem to incur any noticeable performance hit.

Updates my SSE attribute in place.

@defer.inlineCallbacks
def add(self, ID, V, evalSpec):

Call this with a vectors.Vectors_Ngspice or vectors.Vectors_Python instance populated with simulation result vectors, an ID, and an instance of EvalSpec.

It will contain at a minimum a nameList of vector names for this simulation setup, and a callable or 2-D Numpy array X of goal points.

Callable Goals

If X is a callable, it must accept one 1-D Numpy array for each vector in the nameList and return a 2-tuple with (1) a real-valued (pre-weighted) fitness metric equivalent to the sum of squared error and (2) a 2-D array of goal points that the vector coordinates were evaluated against.

As an example, see analysis.mosfet.RevCurrentEvaluator and the MOSFET_Setups.Xs method that defines it as a goal callable along with two other callable class instances.

A callable X may return a Deferred, but it has to have a dr attribute set True if that is the case. The preferred form of a callable goal is a class instance with a __call__ method, and obviously there's no problem with setting an attribute dr of a class or instance. You can set attributes of unbound functions, so something like this is acceptable, too:

   def goal_deferred(t, X):
       t2 = np.square(t)
       SSE = np.square(np.sum(X-t2))
       return defer.succeed((SSE, t2))
   goal_deferred.dr = True

There is no weight applied to a callable goal. You simply scale up the SSE result it provides as much as you want it weighted.

Array Goals

If X is a 2-D array, the evalSpec will also contain a 2-D array W of the same dimensions as X with real-valued weights for each goal point value.

NOTE: The logValues setting is only applicable to the array form of X and is disregarded during evaluation of a callable X.

Independent Vectors

If (as will be typical) there are independent variables in each goal point in X, the evalSpec will also include a list indieFlags of the same length as each goal point coordinate. Each list element will be True for an independent variable or False otherwise.

See AlsoEvaluator._gotV, which is called by public methods Evaluator.evaluate and Evaluator.evaluateSSE.
API Documentation for pingspice, generated by pydoctor at 2021-09-18 08:41:11.