Adds the instr of a dcvar analysis to instr. :param instr: SLiCAP instruction object that holds instruction data. :type instr: SLiCAPinstruction.instruction :return: instr of the execution of the instruction. :rtype: SLiCAPinstruction.instruction
(instr)
| 398 | return instr |
| 399 | |
| 400 | def _doDCvar(instr): |
| 401 | """ |
| 402 | Adds the instr of a dcvar analysis to instr. |
| 403 | |
| 404 | :param instr: SLiCAP instruction object that holds instruction data. |
| 405 | :type instr: SLiCAPinstruction.instruction |
| 406 | |
| 407 | :return: instr of the execution of the instruction. |
| 408 | :rtype: SLiCAPinstruction.instruction |
| 409 | """ |
| 410 | conv_type = instr.convType |
| 411 | if instr.step: |
| 412 | print("Warning: parameter stepping not (yet) tested for 'dcvar' analysis!") |
| 413 | if ini.step_function: |
| 414 | instr.convType = None |
| 415 | instr = _makeAllMatrices(instr, reduce=False) |
| 416 | instr.dataType = 'dcsolve' |
| 417 | instr = _doDCsolve(instr) |
| 418 | M, Iv, Dv = instr.M, instr.Iv, instr.Dv |
| 419 | instr.dataType = 'dcvar' |
| 420 | _addDCvarSources(instr, instr.dcSolve[0]) |
| 421 | instr.convType = conv_type |
| 422 | varinstr = _doPyDCvar(instr) |
| 423 | instr.ovar = _stepFunctions(instr.stepDict, varinstr.ovar[0]) |
| 424 | instr.ivar = _stepFunctions(instr.stepDict, varinstr.ivar[0]) |
| 425 | for srcName in list(varinstr.ovarTerms.keys()): |
| 426 | instr.ovarTerms[srcName] = _stepFunctions(instr.stepDict, varinstr.ovarTerms[srcName][0]) |
| 427 | instr.ivarTerms[srcName] = _stepFunctions(instr.stepDict, varinstr.ivarTerms[srcName][0]) |
| 428 | _delDCvarSources(instr) |
| 429 | if instr.convType != None: |
| 430 | # Restore DC solution matrices |
| 431 | instr.M = M |
| 432 | instr.Iv = Iv |
| 433 | instr.Dv = Dv |
| 434 | instr = _convertDCsolve(instr) |
| 435 | else: |
| 436 | stepVars = list(instr.stepDict.keys()) |
| 437 | numSteps = len(instr.stepDict[stepVars[0]]) |
| 438 | M = [] |
| 439 | Iv = [] |
| 440 | Dv = [] |
| 441 | for i in range(numSteps): |
| 442 | instr.convType = None |
| 443 | for j in range(len(stepVars)): |
| 444 | instr.parDefs[stepVars[j]]=instr.stepDict[stepVars[j]][i] |
| 445 | instr.dataType = 'dcsolve' |
| 446 | instr = _doDCsolve(instr) |
| 447 | M.append(instr.M) |
| 448 | Iv.append(instr.Iv) |
| 449 | Dv.append(instr.Dv) |
| 450 | _addDCvarSources(instr, instr.dcSolve[-1]) |
| 451 | instr.convType = conv_type |
| 452 | instr.dataType = 'dcvar' |
| 453 | instr = _doPyDCvar(instr) |
| 454 | _delDCvarSources(instr) |
| 455 | if instr.convType != None: |
| 456 | raise NotImplementedError("DC solution not converted to CM and DM variables with ini.stepFunction=False.") |
| 457 | else: |
no test coverage detected