-
Notifications
You must be signed in to change notification settings - Fork 0
/
LS370.py
53 lines (40 loc) · 1.22 KB
/
LS370.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
from GPIB import *
import string, os, sys, time
class LS370:
def __init__(self, name):
self.ls = Gpib(name)
ls = self.ls
def read_channel (self, chan):
self.write ('RDGR? ' + str(chan))
data = self.read()
if data =="":
return 0
else:
return float(data)
def auto_scan (self):
self.write('SCAN 1,1')
def scanner_to_channel(self, chan):
self.write('SCAN %d,0'%chan)
#lower level commands start here
def read(self,num=512):
''''' Use only for text data. '''
ls = self.ls
a = ls.read(num)
return a
def readb(self,num=512):
''''' Use to read binary data. This prevents early termination
from a \0. '''
srs = self.srs
a = ls.readb(num)
return a
def write(self,stri):
ls = self.ls
ls.write(str(stri))
def close(self):
self.ls.close()
#if run as own program
#if (__name__ == '__main__'):
# lockin = device('dev9')
# lockin.set_ref_internal # no averaging
# lockin.close()