MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / checkStepVar

Method checkStepVar

SLiCAP/SLiCAPinstruction.py:762–780  ·  view source on GitHub ↗

Checks if the step variable is defined correctly. Called by **instruction.checkStep()** and by **setStepVar( )**.

(self)

Source from the content-addressed store, hash-verified

760 return
761
762 def checkStepVar(self):
763 """
764 Checks if the step variable is defined correctly.
765
766 Called by **instruction.checkStep()** and by **setStepVar(<stepVar>)**.
767 """
768 if self.stepVar == None:
769 self.errors += 1
770 print("Error: missing step variable.")
771 elif isinstance(self.stepVar, sp.Basic):
772 pass
773 elif type(self.stepVar) == str:
774 self.stepVar = sp.Symbol(self.stepVar)
775 else:
776 self.errors += 1
777 print("Error: argument type must be 'str' or 'sympy.Symbol'.")
778 if self.stepVar not in list(self.circuit.parDefs.keys()) and self.stepVar not in self.circuit.params:
779 print("Warning: unknown step parameter '{0}'.".format(self.stepVar))
780 return
781
782 def setStepVars(self, stepVars):
783 """

Callers 2

setStepVarMethod · 0.95
checkStepMethod · 0.95

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected