-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.py
45 lines (37 loc) · 906 Bytes
/
play.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
import time
from sls_detector_tools.keithley import SerialInstrument, PicoamMeter
from sls_detector_tools import BigXrayBox
import numpy as np
import matplotlib.pyplot as plt
b = BigXrayBox()
b.unlock()
s = PicoamMeter()
s.open_port()
s.configure()
plt.figure()
N = 20
s.output = True
V = np.zeros(N)
I = np.zeros(N)
b.open_shutter('Direct beam')
print(b.shutter_status)
for c in [20, 30, 40]:
b.current = c
time.sleep(10)
for i, v in enumerate(np.linspace(-1, 0.1, N)):
s.voltage = v
time.sleep(1)
I[i] = s.current
V[i] = s.voltage
print(i, I[i], V[i])
plt.plot(V, I, label = 'beam: {}mA'.format(c))
b.close_shutter('Direct beam')
for i, v in enumerate(np.linspace(-1, 0.1, N)):
s.voltage = v
time.sleep(0.1)
I[i] = s.current
V[i] = s.voltage
print(i, I[i], V[i])
plt.plot(V, I, label = 'no beam')
plt.legend()
plt.show()