Adds or modifies multiple parameter definitions and updates the list **circuit.params** with names (*sympy.Symbol*) of undefined parameters. :params parDict: Dictionary with key-value pairs: - key: parName (*str, sympy.Symbol*): name of the
(self, parDict)
| 247 | return |
| 248 | |
| 249 | def defPars(self, parDict): |
| 250 | """ |
| 251 | Adds or modifies multiple parameter definitions and updates the list |
| 252 | **circuit.params** with names (*sympy.Symbol*) of undefined parameters. |
| 253 | |
| 254 | :params parDict: Dictionary with key-value pairs: |
| 255 | |
| 256 | - key: parName (*str, sympy.Symbol*): name of the |
| 257 | parameter. |
| 258 | - value: parValue (*str, float, int, sympy object*): |
| 259 | value or expression of the parameter. |
| 260 | |
| 261 | :type parDict: dict |
| 262 | |
| 263 | :return: None |
| 264 | :rtype: None |
| 265 | |
| 266 | """ |
| 267 | errors = 0 |
| 268 | if type(parDict) == dict: |
| 269 | for key in list(parDict.keys()): |
| 270 | try: |
| 271 | eval(key) |
| 272 | print("Error: parameter name cannot be a number.") |
| 273 | errors += 1 |
| 274 | except BaseException: |
| 275 | pass |
| 276 | if errors == 0: |
| 277 | parName = Symbol(str(key)) |
| 278 | parValue = str(parDict[key]) |
| 279 | self.parDefs[parName] = _checkExpression(parValue) |
| 280 | if parName in self.params: |
| 281 | self.params.remove(parName) |
| 282 | else: |
| 283 | print("Error: cannot define a number as parameter.") |
| 284 | else: |
| 285 | print("Error: defPars requires a dict type argument.") |
| 286 | self.updateParams() |
| 287 | return |
| 288 | |
| 289 | def getParValue(self, parNames, substitute=True, numeric=False): |
| 290 | """ |
no test coverage detected