-
Notifications
You must be signed in to change notification settings - Fork 0
/
SRS830.py
69 lines (52 loc) · 1.66 KB
/
SRS830.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
from visa import *
import string, os, sys, time
class device:
def __init__(self, name):
self.name = instrument(name)
srs = self.name
def set_ref_internal(self):
srs = self.name
srs.write('FMOD 1')
def set_ref_external(self):
srs = self.name
srs.write('FMOD 0')
def set_phase(self, shift):
srs = self.name
srs.write ('PHAS ' + str(shift))
def set_amplitude(self, amplitude):
srs = self.name
srs.write('SLVL' + str(amplitude))
def get_amplitude(self):
srs = self.name
return srs.ask('SLVL?')
def set_freq(self, freq):
srs = self.name
srs.write ('FREQ ' + str(freq))
def get_freq(self):
srs = self.name
return srs.ask ('FREQ?')
def set_harm(self, harm):
srs = self.name
srs.write ('HARM ' + str(harm))
def set_ref_out(self, voltage):
srs = self.name
srs.write ('SLVL ' + str(voltage))
def get_ref_out(self, voltage):
srs = self.name
srs.write ('SLVL?')
return self.read()
def read_aux (self, num):
srs = self.name
srs.write ('OAUX? ' + str(num))
return float(self.read())
def read_input (self, num):
srs = self.name
return srs.ask ('OUTP? ' + str(num))
def close(self):
self.srs.close()
#if run as own program
#if (__name__ == '__main__'):
# lockin = device('dev9')
# lockin.set_ref_internal # no averaging
# lockin.close()