diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-11-29 23:24:28 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-11-29 23:24:28 -0500 |
commit | 36c7de408cc81c801e93060f606f37c486cd32e5 (patch) | |
tree | fe39c920dabadd79b28c0785fda42065a09861e9 /scpi.py | |
parent | 805e6d96e969546ed6f663931d6fe73a38a9aa24 (diff) | |
download | qolab-36c7de408cc81c801e93060f606f37c486cd32e5.tar.gz qolab-36c7de408cc81c801e93060f606f37c486cd32e5.zip |
move scpi capable instrument to a separate class
Diffstat (limited to 'scpi.py')
-rw-r--r-- | scpi.py | 66 |
1 files changed, 66 insertions, 0 deletions
@@ -0,0 +1,66 @@ +""" +provide basic class to operate Lock-in +""" + +import pyvisa + +class SCPIinstr: + """ Basic class which support SCPI commands """ + """ + Do not instantiate directly, use + rm = pyvisa.ResourceManager() + SCPIinstr(rm.open_resource('TCPIP::192.168.0.2::INSTR')) + """ + def __init__(self, resource): + print(resource) + self.resource = resource + + # convenience pyvisa functions + self.write = self.resource.write + self.read = self.resource.read + self.query = self.resource.query + self.read_bytes = self.resource.read_bytes + self.read_binary_values = self.resource.read_binary_values + self.query_binary_values = self.resource.query_binary_values + + @property + def idn(self): + return self.query("*IDN?") + + def clear_status(self): + self.write("*CLS") + + def set_event_status_enable(self): + self.write("*ESE") + + def query_event_status_enable(self): + self.query("*ESE?") + + def query_event_status_register(self): + self.query("*ESR?") + + def set_wait_until_finished(self): + self.query("*OPC") + + def wait_until_finished(self): + self.query("*OPC?") + + def reset(self): + self.write("*RST") + + def set_service_request_enable(self): + self.write("*SRE") + + def query_service_request_enable(self): + self.query("*SRE?") + + def query_status_byte(self): + self.query("*STB?") + + def self_test_result(self): + self.query("*TST?") + + def wait(self): + self.write("*WAI") + + |