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

Function _doDC

SLiCAP/SLiCAPexecute.py:821–880  ·  view source on GitHub ↗

Calculates the DC response at the detector using the parameter 'dc' of independent sources as input. The instr will be stored in the .dc attribute of the instr object. :param instr: SLiCAP instruction object that holds instruction data. :type instr: SLiCAPinstruction.instructi

(instr)

Source from the content-addressed store, hash-verified

819 return instr
820
821def _doDC(instr):
822 """
823 Calculates the DC response at the detector using the parameter 'dc' of
824 independent sources as input.
825
826 The instr will be stored in the .dc attribute of the instr object.
827
828 :param instr: SLiCAP instruction object that holds instruction data.
829 :type instr: SLiCAPinstruction.instruction
830
831 :return: instr of the execution of the instruction.
832 :rtype: SLiCAPinstruction.instruction
833 """
834 if instr.step:
835 if ini.step_function:
836 if instr.gainType == 'loopgain' or instr.gainType == 'servo':
837 instr = _makeAllMatrices(instr, inductors=True)
838 instr.Iv = instr.Iv.xreplace({ini.laplace: 0})
839 instr.M = instr.M.xreplace({ini.laplace: 0})
840 instr = _doPyLoopGainServo(instr)
841 dcFunc = instr.laplace[0]
842 else:
843 instr = _makeAllMatrices(instr, inductors=True)
844 instr.Iv = instr.Iv.xreplace({ini.laplace: 0})
845 instr.M = instr.M.xreplace({ini.laplace: 0})
846 instr = _doPyLaplace(instr)
847 dcFunc = instr.laplace[0]
848 instr.laplace = _stepFunctions(instr.stepDict, dcFunc)
849 else:
850 stepVars = list(instr.stepDict.keys())
851 numSteps = len(instr.stepDict[stepVars[0]])
852 for i in range(numSteps):
853 for j in range(len(stepVars)):
854 instr.parDefs[stepVars[j]] = instr.stepDict[stepVars[j]][i]
855 if instr.gainType == 'loopgain' or instr.gainType == 'servo':
856 instr = _makeAllMatrices(instr, inductors=True)
857 instr.Iv = instr.Iv.xreplace({ini.laplace: 0})
858 instr.M = instr.M.xreplace({ini.laplace: 0})
859 instr = _doPyLoopGainServo(instr)
860 else:
861 instr = _makeAllMatrices(instr, inductors=True)
862 instr.Iv = instr.Iv.xreplace({ini.laplace: 0})
863 instr.M = instr.M.xreplace({ini.laplace: 0})
864 instr = _doPyLaplace(instr)
865 else:
866 if instr.gainType == 'loopgain' or instr.gainType == 'servo':
867 instr = _makeAllMatrices(instr, inductors=True)
868 instr.Iv = instr.Iv.xreplace({ini.laplace: 0})
869 instr.M = instr.M.xreplace({ini.laplace: 0})
870 instr = _doPyLoopGainServo(instr)
871 else:
872 instr = _makeAllMatrices(instr, inductors=True)
873 instr.Iv = instr.Iv.xreplace({ini.laplace: 0})
874 instr.M = instr.M.xreplace({ini.laplace: 0})
875 instr = _doPyLaplace(instr)
876 instr.laplace = instr.laplace[0]
877 instr.numer = instr.numer[0]
878 instr.denom = instr.denom[0]

Callers 1

_doInstructionFunction · 0.85

Calls 5

_makeAllMatricesFunction · 0.85
_doPyLoopGainServoFunction · 0.85
_doPyLaplaceFunction · 0.85
_stepFunctionsFunction · 0.85
_correctDMcurrentinstrFunction · 0.85

Tested by

no test coverage detected