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

Function _correctDMcurrentinstr

SLiCAP/SLiCAPexecute.py:507–553  ·  view source on GitHub ↗

In cases of a differential-mode current detector (conversion type=None), the numerator of the differential output current, or its associated transfer must be divided by two: I_diff = (I_P - I_N)/2 :param instr: SLiCAP instruction object that holds instruction data. :type instr

(instr)

Source from the content-addressed store, hash-verified

505 return instr
506
507def _correctDMcurrentinstr(instr):
508 """
509 In cases of a differential-mode current detector (conversion type=None),
510 the numerator of the differential output current, or its associated
511 transfer must be divided by two: I_diff = (I_P - I_N)/2
512
513 :param instr: SLiCAP instruction object that holds instruction data.
514 :type instr: SLiCAPinstruction.instruction
515
516 :return: instr of the execution of the instruction.
517 :rtype: SLiCAPinstruction.instruction
518 """
519 if instr.convType == None and instr.gainType != 'loopgain' and instr.gainType != 'servo' and instr.detector != None and instr.detector[0] != None and instr.detector[1] != None:
520 if instr.detector[0][0] == 'I':
521 if instr.step == False:
522 if instr.dataType == 'dcvar':
523 instr.ovar = instr.ovar/4
524 for term in instr.ovarTerms:
525 instr.ovarTerms[term] = instr.ovarTerms[term]/4
526 elif instr.dataType == 'noise':
527 instr.onoise = instr.onoise/4
528 for term in instr.onoiseTerms:
529 instr.onoiseTerms[term] = instr.onoiseTerms[term]/4
530 elif instr.dataType == 'laplace' or instr.dataType == 'dc':
531 instr.laplace = instr.laplace/2
532 instr.numer = instr.numer/2
533 elif instr.dataType == 'numer':
534 instr.numer = instr.numer/2
535 else:
536 if instr.dataType == 'dcvar':
537 for i in range(len(instr.ovar)):
538 instr.ovar[i] = instr[i].ovar/4
539 for term in instr.ovarTerms:
540 instr.ovarTerms[term][i] = instr.ovarTerms[term][i]/4
541 elif instr.dataType == 'noise':
542 for i in range(len(instr.onoise)):
543 instr.onoise[i] = instr.onoise[i]/4
544 for term in instr.onoiseTerms:
545 instr.onoiseTerms[term][i] = instr.onoiseTerms[term][i]/4
546 elif instr.dataType == 'laplace' or instr.dataType == 'dc':
547 for i in range(len(instr.laplace)):
548 instr.laplace[i] = instr.laplace[i]/2
549 instr.numer[i] = instr.numer[i]/2
550 elif instr.dataType == 'numer':
551 for i in range(len(instr.numer)):
552 instr.numer[i] = instr.numer[i]/2
553 return instr
554
555def _updateSRCnames(instr):
556 """

Callers 5

_doNumerFunction · 0.85
_doLaplaceFunction · 0.85
_doNoiseFunction · 0.85
_doDCvarFunction · 0.85
_doDCFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected