Returns the value or expression of one or more parameters. If substitute == True, recursive substitution of all circuit parameters will be applied. If numeric == True, numeric values of functions wand constants will be evaluated and converted to sy
(self, parNames, substitute=True, numeric=False)
| 287 | return |
| 288 | |
| 289 | def getParValue(self, parNames, substitute=True, numeric=False): |
| 290 | """ |
| 291 | Returns the value or expression of one or more parameters. |
| 292 | |
| 293 | If substitute == True, recursive substitution of all circuit parameters |
| 294 | will be applied. |
| 295 | |
| 296 | If numeric == True, numeric values of functions wand constants will be |
| 297 | evaluated and converted to sympy.Floats |
| 298 | |
| 299 | :param parNames: name(s) of the parameter(s) |
| 300 | :type parNames: str, sympy.Symbol, list |
| 301 | |
| 302 | :param substitute: - True: circuit parameters will be recursively |
| 303 | substituted |
| 304 | - False: Parameter values or expressions will be |
| 305 | returned as defined |
| 306 | |
| 307 | Defaults to True |
| 308 | |
| 309 | :type substitute: Bool |
| 310 | |
| 311 | :param numeric: - True: Numeric values of functions and constants will |
| 312 | be evaluated and rational numbers will be converted |
| 313 | to sympy.Float |
| 314 | - False: No numeric evaluation of functions and |
| 315 | constants |
| 316 | |
| 317 | Defaults to False |
| 318 | |
| 319 | :type numeric: Bool |
| 320 | |
| 321 | :return: - If type(parNames) == list: a dict with key-value pairs: |
| 322 | |
| 323 | - key (sympy.Symbol): name of the parameter |
| 324 | - value (sympy.Float, sympy.Expr): value of the parameter |
| 325 | |
| 326 | - Else: value or expression (sympy.Float or sympy.Expr). |
| 327 | |
| 328 | :rtype: dict, sympy.Float, sympy.Expr |
| 329 | |
| 330 | """ |
| 331 | if type(parNames) == list: |
| 332 | parValues = {} |
| 333 | for par in parNames: |
| 334 | par = Symbol(str(par)) |
| 335 | for key in list(self.parDefs.keys()): |
| 336 | if par == key: |
| 337 | if substitute == True: |
| 338 | parValues[par] = fullSubs(self.parDefs[key], self.parDefs) |
| 339 | else: |
| 340 | parValues[par] = self.parDefs[key] |
| 341 | if numeric: |
| 342 | parValues[par] = N(parValues[par]) |
| 343 | else: |
| 344 | parName = Symbol(str(parNames)) |
| 345 | parValues = None |
| 346 | try: |
no test coverage detected