aboutsummaryrefslogtreecommitdiff
path: root/ue9qol.py
diff options
context:
space:
mode:
Diffstat (limited to 'ue9qol.py')
-rw-r--r--ue9qol.py76
1 files changed, 0 insertions, 76 deletions
diff --git a/ue9qol.py b/ue9qol.py
deleted file mode 100644
index e95fe6b..0000000
--- a/ue9qol.py
+++ /dev/null
@@ -1,76 +0,0 @@
-import sys
-import traceback
-import time # For sleep, clock, time and perf_counter
-from datetime import datetime
-import random
-
-import u3
-import u6
-import ue9
-
-class UE9qol:
-
- def __init__(self, debug = False, autoOpen = True, **kargs):
- #d = ue9.UE9(ethernet=True, ipAddress="192.168.1.209") # Over TCP/ethernet connect to UE9 with IP address 192.168.1.209
- self.daq = ue9.UE9(debug=debug, autoOpen=autoOpen)
-
- # For applying the proper calibration to readings.
- c=self.daq.getCalibrationData()
-
- # by evmik
- # fixing missing slope for gain '0'
- c['AINSlopes']['0']= 0.0000775030
-
- def getInputCh(self, chNum, BipGain = 8):
- # BipGain = 8 -> bipolar range (-5V, +5V) gain 1
- # UE9 default BipGain = 0 -> signal range (0V, +5V) gain 1
- # other BipGain could be:
- # 0 = Unipolar Gain 1, 1 = Unipolar Gain 2,
- # 2 = Unipolar Gain 4, 3 = Unipolar Gain 8,
- # 8 = Bipolar Gain 1
- return self.daq.getAIN(chNum, BipGain = BipGain)
-
- def setOutputCh(self, chNum=None, volts=None):
- if chNum == None or volts == None:
- print("setOutputCh needs chNum and volts to be set")
- return 0
- bits = self.daq.voltageToDACBits(volts, dacNumber = chNum)
- # out is completely bogus for DAC settings in UE9
- out=self.daq.singleIO(IOType=5, Channel=chNum, DAC=bits)
- return volts
-
- def close(self):
- self.daq.close()
-
-class UE9qolDummy:
- from funcGenerator import Sweeper, SinGen, TriangleGen, RampGen, PulseGen
- # to be used for graphics debugging
- def __init__(self, debug = False, autoOpen = True, sweeper=None, **kargs):
- self.sweeper = sweeper
- # do nothing
- return
-
- def getInputCh(self, chNum):
- a =.3
- if chNum == 0:
- val = self.SinGen(ampl=a, offset=chNum, sweeper=self.sweeper).getValue()
- elif chNum == 1:
- val = self.PulseGen(ampl=a, sweeper=self.sweeper).getValue()
- val += chNum
- elif chNum == 2:
- val = self.TriangleGen(start=chNum-a/2, stop=chNum+a/2, sweeper=self.sweeper).getValue()
- elif chNum == 3:
- val = self.RampGen(start=chNum-a/2, stop=chNum+a/2, sweeper=self.sweeper).getValue()
- else:
- val = self.SinGen(ampl=.2, offset=chNum, sweeper=self.sweeper).getValue()
- val += random.normalvariate(0, 0.01)
- return val
-
- def setOutputCh(self, chNum=None, volts=None):
- # do nothing
- return
-
- def close(self):
- # do nothing
- return
-