/
test.py
62 lines (52 loc) · 1.32 KB
/
test.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
import time
import T, UI
import numpy as np
import mm, utils, acs
import matplotlib.pyplot as plt
acs.To(39)
z0 = mm.GetZ()
beads = UI.SelectBeads(T, mm.Get)
UI.Calibrate(beads, T, mm.Get, mm.GetZ, mm.SetZ)
for i in range(1, len(beads)):
beads[i].rf = 14 # reference beads
T.ComputeCalibration(beads)
for i in range(len(beads)):
utils.PlotCalibration(beads[i])
δz = 4000
mm.SetZ(z0 + δz)
trace = UI.Track(beads, T, mm.Get, 500)
utils.PlotXY(trace[0])
plt.plot(utils.TraceAxis(trace[0]) - utils.TraceAxis(trace[1]))
plt.xlabel("Z(nm)")
plt.title("Z Position")
plt.grid()
plt.show()
data = []
for magneticHeight in np.arange(39, 25, -0.5):
acs.To(magneticHeight)
mm.SetZ(z0 + δz)
print(magneticHeight)
time.sleep(1)
mm.Get()
trace = UI.Track(beads, T, mm.Get, 500)
data.append(trace)
allTrace = []
for h in range(len(data)):
trace = data[h]
for j in range(len(trace[0])):
one = []
for i in range(len(trace)):
one.append(trace[i][j][0])
one.append(trace[i][j][1])
one.append(trace[i][j][2])
allTrace.append(one)
allTrace = np.array(allTrace)
acs.To(39)
plt.plot((allTrace[:,2] - allTrace[:,5])[:])
plt.show()
f = open("./data/trace3.dat", "w")
for t in allTrace:
for d in t:
f.write(str(d) + ",")
f.write("\n")
f.close()