Checks if the array with step values is defined properly. Called by **instruction.checkStep()** and by **instruction.setStepArray( )**. The step array is a list of lists. The number of lists must equal the number of step variables. The numbers in the list
(self)
| 1121 | return |
| 1122 | |
| 1123 | def checkStepArray(self): |
| 1124 | """ |
| 1125 | Checks if the array with step values is defined properly. |
| 1126 | |
| 1127 | Called by **instruction.checkStep()** and by **instruction.setStepArray(<stepArray>)**. |
| 1128 | |
| 1129 | The step array is a list of lists. The number of lists must equal the |
| 1130 | number of step variables. The numbers in the lists are subsequent |
| 1131 | values of the associated step variable. All lists should have equal |
| 1132 | lengths. |
| 1133 | """ |
| 1134 | if self.stepArray == None: |
| 1135 | self.errors += 1 |
| 1136 | print("Error: missing stepArray.") |
| 1137 | elif type(self.stepArray) == list: |
| 1138 | numVars = len(self.stepArray) |
| 1139 | if numVars != len(self.stepVars): |
| 1140 | self.errors += 1 |
| 1141 | print("Error: mismatch between dimensions of stepArray and stepVars.") |
| 1142 | else: |
| 1143 | numSteps = len(self.stepArray[0]) |
| 1144 | for i in range(numVars): |
| 1145 | if len(self.stepArray[i]) != numSteps: |
| 1146 | self.errors += 1 |
| 1147 | print("Error: unequal number of steps for step variables.") |
| 1148 | if self.errors == 0: |
| 1149 | for j in range(numSteps): |
| 1150 | value = _checkNumber(self.stepArray[i][j]) |
| 1151 | if value == None: |
| 1152 | self.errors += 1 |
| 1153 | print("Error: cannot determine numeric value of stepArray[{0}, {1}].".format(i, j)) |
| 1154 | else: |
| 1155 | self.stepArray[i][j] = value |
| 1156 | return |
| 1157 | |
| 1158 | |
| 1159 | def setSource(self, source): |
no test coverage detected