Skip to content

Commit ccec211

Browse files
committed
Current status
1 parent 54de385 commit ccec211

10 files changed

+692
-162
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.pyc
2+
*.mp4
3+
*.png
4+
*.h5
5+
*.mat
6+
*~

000_make_matrices.py

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,71 @@
22

33
import PyPARIS.myfilemanager as mfm
44

5-
sim_folder = '../PyECLOUD_coupled_bunch_example'
6-
tag = 'noecloud'
7-
n_rings = 3
5+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_1.1e11_144b'
6+
tag = 'HL_1.1e11_144b'
7+
n_rings = 100
88
n_parts = 2
99

10+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_1.1e11_144b_damper'
11+
tag = 'HL_1.1e11_144b_fb'
12+
n_rings = 100
13+
n_parts = 1
14+
15+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b'
16+
tag = 'HL_2.3e11_144b'
17+
n_rings = 100
18+
n_parts = 2
19+
20+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_damper'
21+
tag = 'HL_2.3e11_144b_fb'
22+
n_rings = 100
23+
n_parts = 6
24+
25+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_damper_100turns'
26+
tag = 'HL_2.3e11_144b_fb_100t'
27+
n_rings = 100
28+
n_parts = 6
29+
30+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15'
31+
tag = 'HL_2.3e11_144b_Qp15'
32+
n_rings = 100
33+
n_parts = 2 #2nd part not finished
34+
35+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15_damper'
36+
tag = 'HL_2.3e11_144b_Qp15_fb'
37+
n_rings = 100
38+
n_parts = 2 #?
39+
40+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp0_Koct-4.5'
41+
tag = 'HL_2.3e11_144b_Koct-4.5'
42+
n_rings = 100
43+
n_parts = 3 #2nd part not finished
44+
45+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp0_Oct-4.5_damper'
46+
tag = 'HL_2.3e11_144b_Koct-4.5_fb'
47+
n_rings = 100
48+
n_parts = 3 #?
49+
50+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15_Oct-4.5'
51+
tag = 'HL_2.3e11_144b_Qp15_Koct-4.5'
52+
n_rings = 100
53+
n_parts = 3 #2nd part not finished
54+
55+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15_Oct-4.5_damper'
56+
tag = 'HL_2.3e11_144b_Qp15_Koct-4.5_fb'
57+
n_rings = 100
58+
n_parts = 3 #?
59+
60+
# sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_sey1.5'
61+
# tag = 'HL_2.3e11_144b_sey1.5'
62+
# n_rings = 100
63+
# n_parts = 2
64+
65+
# sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_sey1.5_both_planes'
66+
# tag = 'HL_2.3e11_144b_sey1.5_xy'
67+
# n_rings = 100
68+
# n_parts = 2
69+
1070
to_be_saved = [
1171
'epsn_x',
1272
'epsn_y',
@@ -25,14 +85,14 @@
2585

2686

2787
def make_part_matrices(list_files, to_be_saved):
28-
88+
2989
dict_data = mfm.monitorh5list_to_dict(list_files, permissive=True)
30-
90+
3191
print 'Data loaded!'
32-
92+
3393
n_turns = int(np.max(dict_data['i_turn']))+1
3494
n_bunches = int(np.max(dict_data['i_bunch']))+1
35-
95+
3696
list_bunches = []
3797
for i_bunch_obs in range(n_bunches):
3898
print('Bunch %d/%d'%(i_bunch_obs, n_bunches))
@@ -43,16 +103,16 @@ def make_part_matrices(list_files, to_be_saved):
43103
if dict_data['macroparticlenumber'][ii] > 0:
44104
for kk in dict_data.keys():
45105
dict_bunch[kk][i_turn] = dict_data[kk][ii]
46-
106+
47107
list_bunches.append(dict_bunch)
48-
49-
108+
109+
50110
dict_matrices = {kk: np.zeros((n_turns, n_bunches)) for kk in to_be_saved}
51-
111+
52112
for i_bunch_obs in range(n_bunches):
53113
n_turns_this = len(list_bunches[i_bunch_obs]['epsn_x'])
54114
mask_notnan = ~np.isnan(list_bunches[i_bunch_obs]['macroparticlenumber'])
55-
115+
56116
for kk in to_be_saved:
57117
dict_matrices[kk][:n_turns_this, i_bunch_obs][mask_notnan] =\
58118
list_bunches[i_bunch_obs][kk][mask_notnan]
@@ -71,4 +131,3 @@ def make_part_matrices(list_files, to_be_saved):
71131

72132
import scipy.io as sio
73133
sio.savemat(tag+'_matrices.mat', dict_matrices, oned_as='row')
74-

000s_make_slice_matrices.py

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,73 @@
22

33
import PyPARIS.myfilemanager as mfm
44

5-
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_sim_class'
6-
tag = 'simclass_test'
7-
n_rings = 10
8-
n_parts = 6
5+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_1.1e11_144b'
6+
tag = 'HL_1.1e11_144b'
7+
n_rings = 100
8+
n_parts = 2
9+
10+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b'
11+
tag = 'HL_2.3e11_144b'
12+
n_rings = 100
13+
n_parts = 2
14+
15+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15'
16+
tag = 'HL_2.3e11_144b_Qp15'
17+
n_rings = 100
18+
n_parts = 2 #2nd part not finished
19+
20+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp0_Koct-4.5'
21+
tag = 'HL_2.3e11_144b_Koct-4.5'
22+
n_rings = 100
23+
n_parts = 3 #2nd part not finished
24+
25+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15_Oct-4.5'
26+
tag = 'HL_2.3e11_144b_Qp15_Koct-4.5'
27+
n_rings = 100
28+
n_parts = 3 #2nd part not finished
29+
30+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_sey1.5'
31+
tag = 'HL_2.3e11_144b_sey1.5'
32+
n_rings = 100
33+
n_parts = 2
34+
35+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_sey1.5_both_planes'
36+
tag = 'HL_2.3e11_144b_sey1.5_xy'
37+
n_rings = 100
38+
n_parts = 2
39+
40+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_1.1e11_144b_damper'
41+
tag = 'HL_1.1e11_144b_fb'
42+
n_rings = 100
43+
n_parts = 1
44+
45+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_damper'
46+
tag = 'HL_2.3e11_144b_fb'
47+
n_rings = 100
48+
# n_parts = 6
49+
n_parts = 4 ### Too much data for saving all 6 parts to file ###
50+
51+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_damper_100turns'
52+
tag = 'HL_2.3e11_144b_fb_100t'
53+
n_rings = 100
54+
# n_parts = 6
55+
n_parts = 4 ### Too much data for saving all 6 parts to file ###
56+
57+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15_damper'
58+
tag = 'HL_2.3e11_144b_Qp15_fb'
59+
n_rings = 100
60+
n_parts = 2 #?
61+
62+
sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp0_Koct-4.5_damper'
63+
tag = 'HL_2.3e11_144b_Koct-4.5_fb'
64+
n_rings = 100
65+
n_parts = 3 #?
66+
67+
# sim_folder = '../HL-LHC_coupled_bunch_450GeV_2.3e11_144b_Qp15_Koct-4.5_damper'
68+
# tag = 'HL_2.3e11_144b_Qp15_Koct-4.5_fb'
69+
# n_rings = 100
70+
# n_parts = 3 #?
71+
972

1073
to_be_saved = [
1174
'n_macroparticles_per_slice',
@@ -42,7 +105,7 @@ def make_part_matrices(list_files, to_be_saved):
42105
dict_matrices = {kk: np.zeros((n_slices, n_turns, n_bunches)) for kk in to_be_saved}
43106

44107
for i_bunch_obs in range(n_bunches):
45-
n_turns_this = len(list_bunches[i_bunch_obs]['mean_x'])
108+
n_turns_this = len(list_bunches[i_bunch_obs]['mean_x'][0,:])
46109
mask_notnan = ~np.isnan(list_bunches[i_bunch_obs]['n_macroparticles_per_slice'])
47110

48111
for kk in to_be_saved:
@@ -63,7 +126,7 @@ def make_part_matrices(list_files, to_be_saved):
63126
[dd[kk] for dd in list_dicts], axis=1)
64127

65128
import scipy.io as sio
66-
sio.savemat(tag+'_slice_matrices.mat', dict_matrices, oned_as='row')
67-
mfm.dict_to_h5(dict_matrices, tag+'_slice_matrices.h5', compression='gzip')
129+
# sio.savemat(tag+'_slice_matrices.mat', dict_matrices, oned_as='row')
130+
mfm.dict_to_h5(dict_matrices, tag+'_matrices_slices.h5', compression='gzip')
68131

69132

001_plot_from_matrices.py

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,31 @@
44

55
import myfilemanager as mfm
66

7-
tag = 'noecloud'
7+
# tag = 'HL_1.1e11_144b'
8+
# tag = 'HL_1.1e11_144b_fb'
9+
10+
# tag = 'HL_2.3e11_144b'
11+
# tag = 'HL_2.3e11_144b_fb'
12+
# tag = 'HL_2.3e11_144b_fb_100t'
13+
14+
# tag = 'HL_2.3e11_144b_Qp15'
15+
# tag = 'HL_2.3e11_144b_Qp15_fb'
16+
17+
tag = 'HL_2.3e11_144b_Koct-4.5'
18+
tag = 'HL_2.3e11_144b_Koct-4.5_fb'
19+
20+
tag = 'HL_2.3e11_144b_Qp15_Koct-4.5'
21+
tag = 'HL_2.3e11_144b_Qp15_Koct-4.5_fb'
22+
23+
# tag = 'HL_2.3e11_144b_sey1.5'
24+
# tag = 'HL_2.3e11_144b_sey1.5_xy'
825

926
ob = mfm.myloadmat_to_obj(tag+'_matrices.mat')
1027

1128
x_mat = ob.mean_x
1229
y_mat = ob.mean_y
30+
ex_mat = ob.epsn_x
31+
ey_mat = ob.epsn_y
1332
n_mat = ob.macroparticlenumber
1433

1534
n_turns = x_mat.shape[0]
@@ -18,16 +37,32 @@
1837

1938
plt.close('all')
2039

21-
fig1 = plt.figure(1)
22-
axx = plt.subplot(3,1,1)
40+
fig1 = plt.figure(1, figsize=(8*1.5, 6*1.3))
41+
axx = plt.subplot(3,2,1)
2342
axx.plot(x_mat[:,mask_bunch])
24-
axy = plt.subplot(3,1,2, sharex=axx)
43+
axy = plt.subplot(3,2,3, sharex=axx)
2544
axy.plot(y_mat[:,mask_bunch])
26-
axn = plt.subplot(3,1,3, sharex=axx)
45+
axn = plt.subplot(3,2,5, sharex=axx)
2746
axn.plot(n_mat[:,mask_bunch])
2847

48+
mask_e = np.logical_and(ex_mat[:,mask_bunch] > 0, ey_mat[:,mask_bunch] > 0)
49+
50+
axex = plt.subplot(3,2,2)
51+
axex.plot(ex_mat[:,mask_bunch])
52+
# axex.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
53+
axey = plt.subplot(3,2,4, sharex=axx)
54+
axey.plot(ey_mat[:,mask_bunch])
55+
# axey.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
56+
axen = plt.subplot(3,2,6, sharex=axx)
57+
axen.plot(n_mat[:,mask_bunch])
58+
59+
for ax in [axex, axey]:
60+
ax.ticklabel_format(axis='y', style='sci', scilimits=(0,0))
61+
ax.set_ylim(bottom=2.4e-6)
62+
plt.savefig('Overview_%s.png'%(tag), dpi=200)
63+
2964

30-
i_turn = 3
65+
i_turn = 800
3166

3267
figm = plt.figure(10, figsize=(8,6*1.3))
3368
axm1 = figm.add_subplot(3,1,1)

0 commit comments

Comments
 (0)