MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / _getValue

Function _getValue

SLiCAP/SLiCAPmatrices.py:46–82  ·  view source on GitHub ↗

Returns the symbolic or numeric value of a parameter of an element. This function is called by _makeMatrices(). :parm elmt: element object :type elmt: SLiCAPprotos.element :param param: parameter of interest ('value', 'noise', 'dc' or 'dcvar') :type param: str :param

(elmt, param, numeric, parDefs, substitute)

Source from the content-addressed store, hash-verified

44
45
46def _getValue(elmt, param, numeric, parDefs, substitute):
47 """
48 Returns the symbolic or numeric value of a parameter of an element.
49
50 This function is called by _makeMatrices().
51
52 :parm elmt: element object
53 :type elmt: SLiCAPprotos.element
54
55 :param param: parameter of interest ('value', 'noise', 'dc' or 'dcvar')
56 :type param: str
57
58 :param numeric: If True is uses full substitution and sympy.N for converting
59 parameters to sympy floats
60 :type numeric: bool
61
62 :param parDefs: Dict with key value pairs:
63
64 - key : parameter name (sympy.Symbol)
65 - value: numeric value of sympy expression
66 :type parDefs: dict
67
68 :return: value: sympy expresssion or numeric value of the element parameter
69 :return type: sympy.Expr, int, float, sympy.Float
70 """
71 try:
72 if param not in list(elmt.params.keys()):
73 value = None
74 except:
75 value = None
76 if param in list(elmt.params.keys()):
77 value = elmt.params[param]
78 if substitute == True:
79 value = float2rational(fullSubs(value, parDefs))
80 if numeric == True:
81 value = float2rational(sp.N(value))
82 return value
83
84
85def _createDepVarIndex(circuitObject):

Callers 3

_getValuesFunction · 0.85
_makeMatricesFunction · 0.85
_makeSrcVectorFunction · 0.85

Calls 2

float2rationalFunction · 0.90
fullSubsFunction · 0.90

Tested by

no test coverage detected