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 15, 2018
2 parents 2bb0ba8 + 2dc9d66 commit 70c3b85
Show file tree
Hide file tree
Showing 61 changed files with 779 additions and 755 deletions.
2 changes: 1 addition & 1 deletion change_version_number.py → 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 'giovanni.iadarola@cern.ch' in content:
content=content.replace('PyECLOUD Version 6.7.0', 'PyECLOUD Version 6.7.0')
content=content.replace('PyECLOUD Version 6.7.1', 'PyECLOUD Version 6.7.1')
with open(filename,'w') as fid:
fid.write(content)

Expand Down
113 changes: 113 additions & 0 deletions 003_change_preamble.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
raise ValueError("Not to be used to change the version!\nComment this line to change preamble.")


import os

before_preamble = 0
in_preamble = 1
after_preamble = 2


id_preamble_begin = '#-Begin-preamble----'
id_preamble_end = '#-End-preamble--------'

preamble_new = """#-Begin-preamble-------------------------------------------------------
#
# CERN
#
# European Organization for Nuclear Research
#
#
# This file is part of the code:
#
# PyECLOUD Version 6.7.1
#
#
# Main author: Giovanni IADAROLA
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.iadarola@cern.ch
#
# Contributors: Eleanora Belli
# Philipp Dijkstal
# Lotta Mether
# Annalisa Romano
# Giovanni Rumolo
#
#
# Copyright CERN, Geneva 2011 - Copyright and any other
# appropriate legal protection of this computer program and
# associated documentation reserved in all countries of the
# world.
#
# Organizations collaborating with CERN may receive this program
# and documentation freely and without charge.
#
# CERN undertakes no obligation for the maintenance of this
# program, nor responsibility for its correctness, and accepts
# no liability whatsoever resulting from its use.
#
# Program and documentation are provided solely for the use of
# the organization to which they are distributed.
#
# This program may not be copied or otherwise distributed
# without permission. This message must be retained on this and
# any other authorized copies.
#
# The material cannot be sold. CERN should be given credit in
# all references.
#
#-End-preamble---------------------------------------------------------"""

new_preamble_lines = preamble_new.split('\n')



for dirpath, _, filenames in os.walk('.'):
full_paths = [os.path.join(dirpath, x) for x in filenames]

python_files = [x for x in full_paths if x.endswith('.py')]
for path in python_files:

if os.path.abspath(path) == os.path.abspath(__file__):
continue

with open(path, 'r') as f:
content = f.read()

if new_preamble_lines[0] not in content:
continue

print(path)

lines = content.split('\n')

prev_line = None
new_lines = []
status = before_preamble

for line in lines:
if status == before_preamble:
if id_preamble_begin in line:
status = in_preamble
new_lines.extend(new_preamble_lines)
elif status == in_preamble:
if id_preamble_end in prev_line:
status = after_preamble
elif status == after_preamble:
pass


if status != in_preamble:
new_lines.append(line)

prev_line = line

new_lines = [x+'\n' for ctr, x in enumerate(new_lines) if ctr+1 != len(new_lines)]

with open(path, 'w') as f:
f.writelines(new_lines)
print('Modified %s' % path)

21 changes: 10 additions & 11 deletions MP_system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#----------------------------------------------------------------------
#-Begin-preamble-------------------------------------------------------
#
# CERN
#
Expand All @@ -7,23 +7,21 @@
#
# This file is part of the code:
#
# PyECLOUD Version 6.7.0
# PyECLOUD Version 6.7.1
#
#
# Author and contact: Giovanni IADAROLA
# Main author: Giovanni IADAROLA
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.iadarola@cern.ch
#
# contact: Giovanni RUMOLO
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.rumolo@cern.ch
#
# Contributors: Eleanora Belli
# Philipp Dijkstal
# Lotta Mether
# Annalisa Romano
# Giovanni Rumolo
#
#
# Copyright CERN, Geneva 2011 - Copyright and any other
Expand All @@ -47,7 +45,8 @@
#
# The material cannot be sold. CERN should be given credit in
# all references.
#----------------------------------------------------------------------
#
#-End-preamble---------------------------------------------------------

import numpy as np
from numpy.random import rand
Expand Down
24 changes: 11 additions & 13 deletions PyEC4PyHT.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#----------------------------------------------------------------------
#----------------------------------------------------------------------
#-Begin-preamble-------------------------------------------------------
#
# CERN
#
Expand All @@ -8,23 +7,21 @@
#
# This file is part of the code:
#
# PyECLOUD Version 6.7.0
# PyECLOUD Version 6.7.1
#
#
# Author and contact: Giovanni IADAROLA
# Main author: Giovanni IADAROLA
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.iadarola@cern.ch
#
# contact: Giovanni RUMOLO
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.rumolo@cern.ch
#
# Contributors: Eleanora Belli
# Philipp Dijkstal
# Lotta Mether
# Annalisa Romano
# Giovanni Rumolo
#
#
# Copyright CERN, Geneva 2011 - Copyright and any other
Expand All @@ -48,7 +45,8 @@
#
# The material cannot be sold. CERN should be given credit in
# all references.
#----------------------------------------------------------------------
#
#-End-preamble---------------------------------------------------------

import os
import subprocess
Expand All @@ -67,7 +65,7 @@ class Ecloud(object):
def __init__(self, L_ecloud, slicer, Dt_ref, pyecl_input_folder='./', flag_clean_slices=False,
slice_by_slice_mode=False, space_charge_obj=None, MP_e_mass=m_e, MP_e_charge=-e, **kwargs):

