Converts the shell instruction into a basic instruction object, executes it and returns the result.
(cir, transfer=None, source='circuit',
detector='circuit', lgref='circuit', convtype='circuit',
datatype=None, pardefs='circuit', numeric=False,
stepdict=None)
| 1261 | return result |
| 1262 | |
| 1263 | def _executeInstruction(cir, transfer=None, source='circuit', |
| 1264 | detector='circuit', lgref='circuit', convtype='circuit', |
| 1265 | datatype=None, pardefs='circuit', numeric=False, |
| 1266 | stepdict=None): |
| 1267 | """ |
| 1268 | Converts the shell instruction into a basic instruction object, executes it |
| 1269 | and returns the result. |
| 1270 | |
| 1271 | """ |
| 1272 | i1 = instruction() |
| 1273 | i1.circuit = deepcopy(cir) # Changes made to the circuit during execution |
| 1274 | # of the instruction, will not affect the main |
| 1275 | # circuit object |
| 1276 | if detector == 'circuit': |
| 1277 | i1.detector = cir.detector |
| 1278 | elif detector != None: |
| 1279 | i1.setDetector(detector) |
| 1280 | if source == 'circuit': |
| 1281 | i1.source = cir.source |
| 1282 | elif source != None: |
| 1283 | i1.setSource(source) |
| 1284 | if lgref == 'circuit': |
| 1285 | i1.lgRef = cir.lgRef |
| 1286 | elif lgref!= None: |
| 1287 | i1.setLGref(lgref) |
| 1288 | if transfer == None: |
| 1289 | i1.gainType = 'vi' |
| 1290 | else: |
| 1291 | i1.setGainType(transfer) |
| 1292 | i1.dataType = datatype |
| 1293 | i1.numeric = numeric |
| 1294 | if convtype != None: |
| 1295 | i1.convType = convtype.lower() |
| 1296 | else: |
| 1297 | i1.convType = None |
| 1298 | if pardefs == None: |
| 1299 | i1.substitute = False |
| 1300 | else: |
| 1301 | i1.substitute = True |
| 1302 | #oldParDefs = deepcopy(i1.circuit.parDefs) |
| 1303 | if type(pardefs) == dict: |
| 1304 | i1.parDefs = {} |
| 1305 | for key in pardefs.keys(): |
| 1306 | i1.parDefs[sp.Symbol(str(key))] = _checkExpression(pardefs[key]) |
| 1307 | i1.ignoreCircuitParams = True |
| 1308 | elif pardefs== "circuit": |
| 1309 | i1.parDefs = deepcopy(cir.parDefs) |
| 1310 | i1.ignoreCircuitParams = False |
| 1311 | else: |
| 1312 | i1.ignoreCircuitParams = False |
| 1313 | if stepdict == None: |
| 1314 | i1.stepOff() |
| 1315 | else: |
| 1316 | stepParams = _makeStepParams(stepdict) |
| 1317 | try: |
| 1318 | i1.stepMethod = stepParams['stepMethod'] |
| 1319 | except KeyError: |
| 1320 | pass |
no test coverage detected