diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-17 21:34:35 -0400 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2024-07-17 21:34:35 -0400 |
commit | b3c33a359375c5866051b5a8492a7cc8ed743117 (patch) | |
tree | 395347bd1fb4d274ea497e8c477a449adf260877 /qolab/hardware | |
parent | f6f5ce36dc70f7e1cd8aa70da02b2b8b56286654 (diff) | |
download | qolab-b3c33a359375c5866051b5a8492a7cc8ed743117.tar.gz qolab-b3c33a359375c5866051b5a8492a7cc8ed743117.zip |
refactor multimeters for proper imports
Diffstat (limited to 'qolab/hardware')
-rw-r--r-- | qolab/hardware/multimeter/__init__.py | 84 | ||||
-rw-r--r-- | qolab/hardware/multimeter/_basic.py | 84 | ||||
-rw-r--r-- | qolab/hardware/multimeter/bk_5491.py | 2 | ||||
-rw-r--r-- | qolab/hardware/multimeter/hp_34401.py | 2 |
4 files changed, 90 insertions, 82 deletions
diff --git a/qolab/hardware/multimeter/__init__.py b/qolab/hardware/multimeter/__init__.py index 20fd1e6..bf8871d 100644 --- a/qolab/hardware/multimeter/__init__.py +++ b/qolab/hardware/multimeter/__init__.py @@ -1,82 +1,6 @@ -from qolab.hardware.scpi import SCPIinstr -from qolab.hardware.basic import BasicInstrument +"""Multimeters.""" +from .bk_5491 import BK_5491 +from .hp_34401 import HP_34401 -class Multimeter(BasicInstrument): - """ - Multimeter basic class. - - Intended to be part of the hardware aware class. - """ - - def __init__(self, *args, **kwds): - BasicInstrument.__init__(self, *args, **kwds) - self.config["Device type"] = "Multimeter" - self.config["Device model"] = ( - "Generic Multimeter generator Without Hardware interface" - ) - self.config["FnamePrefix"] = "Multimeter" - self.config["Device model"] = "Generic Multimeter Without Hardware interface" - self.config["FnamePrefix"] = "multimeter" - self.deviceProperties.update({}) - - # Minimal set of methods to be implemented. - def getVdc(self): - """Report DC Voltage""" - print("getVdc is not implemented") - return None - - def getVac(self): - """Report AC Voltage""" - print("getVac is not implemented") - return None - - def getAdc(self): - """Report DC Current""" - print("getAdc is not implemented") - return None - - def getAac(self): - """Report AC Current""" - print("getAac is not implemented") - return None - - def getResistance(self): - """Report Resistance""" - print("getResistance is not implemented") - return None - - def getResistance4Wires(self): - """Report Resistance with 4 wire method""" - print("getResistance4Wires is not implemented") - return None - - def getDiode(self): - """Report Diode Voltage drop""" - print("getDiode is not implemented") - return None - - def getFreq(self): - """Report Frequency""" - print("getFreq is not implemented") - return None - - -class MultimeterSCPI(SCPIinstr, Multimeter): - """ - SCPI enabled basic multimeter. - - Intended to be part of the hardware aware class. - - Example - ------- - >>> rm = pyvisa.ResourceManager() - >>> MultimeterSCPI(rm.open_resource('TCPIP::192.168.0.2::INSTR')) - """ - - pass - - def __init__(self, resource, *args, **kwds): - SCPIinstr.__init__(self, resource) - Multimeter.__init__(self, *args, **kwds) - self.config["DeviceId"] = str.strip(self.idn) +__all__ = ["BK_5491", "HP_34401"] diff --git a/qolab/hardware/multimeter/_basic.py b/qolab/hardware/multimeter/_basic.py new file mode 100644 index 0000000..a8e5fac --- /dev/null +++ b/qolab/hardware/multimeter/_basic.py @@ -0,0 +1,84 @@ +"""Basic multimeter classes to be included in hardware aware classes.""" + +from qolab.hardware.scpi import SCPIinstr +from qolab.hardware.basic import BasicInstrument + + +class Multimeter(BasicInstrument): + """ + Multimeter basic class. + + Intended to be part of the hardware aware class. + """ + + def __init__(self, *args, **kwds): + BasicInstrument.__init__(self, *args, **kwds) + self.config["Device type"] = "Multimeter" + self.config["Device model"] = ( + "Generic Multimeter generator Without Hardware interface" + ) + self.config["FnamePrefix"] = "Multimeter" + self.config["Device model"] = "Generic Multimeter Without Hardware interface" + self.config["FnamePrefix"] = "multimeter" + self.deviceProperties.update({}) + + # Minimal set of methods to be implemented. + def getVdc(self): + """Report DC Voltage""" + print("getVdc is not implemented") + return None + + def getVac(self): + """Report AC Voltage""" + print("getVac is not implemented") + return None + + def getAdc(self): + """Report DC Current""" + print("getAdc is not implemented") + return None + + def getAac(self): + """Report AC Current""" + print("getAac is not implemented") + return None + + def getResistance(self): + """Report Resistance""" + print("getResistance is not implemented") + return None + + def getResistance4Wires(self): + """Report Resistance with 4 wire method""" + print("getResistance4Wires is not implemented") + return None + + def getDiode(self): + """Report Diode Voltage drop""" + print("getDiode is not implemented") + return None + + def getFreq(self): + """Report Frequency""" + print("getFreq is not implemented") + return None + + +class MultimeterSCPI(SCPIinstr, Multimeter): + """ + SCPI enabled basic multimeter. + + Intended to be part of the hardware aware class. + + Example + ------- + >>> rm = pyvisa.ResourceManager() + >>> MultimeterSCPI(rm.open_resource('TCPIP::192.168.0.2::INSTR')) + """ + + pass + + def __init__(self, resource, *args, **kwds): + SCPIinstr.__init__(self, resource) + Multimeter.__init__(self, *args, **kwds) + self.config["DeviceId"] = str.strip(self.idn) diff --git a/qolab/hardware/multimeter/bk_5491.py b/qolab/hardware/multimeter/bk_5491.py index 34d3725..4cdfd2d 100644 --- a/qolab/hardware/multimeter/bk_5491.py +++ b/qolab/hardware/multimeter/bk_5491.py @@ -1,5 +1,5 @@ from qolab.hardware.basic import BasicInstrument -from qolab.hardware.multimeter import Multimeter +from ._basic import Multimeter from pyvisa import constants as pyvisa_constants import time diff --git a/qolab/hardware/multimeter/hp_34401.py b/qolab/hardware/multimeter/hp_34401.py index 673c81a..2e586f1 100644 --- a/qolab/hardware/multimeter/hp_34401.py +++ b/qolab/hardware/multimeter/hp_34401.py @@ -1,5 +1,5 @@ from qolab.hardware.basic import BasicInstrument -from qolab.hardware.multimeter import MultimeterSCPI +from ._baskic import MultimeterSCPI from qolab.hardware.scpi import SCPI_PROPERTY from pyvisa import constants as pyvisa_constants import time |