-
Notifications
You must be signed in to change notification settings - Fork 1
/
flighttime.py
93 lines (67 loc) · 2.63 KB
/
flighttime.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import sys
#import argparse
import optparse
import tof_model as tm
import tof_helpers
parser = optparse.OptionParser('Calculates expected flighttime in the TOF')
parser.add_option('--html', action="store_true", default=False, help='Adds html line breaks to the text output')
parser.add_option('--liner', '-L', action="store", default=-2000, type=int, help='Liner Voltage')
parser.add_option('--pulse', '-P', action="store", default=400, type=int, help='Pulse Voltage')
parser.add_option('--R1', action="store", default=-432, type=int, help='Voltage at R1')
parser.add_option('--R2', action="store", default=1791, type=int, help='Voltage at R2')
(options, args) = parser.parse_args()
tm.Voltages['pulse'] = options.pulse
tm.Voltages['liner'] = options.liner
tm.Voltages['R1'] = options.R1
tm.Voltages['R2'] = options.R2
if tm.Voltages['R2'] <= 0: # Liniar mode
tm.Voltages['R1'] = Voltages['R1'] = Voltages['liner']
""" Under here starts random experimentation that needs to be cleaned up """
tm.Voltages['pulse'] = 800
tm.Voltages['liner'] = -2321.39
tm.Voltages['R1'] = -702.616
tm.Voltages['R2'] = 1119.71
tof_helpers.draw_trajectory(50)
#tof_helpers.extrapolate(0,100,10,True)
#tof_helpers.print_flighttimes(False,False,False)
#R1_Voltage = 0
#R2_Voltage = 0
"""
flight_times = []
positions = []
mass = 28
for pos in range(int(FAST_POS*1000),int(SLOW_POS*1000)):
res = flight_time(mass,pos/1000.0)
positions.append(pos/1000.0)
flight_times.append(res[0]*1e6)
fig = plt.figure()
ax11 = fig.add_subplot(111)
ax11.plot(positions,flight_times,'r-')
ax11.set_xlabel('Start position')
ax11.set_ylabel('Flight Time / micro seconds')
plt.savefig('Peak-width.png')
"""
#draw_trajectory(28.006)
#print_flighttimes(options.html,True,True)
#print_flighttimes(options.html,False,False)
#### Implement peak-width analysis!!!
# Should be easy...
#mass = 27.995
#res = flight_time(mass)
#print "Center ions {0}: {1:.3f} microsceonds".format(mass,res[0]*1e6)
#mass = 28.006
#res2 = flight_time(mass)
#print "Center ions {0}: {1:.3f} microsceonds".format(mass,res2[0]*1e6)
#print "Difference: {0}: ".format((res2[0]-res[0])*1e9)
#res = flight_time(mass,0.63)
#print "Slowest ions {0}: {1:.3f} microsceonds".format(mass,res[0]*1e6)
#res = flight_time(mass,-0.63)
#print "Fastest ions {0}: {1:.3f} microsceonds".format(mass,res[0]*1e6)
#R1_Voltage = 0
#R2_Voltage = 0
#res = flight_time(mass)
#print "Center ions {0}: {1:.3f} microsceonds".format(mass,res[0]*1e6)
#res = flight_time(mass,0.63)
#print "Slowest ions {0}: {1:.3f} microsceonds".format(mass,res[0]*1e6)
#res = flight_time(mass,-0.63)
#print "Fastest ions {0}: {1:.3f} microsceonds".format(mass,res[0]*1e6)