Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
giadarol committed Feb 11, 2019
2 parents 2344b4a + 4d7e1e4 commit 048cf62
Show file tree
Hide file tree
Showing 46 changed files with 1,304 additions and 137 deletions.
2 changes: 1 addition & 1 deletion 002_change_version_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
with open(filename) as fid:
content = fid.read()
if '[email protected]' in content:
content = content.replace('PyECLOUD Version 7.6.0', 'PyECLOUD Version 7.6.0')
content = content.replace('PyECLOUD Version 7.6.1', 'PyECLOUD Version 7.6.1')
with open(filename, 'w') as fid:
fid.write(content)

Expand Down
2 changes: 1 addition & 1 deletion 003_change_preamble.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion MP_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
6 changes: 4 additions & 2 deletions PyEC4PyHT.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down Expand Up @@ -104,7 +104,7 @@ def __init__(self, L_ecloud, slicer, Dt_ref, pyecl_input_folder='./', flag_clean
beam_monitor=None, verbose=False, save_pyecl_outp_as=None,
**kwargs):

print 'PyECLOUD Version 7.6.0'
print 'PyECLOUD Version 7.6.1'

# These git commands return the hash and the branch of the specified git directory.
path_to_git = os.path.dirname(os.path.abspath(__file__)) + '/.git'
Expand Down Expand Up @@ -247,6 +247,8 @@ def track(self, beam):
slices = beam.get_slices(self.slicer)

for i in xrange(slices.n_slices - 1, -1, -1):
if self.verbose:
print('Slice %d/%d'%(i, slices.n_slices))

# select particles in the slice
ix = slices.particle_indices_of_slice(i)
Expand Down
2 changes: 1 addition & 1 deletion beam_and_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
8 changes: 3 additions & 5 deletions buildup_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down Expand Up @@ -62,7 +62,7 @@ class BuildupSimulation(object):
def __init__(self, pyecl_input_folder='./', skip_beam=False, skip_spacech_ele=False,
skip_pyeclsaver=False, ignore_kwargs=[], spacech_ele=None, **kwargs):

