diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-13 18:11:07 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-13 18:11:07 -0400 |
commit | 14e413680c0b9f6a772dbb1816eaa51105b8a433 (patch) | |
tree | 7954a4e169b6b715cfc7046f869c03cea5c208a6 /qolab/hardware/daq | |
parent | 1489ed576f57aabfe7bf222dcd62309c79019e32 (diff) | |
download | qolab-14e413680c0b9f6a772dbb1816eaa51105b8a433.tar.gz qolab-14e413680c0b9f6a772dbb1816eaa51105b8a433.zip |
black formatter
Diffstat (limited to 'qolab/hardware/daq')
-rw-r--r-- | qolab/hardware/daq/labjack_ue9.py | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/qolab/hardware/daq/labjack_ue9.py b/qolab/hardware/daq/labjack_ue9.py index c232501..bab2fc9 100644 --- a/qolab/hardware/daq/labjack_ue9.py +++ b/qolab/hardware/daq/labjack_ue9.py @@ -2,32 +2,37 @@ from qolab.hardware.basic import BasicInstrument from qolab.hardware.daq import DAQ import ue9 + class LabJackUE9(DAQ): """ This custom modification of the stock LabJack UE9 class provided by LabJack as ue9 """ - def __init__(self, *args, debug = False, autoOpen = True, ethernet=False, ipAddress=None, **kargs): + def __init__( + self, *args, debug=False, autoOpen=True, ethernet=False, ipAddress=None, **kargs + ): """ LabJack UE9 can be contacted via TCP, use LabJackUE9(ethernet=True, ipAddress="192.168.1.209") """ super().__init__(*args, **kargs) - self.config['Device model'] = 'LabJack UE9' - self.AnalogInputsNum=4 - self.AnalogOutputsNum=2 + self.config["Device model"] = "LabJack UE9" + self.AnalogInputsNum = 4 + self.AnalogOutputsNum = 2 - self.daq = ue9.UE9(debug=debug, autoOpen=autoOpen, ethernet=ethernet, ipAddress=ipAddress) + self.daq = ue9.UE9( + debug=debug, autoOpen=autoOpen, ethernet=ethernet, ipAddress=ipAddress + ) # For applying the proper calibration to readings. - c=self.daq.getCalibrationData() + c = self.daq.getCalibrationData() # by evmik # fixing missing slope for gain '0' - c['AINSlopes']['0']= 0.0000775030 + c["AINSlopes"]["0"] = 0.0000775030 def getAIN(self, chNum): - """ get analog input (AIN) voltage """ + """get analog input (AIN) voltage""" BipGain = 8 Resolution = 12 SettlingTime = 0 @@ -37,26 +42,27 @@ class LabJackUE9(DAQ): # 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, Resolution = Resolution, SettlingTime = SettlingTime) + return self.daq.getAIN( + chNum, BipGain=BipGain, Resolution=Resolution, SettlingTime=SettlingTime + ) def setDAC(self, chNum, volts): - """ set digital to analog (DAC) output voltage """ + """set digital to analog (DAC) output voltage""" if chNum == None or volts == None: print("setOutputCh needs chNum and volts to be set") return 0 - bits = self.daq.voltageToDACBits(volts, dacNumber = chNum) + 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) + out = self.daq.singleIO(IOType=5, Channel=chNum, DAC=bits) return volts def close(self): self.daq.close() - -if __name__ == '__main__': +if __name__ == "__main__": daq = LabJackUE9() print("testing") - print('------ Header start -------------') - print(str.join('\n', daq.getHeader())) - print('------ Header ends -------------') + print("------ Header start -------------") + print(str.join("\n", daq.getHeader())) + print("------ Header ends -------------") |