diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-11-29 00:06:30 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-11-29 00:06:30 -0500 |
commit | 5e26df931568559fefc9fac6e2bea39e83df1e76 (patch) | |
tree | 301b3d5a993e240e7885348e04a76107f7ac0d2f /lockin.py | |
parent | fd058ebf6276a620ee7d0fb86dfc5d7d3655036d (diff) | |
download | qolab-5e26df931568559fefc9fac6e2bea39e83df1e76.tar.gz qolab-5e26df931568559fefc9fac6e2bea39e83df1e76.zip |
draft of lockin interface
Diffstat (limited to 'lockin.py')
-rw-r--r-- | lockin.py | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/lockin.py b/lockin.py new file mode 100644 index 0000000..0f54e79 --- /dev/null +++ b/lockin.py @@ -0,0 +1,83 @@ +""" +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): + self.resource = resource + + # convenience pyvisa functions + self.write = self.resource.write + self.read = self.resource.read + self.query = self.resource.query + self.query_values = self.resource.query_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") + + +class LockIn(SCPIinstr): + """ + Do not instantiate directly, use + rm = pyvisa.ResourceManager() + LockIn(rm.open_resource('TCPIP::192.168.0.2::INSTR')) + """ + def __init__(self, resource): + super().__init__(self, resource) + + +if __name__ == '__main__': + print("testing") + rm = pyvisa.ResourceManager() + print(rm.list_resources()) + instr=rm.open_resource('TCPIP::192.168.0.51::INSTR') + lckn = LockIn(instr) + # lckn = LockIn(rm, 'TCPIP::192.168.0.51::INSTR') + print(lckn.query('*idn?')) + + |