print 'PyECLOUD Version 7.6.0'
print 'PyECLOUD Version 7.6.1'
beamtim, spacech_ele, t_sc_ON, flag_presence_sec_beams, sec_beams_list, \
config_dict, flag_multiple_clouds, cloud_list, checkpoint_folder = init.read_input_files_and_init_components(\
pyecl_input_folder=pyecl_input_folder,
Expand Down Expand Up @@ -257,8 +257,6 @@ def sim_time_step(self, beamtim_obj=None, Dt_substep_custom=None, N_sub_steps_cu

def load_state(self, filename_simulation_state, force_disable_save_simulation_state=True, filen_main_outp='Pyecltest_restarted', load_from_folder='./'): # , reset_pyeclsaver = True):

print 'Reloading state from file: %s...' % filename_simulation_state

with open(load_from_folder + filename_simulation_state, 'rb') as fid:
dict_state = cPickle.load(fid)

Expand Down Expand Up @@ -292,7 +290,7 @@ def load_state(self, filename_simulation_state, force_disable_save_simulation_st
return dict_state

def load_checkpoint(self, filename_simulation_checkpoint, load_from_folder='./'):
print 'Realoading from checkpoint: %s...' % (load_from_folder + filename_simulation_checkpoint)
print('Reloading from checkpoint: %s...' % (load_from_folder + filename_simulation_checkpoint))

i_checkp = int(filename_simulation_checkpoint.split('.pkl')[0].split('_')[-1])
dict_state = self.load_state(filename_simulation_checkpoint, force_disable_save_simulation_state=False, filen_main_outp=None, load_from_folder=load_from_folder)
Expand Down
2 changes: 1 addition & 1 deletion cloud_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Author and contact: Giovanni IADAROLA
Expand Down
4 changes: 3 additions & 1 deletion default_input_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
'dec_fact_out': 1,

# Where to put this?
't_ion': -1
't_ion': -1,

'extract_sey': True,
},
},
'machine_parameters': {
Expand Down
2 changes: 1 addition & 1 deletion dynamics_Boris_f2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion dynamics_Boris_multipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion dynamics_dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion dynamics_strong_B_generalized.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
8 changes: 4 additions & 4 deletions electron_emission.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down Expand Up @@ -74,6 +74,8 @@ def sec_energy_hilleret_model2(switch_no_increase_energy, Ngen, sigmafit, mufit,

elif switch_no_increase_energy == 1:

raise ValueError('This part of the code is not supported anymore!')

en_eV = np.zeros_like(En_impact_eV, dtype=float)

flag_low_energy = En_impact_eV < thresh_low_energy
Expand Down Expand Up @@ -167,7 +169,7 @@ def get_angle_dist_func(string):
"photoelectron_angle_distribution = 'cosine_3D'"
and in the secondary emission input file:
"secondary_angle_distribution = 'cosine_3D'"
For more info, see presentation by P. Dijkstal on the angle of emission
For more info, see presentation by P. Dijkstal on the angle of emission
of generated electrons (https://indico.cern.ch/event/673160/).
""")
time.sleep(3)
Expand Down Expand Up @@ -259,5 +261,3 @@ def get_energy_distribution_func(energy_distribution, e_pe_sigma, e_pe_max):
raise ValueError('Energy distribution %s is invalid!' % energy_distribution)

return get_energy(e_pe_sigma, e_pe_max)


2 changes: 1 addition & 1 deletion gas_ionization_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion gen_photoemission_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion geom_impact_ellip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion geom_impact_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion geom_impact_poly_fast_impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion geom_impact_rect_fast_impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
2 changes: 1 addition & 1 deletion h000_find_and_modify_preamble.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
25 changes: 15 additions & 10 deletions impact_management_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down Expand Up @@ -229,7 +229,7 @@ def backtrack_and_second_emiss(self, old_pos, MP_e):
nel_emit_tot_events, event_type, event_info,\
nel_replace, x_replace, y_replace, z_replace, vx_replace, vy_replace, vz_replace, i_seg_replace,\
nel_new_MPs, x_new_MPs, y_new_MPs, z_new_MPs, vx_new_MPs, vy_new_MPs, vz_new_MPs, i_seg_new_MPs =\
self.sey_mod.impacts_on_surface(
sey_mod.impacts_on_surface(
MP_e.mass, nel_impact, x_impact, y_impact, z_impact,
vx_impact, vy_impact, vz_impact, Norm_x, Norm_y, i_found,
v_impact_n, E_impact_eV, costheta_impact, nel_mp_th, flag_seg
Expand Down Expand Up @@ -277,11 +277,13 @@ def backtrack_and_second_emiss(self, old_pos, MP_e):

def extract_sey_curves(self, n_rep, E_impact_eV_test, cos_theta_test, charge, mass):

del_true_mat = np.zeros((len(cos_theta_test), len(E_impact_eV_test)))
del_elast_mat = np.zeros((len(cos_theta_test), len(E_impact_eV_test)))
deltas = {}
for etype in self.sey_mod.event_types.keys():
etype_name = self.sey_mod.event_types[etype]
deltas[etype_name] = np.zeros((len(cos_theta_test), len(E_impact_eV_test)))
print('Extracting SEY curves...')
for i_ct, ct in enumerate(cos_theta_test):
print('%d/%d'%(i_ct + 1, len(cos_theta_test)))
print('%d/%d' % (i_ct + 1, len(cos_theta_test)))
for i_ene, Ene in enumerate(E_impact_eV_test):

# nel_emit, flag_elast, flag_truesec = sey_mod.SEY_process(nel_impact=np.ones(n_rep),
Expand All @@ -307,10 +309,13 @@ def extract_sey_curves(self, n_rep, E_impact_eV_test, cos_theta_test, charge, ma
costheta_impact=ct * np.ones_like(nel_impact),
nel_mp_th=1,
flag_seg=True)
del_tot = (np.sum(nel_replace) + np.sum(nel_new_MPs)) / n_rep
del_true_mat[i_ct, i_ene] = del_tot * float(np.sum(event_type)) / float(n_rep)
del_elast_mat[i_ct, i_ene] = del_tot * float(np.sum(~event_type)) / float(n_rep)
print('Done extracting SEY curves.')

return del_true_mat, del_elast_mat
for etype in self.sey_mod.event_types.keys():
etype_name = self.sey_mod.event_types[etype]
thisdelta = deltas[etype_name]
thisdelta[i_ct, i_ene] = np.sum(nel_emit_tot_events[event_type == etype]) / np.sum(nel_impact)
deltas[etype_name] = thisdelta

print('Done extracting SEY curves.')

return deltas
4 changes: 2 additions & 2 deletions init.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down Expand Up @@ -413,7 +413,7 @@ def read_input_files_and_init_components(pyecl_input_folder='./', skip_beam=Fals
flag_cos_angle_hist=thiscloud.flag_cos_angle_hist, cos_angle_width=thiscloud.cos_angle_width,
flag_multiple_clouds=flag_multiple_clouds, cloud_name=thiscloud.cloud_name, flag_last_cloud=flag_last_cloud,
checkpoint_DT=cc.checkpoint_DT, checkpoint_folder=cc.checkpoint_folder, copy_main_outp_folder=cc.copy_main_outp_folder,
copy_main_outp_DT=cc.copy_main_outp_DT)
copy_main_outp_DT=cc.copy_main_outp_DT, extract_sey=cc.extract_sey)
print('pyeclsaver saves to file: %s' % pyeclsaver.filen_main_outp)

# Init electron tracker
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# This file is part of the code:
#
# PyECLOUD Version 7.6.0
# PyECLOUD Version 7.6.1
#
#
# Main author: Giovanni IADAROLA
Expand Down
Loading

0 comments on commit 048cf62

Please sign in to comment.