-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path005_compare_rise_times.py
157 lines (122 loc) · 4.6 KB
/
005_compare_rise_times.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import numpy as np
import matplotlib.pyplot as plt
import myfilemanager as mfm
import mystyle as ms
tags = ['HL_1.1e11_144b', 'HL_1.1e11_144b_fb']
i_bun_list = [750, 750]
labels = ['Feedback off', 'Feedback on']
fname = 'intensity_1.0e11ppb'
ylim = 7.
ylim_zoom = None
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_fb']
i_bun_list = [175, 175]
labels = ['Feedback off', 'Feedback on']
fname = 'intensity_2.3e11ppb'
ylim = 6.
ylim_zoom = None
tags = ['HL_1.1e11_144b', 'HL_2.3e11_144b']
i_bun_list = [750, 185]
labels = ['1.1e11 ppb', '2.3e11 ppb']
fname = 'intensity_comparison'
ylim = 7.
ylim_zoom = None
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_fb_100t', 'HL_2.3e11_144b_fb']
i_bun_list = [175, 175, 175]
labels = ['Feedback off', 'Feedback 100 turns', 'Feedback 20 turns']
fname = 'intensity_2.3e11ppb_fbturns'
ylim = 6.
ylim_zoom = 0.3
tags = ['HL_2.3e11_144b_Qp15', 'HL_2.3e11_144b_Qp15_fb']
i_bun_list = [185, 185]
labels = ['Feedback off', 'Feedback on']
fname = 'intensity_2.3e11ppb_Qp15'
ylim = 1.5
ylim_zoom = None
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Qp15']
i_bun_list = [185, 185]
labels = ['Q\' = 0', 'Q\' = 15']
fname = 'intensity_2.3e11ppb_Qp_comparison_nofeedback'
ylim = 6.
ylim_zoom = None
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Qp15', 'HL_2.3e11_144b_Qp15_fb', 'HL_2.3e11_144b_fb']
i_bun_list = [185, 185, 185, 185]
labels = ['Q\'=0, feedback off', 'Q\'=15, feedback off', 'Q\'=15, feedback on', 'Q\'=0, feedback on']
fname = 'intensity_2.3e11ppb_Qp_comparison'
ylim = 6.
ylim_zoom = 0.5
tags = ['HL_2.3e11_144b_Koct-4.5', 'HL_2.3e11_144b_Koct-4.5_fb']
i_bun_list = [185, 185]
labels = ['Feedback off', 'Feedback on']
fname = 'intensity_2.3e11ppb_Qp0_Koct-4.5'
ylim = .3
ylim_zoom = None
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Koct-4.5']
i_bun_list = [185, 185]
labels = ['Q\' = 0, Koct = 0', 'Q\' = 0, Koct = -4.5']
fname = 'intensity_2.3e11ppb_Qp0_Koct-4.5_comparison'
ylim = 6.
ylim_zoom = None
# tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Qp15', 'HL_2.3e11_144b_Koct-4.5']
# i_bun_list = [185, 185, 185]
# labels = ['Q\' = 0, Koct = 0', 'Q\' = 15, Koct = 0', 'Q\' = 0, Koct = -4.5']
# fname = 'intensity_2.3e11ppb_Qp_Koct_comparison_nofeedback'
# ylim = 6.
# ylim_zoom = None
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Koct-4.5', 'HL_2.3e11_144b_Qp15_Koct-4.5']
i_bun_list = [185, 185, 185]
labels = ['Q\' = 0, Koct = 0', 'Q\' = 0, Koct = -4.5', 'Q\' = 15, Koct = -4.5']
fname = 'intensity_2.3e11ppb_Qp_Koct_comparison_nofeedback'
ylim = 6.
ylim_zoom = .3
tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Koct-4.5', 'HL_2.3e11_144b_Qp15_Koct-4.5', 'HL_2.3e11_144b_Qp15_Koct-4.5_fb']
i_bun_list = [185, 185, 185, 185]
labels = ['Q\' = 0, Koct = 0', 'Q\' = 0, Koct = -4.5', 'Q\' = 15, Koct = -4.5', 'Q\' = 15, Koct = -4.5, FB on']
fname = 'intensity_2.3e11ppb_Qp_Koct_comparison'
ylim = 6.
ylim_zoom = .3
# tags = ['HL_2.3e11_144b', 'HL_2.3e11_144b_Qp15', 'HL_2.3e11_144b_Koct-4.5', 'HL_2.3e11_144b_fb']
# i_bun_list = [185, 185, 185, 185]
# labels = ['Q\' = 0, Koct = 0', 'Q\' = 15, Koct = 0', 'Q\' = 0, Koct = -4.5', 'Q\' = 0, Koct = 0, fedback on']
# fname = 'intensity_2.3e11ppb_Qp_Koct_comparison_feedback'
# ylim = 6.
# ylim_zoom = .3
# tag = 'HL_2.3e11_144b_Koct-4.5'
# tag = 'HL_2.3e11_144b_Koct-4.5_fb'
# tag = 'HL_2.3e11_144b_Qp15_Koct-4.5'
# tag = 'HL_2.3e11_144b_Qp15_Koct-4.5_fb'
# tag = 'HL_2.3e11_144b_sey1.5'
# tag = 'HL_2.3e11_144b_sey1.5_xy'
colorlist = ['#004488', '#BB5566', '#DDAA33', '#44AA99', '#AA4499', '#999933']
obs = [mfm.myloadmat_to_obj(tag+'_matrices.mat') for tag in tags]
plt.close('all')
from matplotlib import rc
rc('font', **{'family': 'sans-serif', 'sans-serif': ['arial'], 'size': 14})
# ms.mystyle_arial(fontsz=16)
fig = plt.figure(1)
ax1 = fig.add_subplot(111)
fig2 = plt.figure(2)
ax2 = fig2.add_subplot(111)
fig3 = plt.figure(3)
fig3.set_facecolor('w')
ax3 = fig3.add_subplot(111)
for ii, (ob, tag) in enumerate(zip(obs, tags)):
ax1.plot(np.max(np.abs(ob.mean_x), axis=1), label=tag)
ax2.plot(np.argmax(np.abs(ob.mean_x), axis=1), label=labels[ii])
ax3.plot(ob.mean_x[:, i_bun_list[ii]]*1e3,
linewidth=1.5, color=colorlist[ii],
label=labels[ii])
for ax in [ax1, ax2, ax3]:
ax.legend(loc='upper left', fontsize=12)
ax.set_xlim(0, 650)
ax.set_xlabel('Turn')
ax.grid('True', linestyle=':')
ax3.set_ylim(-ylim, ylim)
ax3.set_ylabel('Horizontal position [mm]')
fig3.subplots_adjust(bottom=.12, top=0.9)
fig3.suptitle(fname, fontsize=14)
fig3.savefig(fname+'.png', dpi=200)
if ylim_zoom is not None:
ax3.set_ylim(-ylim_zoom, ylim_zoom)
ax3.legend(loc='upper left', fontsize=12, framealpha=0.9, ncol=2)
fig3.savefig(fname+'_zoom.png', dpi=200)
plt.show()