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

Method checkStep

SLiCAP/SLiCAPinstruction.py:1693–1743  ·  view source on GitHub ↗

This method will check the completeness and the consistency of the instruction data for parameter stepping, before executing the instruction. Called by **instruction.check()** in cases in which instruction.step == True

(self)

Source from the content-addressed store, hash-verified

1691 return
1692
1693 def checkStep(self):
1694 """
1695 This method will check the completeness and the consistency of the
1696 instruction data for parameter stepping, before executing the
1697 instruction.
1698
1699 Called by **instruction.check()** in cases in which
1700 instruction.step == True
1701 """
1702 self.checkStepMethod()
1703 if self.errors == 0:
1704 if not self.step:
1705 self.parDefs = self.circuit.parDefs
1706 elif self.stepMethod == 'lin':
1707 self.checkStepVar()
1708 self.checkStepNum()
1709 self.checkStepStart()
1710 self.checkStepStop()
1711 if self.errors == 0:
1712 self.stepList = np.linspace(self.stepStart, self.stepStop, self.stepNum)
1713 self.stepList = [sp.Rational(item) for item in self.stepList]
1714 self.stepDict[self.stepVar] = self.stepList
1715 elif self.stepMethod == 'log':
1716 self.checkStepVar()
1717 self.checkStepNum()
1718 self.checkStepStart()
1719 self.checkStepStop()
1720 if self.errors == 0 and self.stepStart * self.stepStop > 0:
1721 self.stepList = np.geomspace(self.stepStart, self.stepStop, self.stepNum)
1722 self.stepList = [sp.Rational(item) for item in self.stepList]
1723 self.stepDict[self.stepVar] = self.stepList
1724 else:
1725 self.errors += 1
1726 print("Error: logarithmic stepping cannot include zero.")
1727 elif self.stepMethod == 'list':
1728 self.checkStepVar()
1729 self.checkStepList()
1730 if self.errors == 0:
1731 self.stepList = [sp.Rational(item) for item in self.stepList]
1732 self.stepDict[self.stepVar] = self.stepList
1733 elif self.stepMethod == 'array':
1734 self.checkStepVars()
1735 # We need a list without errors before we can check the array
1736 if self.errors == 0:
1737 self.checkStepArray()
1738 if self.errors == 0:
1739 for i in range(len(self.stepVars)):
1740 tmpLst = self.stepArray[i]
1741 tmpLst = [sp.Rational(item) for item in tmpLst]
1742 self.stepDict[self.stepVars[i]] = tmpLst
1743 return
1744
1745 def check(self):
1746 """

Callers 1

checkMethod · 0.95

Calls 8

checkStepMethodMethod · 0.95
checkStepVarMethod · 0.95
checkStepNumMethod · 0.95
checkStepStartMethod · 0.95
checkStepStopMethod · 0.95
checkStepListMethod · 0.95
checkStepVarsMethod · 0.95
checkStepArrayMethod · 0.95

Tested by

no test coverage detected