pingspice.analysis.param.Setups(object)
class documentation
Part of pingspice.analysis.param
(View In Hierarchy)
Known subclasses: pingspice.analysis.diode.Diode_Setups, pingspice.analysis.mosfet.MOSFET_Setups, pingspice.analysis.thermal.Package_Setups, pingspice.examples.rlc-04.RLC_Setups, pingspice.examples.rlc-06.RLC_Setups, pingspice.test.analysis.test_param.AParameterFinder.Setups, pingspice.test.analysis.test_solver.RC_Setups, pingspice.test.lib.test_diodes.SillySetups
Include an instance of your subclass of me, with my class attributes
defined, as the setups attribute to your ParameterFinder
subclass.
If your subclass of me has a setup
method, it will be called at the beginning of my init, right after setdefaults
and construction of an EvalHelper
.
The goal values for the parameter finder are in my dict Xs, one
2-D Numpy array per setup ID. If you don't want to specify all those
numbers in your subclass, set the goals attribute to text, or a path
of a file containing text, of goals readable by DataParser
.
The class attributes analyzers, independents, Xs,
are dicts, keyed by setup ID, or callables that take a Specs
object as
the sole argument and return a dict. Be sure to order your setups with the
least CPU-intensive ones numbered lowest because evaluations returning huge
SSEs can prevent ones from higher-numbered setups from even bothering to
run.
The class attributes weights and transforms are dicts keyed by vector name.
Class Variable | goals | Text or a text file defining the device's performance goals. Parsed by DataParser . |
Class Variable | specs | Text or a text file defining the device's specifications. Parsed by SpecsParser . |
Class Variable | EvalHelper | A class with a constructor that takes a Specs instance
as its sole argument. I automatically construct it right away if you define
the class and you can refer to the instance via my eh attribute. |
Class Variable | nameLists | A dict of lists of vector names to retrieve after each analysis, each keyed by setup ID. |
Class Variable | plotSpecs | (Optional) A setup ID-keyed dict of plot specificiations, if parameter-fit
plotting is desired. For each setup: None if no plot for that
setup, or a list with:
[<plot title>, <x-axis vector name>, <y-axis vector name(s)>] |
Class Variable | analyzers | A setup ID-keyed dict of lists defining analyzers. The first item in each
is a subclass of sim.Analyzer
or an instance of psim.Analyzer
followed by its setup args. |
Class Variable | independents | A setup ID-keyed dict of lists of names of the vectors that are independent variables. |
Class Variable | Xs | A setup ID-keyed dict of lists of goals that were not otherwise defined with goals. Items can be either a 2-D Numpy array of expected goal values or a callable. An array must have one column for each vector name listed in the nameLists list for that setup. A callable must accept the vectors named in the nameLists list as 1-D Numpy arrays and return a real-valued sum-of-squared error based on how closely the values in those vectors conform to some user-defined goal. If there is no Xs entry for a given setup ID (after I populate it from parsing goals, no analysis for that setup will be included. |
Class Variable | weights | A dict of weights (real values or single-argument callables) to apply to the value from each vector, keyed by the names found in nameLists. A callable must take two args, the integer ID of the series being evaluated and a 1-D Numpy array of values from the vector, and return a positive real-valued weight. |
Class Variable | transforms | A dict, keyed by the name of a transform-produced vector, of callables that
each transform one or more vectors from the Ngspice simulation into a
vector listed in nameLists but not included in the Ngspice
simulation. The result of the transform (which must be a 1-D Numpy array)
will be added to the V object under the name by which the
transform is keyed in this dict. |
Class Variable | logValues | A set of vector names that should be evaluated and plotted in log space rather than linear. I will log-transform any goal points in X corresponding to such vector names. It's up to whoever uses me to do the same log transformation on simulation results. |
Class Variable | defaultSpecs | A dict of default values for attributes that don't appear in a given subclass's specs. |
Instance Variable | netlists | A setup ID-keyed dict of netlist file paths or text. Usually populated by
ParameterFinder . |
Class Method | setdefaults | Examines my class (or subclass), or an object if supplied as a sole argument, for attributes named in my defaultSpecs dict. Those not found are set to the default values. |
Method | __init__ | Setups(**kw) |
Method | __contains__ | I contain a setup ID if it's for a setup I run. |
Method | __len__ | My length is the number of setups I run. |
Method | __iter__ | I iterate over my setup IDs. You can change my IDs attribute during iteration if you want. |
Method | __getstate__ | For pickling during wire evaluation. |
Method | __setstate__ | For unpickling during wire evaluation. |
Method | setup | Override this if you want custom setup at the beginning of my standard
setup, right after setdefaults
gets called and an EvalHelper
instance is constructed. |
Method | _setupDicts | Called by my constructor with a Specs object to
replace any dict-producing callable attributes with their results. |
Method | _prune | Called by my constructor to get (1) a sorted copy of my class-wide IDs list and (2) a pruned version of nameLists containing just entries for the enabled IDs. |
Method | _checkWeights | Called by my constructor to make sure my weights dict is legit. |
Method | _finalizeXs | Called by my constructor to finalize the setting up of a dict of evaluation goals, one Numpy 2-D array or callable evaluator per setup ID. |
Specs
instance
as its sole argument. I automatically construct it right away if you define
the class and you can refer to the instance via my eh attribute.
None
if no plot for that
setup, or a list with:
[<plot title>, <x-axis vector name>, <y-axis vector name(s)>]
sim.Analyzer
or an instance of psim.Analyzer
followed by its setup args.
V
object under the name by which the
transform is keyed in this dict.
ParameterFinder
.
def setdefaults(cls, *args):
Examines my class (or subclass), or an object if supplied as a sole argument, for attributes named in my defaultSpecs dict. Those not found are set to the default values.
Setups(**kw)
You can set an instance's attributes with constructor keywords.
I iterate over my setup IDs. You can change my IDs attribute during iteration if you want.
Override this if you want custom setup at the beginning of my standard
setup, right after setdefaults
gets called and an EvalHelper
instance is constructed.
Called by my constructor with a Specs
object to
replace any dict-producing callable attributes with their results.
The nameLists dict/callable gets done first, with a reference to it included in s so that each setup's vector names are available to the others.
The Xs dict/callable gets done second, with my goals string/file parsed and a reference to it included in s so that its values are available to the others.
Called by my constructor to get (1) a sorted copy of my class-wide IDs list and (2) a pruned version of nameLists containing just entries for the enabled IDs.
If my IDs list is empty, (1) contains all IDs of all keys in nameLists, still sorted, and (2) contains entries for all IDs.
Except: Any ID appearing in my skippedIDs list is always omitted.
Called by my constructor to finalize the setting up of a dict of evaluation goals, one Numpy 2-D array or callable evaluator per setup ID.
- Removes IDs of setups with no goals defined.
-
Sorts independent variables in ascending order so that
sse.ErrorTabulator.closenessToIndepInterpolated
may be used. - Log-transforms any log-space goal values (as indicated by presence of their vector name in my logValues set) into linear space.