Skip to content

Commit c67d7b4

Browse files
committed
Merge branch 'develop'
2 parents 3a9eb00 + ac64dfe commit c67d7b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+333
-51
lines changed

002_change_version_number.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
with open(filename) as fid:
1010
content = fid.read()
1111
if 'giovanni.iadarola@cern.ch' in content:
12-
content = content.replace('PyECLOUD Version 8.4.0', 'PyECLOUD Version 8.4.0')
12+
content = content.replace('PyECLOUD Version 8.4.1', 'PyECLOUD Version 8.4.1')
1313
with open(filename, 'w') as fid:
1414
fid.write(content)
1515

003_change_preamble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#
2121
# This file is part of the code:
2222
#
23-
# PyECLOUD Version 8.4.0
23+
# PyECLOUD Version 8.4.1
2424
#
2525
#
2626
# Main author: Giovanni IADAROLA

MP_system.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

PyEC4PyHT.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA
@@ -238,7 +238,7 @@ def __init__(
238238
239239
"""
240240

241-
print("PyECLOUD Version 8.4.0")
241+
print("PyECLOUD Version 8.4.1")
242242

243243
# These git commands return the hash and the branch of the specified git directory.
244244
path_to_git = os.path.dirname(os.path.abspath(__file__)) + "/.git"

beam_and_timing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

buildup_simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#
1010
# This file is part of the code:
1111
#
12-
# PyECLOUD Version 8.4.0
12+
# PyECLOUD Version 8.4.1
1313
#
1414
#
1515
# Main author: Giovanni IADAROLA
@@ -71,7 +71,7 @@ def __init__(
7171
**kwargs
7272
):
7373

74-
print("PyECLOUD Version 8.4.0")
74+
print("PyECLOUD Version 8.4.1")
7575
(
7676
beamtim,
7777
spacech_ele,

cloud_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Author and contact: Giovanni IADAROLA

cross_ionization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

dynamics_Boris_f2py.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

dynamics_Boris_multipole.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

dynamics_dipole.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

dynamics_strong_B_generalized.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

electron_emission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

gas_ionization_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

gen_photoemission_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

geom_impact_ellip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

geom_impact_poly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

geom_impact_poly_fast_impact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

geom_impact_rect_fast_impact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

h000_find_and_modify_preamble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
# This file is part of the code:
1818
#
19-
# PyECLOUD Version 8.4.0
19+
# PyECLOUD Version 8.4.1
2020
#
2121
#
2222
# Main author: Giovanni IADAROLA

impact_management_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# This file is part of the code:
99
#
10-
# PyECLOUD Version 8.4.0
10+
# PyECLOUD Version 8.4.1
1111
#
1212
#
1313
# Main author: Giovanni IADAROLA

mystyle.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
import numpy as np
77

88

9-
def mystyle(fontsz=16):
9+
def mystyle(fontsz=16, traditional_look=True):
1010
rcdefaults()
1111
version = matplotlib.__version__.split('.')[0]
12-
if version == '2':
13-
print('Reverting matplotlib look to v1.5')
14-
plt.rcParams['axes.autolimit_mode'] = 'round_numbers'
15-
plt.rcParams['axes.xmargin'] = 0
16-
plt.rcParams['axes.ymargin'] = 0
17-
plt.rcParams['xtick.direction'] = 'in'
18-
plt.rcParams['ytick.direction'] = 'in'
19-
plt.rcParams['xtick.top'] = True
20-
plt.rcParams['ytick.right'] = True
21-
plt.rcParams['legend.numpoints'] = 1
22-
plt.style.use('classic')
12+
13+
if traditional_look:
14+
if int(version) >= '2':
15+
print('Reverting matplotlib look to v1.5')
16+
plt.rcParams['axes.autolimit_mode'] = 'round_numbers'
17+
plt.rcParams['axes.xmargin'] = 0
18+
plt.rcParams['axes.ymargin'] = 0
19+
plt.rcParams['xtick.direction'] = 'in'
20+
plt.rcParams['ytick.direction'] = 'in'
21+
plt.rcParams['xtick.top'] = True
22+
plt.rcParams['ytick.right'] = True
23+
plt.rcParams['legend.numpoints'] = 1
24+
plt.style.use('classic')
2325

2426
font = { # 'family' : 'normal',
2527
#'weight' : 'bold',
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import numpy as np
2+
3+
from PyECLOUD.buildup_simulation import BuildupSimulation
4+
5+
sim_input_folder = '../../testing/tests_buildup/LHC_ArcDipReal_450GeV_sey1.70_2.5e11ppb_bl_1.00ns'
6+
sim_input_folder = 'input_files'
7+
t_stop_list = [1800e-9]
8+
9+
i_observe = range(0, 60000, 100)
10+
11+
def observe_electrons(sim):
12+
13+
ec = sim.cloud_list[0]
14+
15+
if not hasattr(ec, 'x_follow'):
16+
ec.x_follow = []
17+
ec.y_follow = []
18+
ec.z_follow = []
19+
ec.nel_follow = []
20+
21+
mask_observe = np.zeros_like(ec.MP_e.x_mp, dtype=np.bool)
22+
mask_observe[i_observe] = True
23+
24+
x_temp = ec.MP_e.x_mp[mask_observe]
25+
y_temp = ec.MP_e.y_mp[mask_observe]
26+
z_temp = ec.MP_e.z_mp[mask_observe]
27+
nel_temp = ec.MP_e.nel_mp[mask_observe]
28+
29+
temp_mask = mask_observe.copy()
30+
temp_mask[ec.MP_e.N_mp:] = False
31+
N_keep = np.sum(temp_mask)
32+
33+
x_temp[N_keep:] = np.nan
34+
y_temp[N_keep:] = np.nan
35+
z_temp[N_keep:] = np.nan
36+
nel_temp [N_keep:] = np.nan
37+
38+
ec.x_follow.append(x_temp)
39+
ec.y_follow.append(y_temp)
40+
ec.z_follow.append(z_temp)
41+
ec.nel_follow.append(nel_temp)
42+
43+
return np.sum(nel_temp)
44+
45+
step_by_step_custom_observables = {
46+
'N_observed': observe_electrons,
47+
}
48+
49+
pass_by_pass_custom_observables = {
50+
}
51+
52+
save_once_custom_observables = {
53+
}
54+
55+
sim = BuildupSimulation(pyecl_input_folder=sim_input_folder,
56+
logfile_path='logfile.txt',
57+
progress_path='progress.txt',
58+
filen_main_outp='./Pyecltest.mat',
59+
secondary_angle_distribution = 'cosine_3D',
60+
fact_clean = 0., # cleanings would move electrons around
61+
extract_sey=False,
62+
step_by_step_custom_observables = step_by_step_custom_observables,
63+
pass_by_pass_custom_observables = pass_by_pass_custom_observables,
64+
save_once_custom_observables = save_once_custom_observables)
65+
66+
ec = sim.cloud_list[0]
67+
68+
for ii, t_stop in enumerate(t_stop_list):
69+
print('\n\n==============================')
70+
print(('Simulation run %d - t_stop = %s s'%(ii, repr(t_stop))))
71+
print((' starting at tt=%s s'%repr(sim.beamtim.tt_curr)))
72+
73+
sim.run(t_end_sim = t_stop)
74+
75+
print((' after run a tt=%s'%repr(sim.beamtim.tt_curr)))
76+
77+
78+
x_foll = np.array(ec.x_follow)
79+
y_foll = np.array(ec.y_follow)
80+
z_foll = np.array(ec.z_follow)
81+
nel_foll = np.array(ec.nel_follow)
82+
83+
import scipy.io as sio
84+
sio.savemat('followed_electrons.mat',{
85+
'x': x_foll,
86+
'y': y_foll,
87+
'z': z_foll,
88+
'nel': nel_foll,
89+
}, oned_as='row')

0 commit comments

Comments
 (0)