print 'PyECLOUD Version 6.7.0'
print 'PyECLOUD Version 6.7.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
22 changes: 10 additions & 12 deletions PyEC4PyHT_fastion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#----------------------------------------------------------------------
#----------------------------------------------------------------------
#-Begin-preamble-------------------------------------------------------
#
# CERN
#
Expand All @@ -8,23 +7,21 @@
#
# This file is part of the code:
#
# PyECLOUD Version 6.7.0
# PyECLOUD Version 6.7.1
#
#
# Author and contact: Giovanni IADAROLA
# Main author: Giovanni IADAROLA
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.iadarola@cern.ch
#
# contact: Giovanni RUMOLO
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.rumolo@cern.ch
#
# Contributors: Eleanora Belli
# Philipp Dijkstal
# Lotta Mether
# Annalisa Romano
# Giovanni Rumolo
#
#
# Copyright CERN, Geneva 2011 - Copyright and any other
Expand All @@ -48,7 +45,8 @@
#
# The material cannot be sold. CERN should be given credit in
# all references.
#----------------------------------------------------------------------
#
#-End-preamble---------------------------------------------------------

import numpy as np
from scipy.constants import c, e
Expand Down
21 changes: 10 additions & 11 deletions beam_and_timing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#----------------------------------------------------------------------
#-Begin-preamble-------------------------------------------------------
#
# CERN
#
Expand All @@ -7,23 +7,21 @@
#
# This file is part of the code:
#
# PyECLOUD Version 6.7.0
# PyECLOUD Version 6.7.1
#
#
# Author and contact: Giovanni IADAROLA
# Main author: Giovanni IADAROLA
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.iadarola@cern.ch
#
# contact: Giovanni RUMOLO
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.rumolo@cern.ch
#
# Contributors: Eleanora Belli
# Philipp Dijkstal
# Lotta Mether
# Annalisa Romano
# Giovanni Rumolo
#
#
# Copyright CERN, Geneva 2011 - Copyright and any other
Expand All @@ -47,7 +45,8 @@
#
# The material cannot be sold. CERN should be given credit in
# all references.
#----------------------------------------------------------------------
#
#-End-preamble---------------------------------------------------------


import numpy as np
Expand Down
23 changes: 11 additions & 12 deletions buildup_simulation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/afs/cern.ch/project/uslarp/opt/lxplus64/Python-2.7.2/bin/python

#----------------------------------------------------------------------
#-Begin-preamble-------------------------------------------------------
#
# CERN
#
Expand All @@ -9,23 +9,21 @@
#
# This file is part of the code:
#
# PyECLOUD Version 6.7.0
# PyECLOUD Version 6.7.1
#
#
# Author and contact: Giovanni IADAROLA
# Main author: Giovanni IADAROLA
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.iadarola@cern.ch
#
# contact: Giovanni RUMOLO
# BE-ABP Group
# CERN
# CH-1211 GENEVA 23
# SWITZERLAND
# giovanni.rumolo@cern.ch
#
# Contributors: Eleanora Belli
# Philipp Dijkstal
# Lotta Mether
# Annalisa Romano
# Giovanni Rumolo
#
#
# Copyright CERN, Geneva 2011 - Copyright and any other
Expand All @@ -49,7 +47,8 @@
#
# The material cannot be sold. CERN should be given credit in
# all references.
#----------------------------------------------------------------------
#
#-End-preamble---------------------------------------------------------


import init as init
Expand All @@ -59,7 +58,7 @@
class BuildupSimulation(object):
def __init__(self, pyecl_input_folder='./', **kwargs):

print 'PyECLOUD Version 6.7.0'
print 'PyECLOUD Version 6.7.1'
beamtim,MP_e, dynamics,impact_man, pyeclsaver, \
gas_ion_flag, resgasion, t_ion, \
spacech_ele,t_sc_ON, photoem_flag, phemiss,\
Expand Down
1 change: 1 addition & 0 deletions default_input_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# This most importantly excludes python lists. Tuples may be used in their place.

parameters_dict = {
'superparameters':{'pi'}, #are allowed anywhere and can be repeated (for backwards compatibility)
'simulation_parameters': {
'mandatory': {

Expand Down
Binary file modified doc/reference/reference.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/reference/src/reference.tex
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ \subsection{Simulation parameters}
\multicolumn{2}{p{.97\textwidth}}{\textbf{Photoemission parameters} (if generation by photoemission is not desired, the following parameters can be omitted).}
\\ \hline
\textbf{photoem\_flag} & (optional -- default=0) \newline
(0 $\Rightarrow$ Off, 1 $\Rightarrow$ traditional, 2 or 'from\_file' $\Rightarrow$ From file, 3 or 'per\_segment' $\Rightarrow$ Part of chamber definition) Enables primary electron generation by photoemission.
(0 $\Rightarrow$ Off, 1 $\Rightarrow$ traditional, 2 or 'from\_file' $\Rightarrow$ Angular distribution from file, 3 or 'per\_segment' $\Rightarrow$ Part of chamber definition) Enables primary electron generation by photoemission.
\\ \hline
\textbf{k\_pe\_st} & [m$^{-1}$] Number of photoelectrons to be generated per proton and per unit length.
\\ \hline
Expand Down
Loading

0 comments on commit 70c3b85

Please sign in to comment.