Skip to content

Commit 5a463fa

Browse files
committed
Merge pull request #10 from PyCOMPLETE/develop
Develop
2 parents 9b1eae5 + 2570e45 commit 5a463fa

File tree

5 files changed

+40
-49
lines changed

5 files changed

+40
-49
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
PyHEADTAIL
22
==========
33

4-
CERN PyHEADTAIL numerical n-body simulation code for simulating macro-particle beam dynamics with collective effects
4+
CERN PyHEADTAIL numerical n-body simulation code
5+
for simulating macro-particle beam dynamics with collective effects.
6+
7+
Currently only a git-clone of the repository is supported.
8+
The available zip files on github are missing the versioning
9+
and will not allow ./install to work.

_version.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import os, subprocess
22
worktree = os.path.dirname(os.path.abspath(__file__))
33
gitdir = worktree + '/.git/'
4-
__version__ = subprocess.check_output(
5-
'git --git-dir=' + gitdir + ' --work-tree=' +
6-
worktree + ' describe --long --dirty --abbrev=10 --tags', shell=True)
7-
__version__ = __version__.rstrip() # remove trailing \n
8-
__version__ = __version__[1:] # remove leading v
4+
try:
5+
__version__ = subprocess.check_output(
6+
'git --git-dir=' + gitdir + ' --work-tree=' +
7+
worktree + ' describe --long --dirty --abbrev=10 --tags', shell=True)
8+
__version__ = __version__.rstrip() # remove trailing \n
9+
__version__ = __version__[1:] # remove leading v
10+
except:
11+
__version__ = '(no git available to determine version)'

setup.py

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@
44
from _version import __version__
55

66
import re, os, sys, subprocess
7-
#import cython_gsl
87
import numpy as np
98

10-
from distutils.core import setup
11-
from distutils.extension import Extension
9+
#from distutils.core import setup
10+
#from distutils.extension import Extension
11+
from setuptools import setup, Extension
12+
1213
from Cython.Distutils import build_ext
1314
from Cython.Build import cythonize
1415

1516

17+
import platform
18+
if platform.system() is 'Darwin':
19+
print ("Info: since you are running Mac OS, you "
20+
"may have to install with the following line:\n\n"
21+
"$ CC=gcc-4.9 ./install\n"
22+
"(or any equivalent version of gcc)")
23+
raw_input('Hit any key to continue...')
24+
1625
VERSIONFILE="_version.py"
1726
#verstrline = open(VERSIONFILE, "rt").read()
1827
#VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
@@ -23,6 +32,9 @@
2332
# raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
2433
execfile(VERSIONFILE)
2534
verstr = __version__
35+
if not verstr[0].isdigit():
36+
raise RuntimeError("Unable to determine version from _version.py, "
37+
"perhaps no git-describe available?")
2638

2739
args = sys.argv[1:]
2840
# Make a `cleanall` rule to get rid of intermediate and library files
@@ -51,14 +63,6 @@
5163
# Set up extension and build
5264
cy_ext_options = {"compiler_directives": {"profile": True}, "annotate": True}
5365
cy_ext = [
54-
# Extension("beams.bunch",
55-
# ["beams/bunch.pyx"],
56-
# include_dirs=[np.get_include()],
57-
# #extra_compile_args=["-g"],
58-
# #extra_link_args=["-g"],
59-
# libraries=["m"],
60-
# library_dirs=[],
61-
# ),
6266
Extension("solvers.grid_functions",
6367
["solvers/grid_functions.pyx"],
6468
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
@@ -70,59 +74,32 @@
7074
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
7175
extra_compile_args=["-fopenmp"],
7276
extra_link_args=["-fopenmp"],
73-
#extra_compile_args=["-g"],
74-
#extra_link_args=["-g"],
7577
),
76-
#Extension("cobra_functions.random",
77-
#["cobra_functions/random.pyx"],
78-
#include_dirs=[np.get_include(), cython_gsl.get_cython_include_dir()],
79-
##extra_compile_args=["-g"],
80-
##extra_link_args=["-g"],
81-
#library_dirs=[], libraries=["gsl", "gslcblas"],
82-
#),
8378
Extension("solvers.compute_potential_fgreenm2m",
8479
["solvers/compute_potential_fgreenm2m.pyx"],
8580
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
86-
#extra_compile_args=["-g"],
87-
#extra_link_args=["-g"],
8881
),
89-
# Extension("cobra_functions.interp1d",
90-
# ["cobra_functions/interp1d.pyx"],
91-
# include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
92-
# #extra_compile_args=["-g"],
93-
# #extra_link_args=["-g"],
94-
# ),
9582
Extension("trackers.transverse_tracking_cython",
9683
["trackers/transverse_tracking_cython.pyx"],
9784
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
9885
extra_compile_args=["-fopenmp"],
9986
extra_link_args=["-fopenmp"],
100-
#extra_compile_args=["-g"],
101-
#extra_link_args=["-g"],
10287
),
10388
Extension("trackers.detuners_cython",
10489
["trackers/detuners_cython.pyx"],
10590
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
10691
extra_compile_args=["-fopenmp"],
10792
extra_link_args=["-fopenmp"],
108-
#extra_compile_args=["-g"],
109-
#extra_link_args=["-g"],
11093
),
11194
Extension("rfq.rfq",
11295
["rfq/rfq.pyx"],
11396
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
11497
extra_compile_args=["-fopenmp"],
11598
extra_link_args=["-fopenmp"],
116-
#extra_compile_args=["-g"],
117-
#extra_link_args=["-g"],
11899
),
119100
Extension("aperture.aperture",
120101
["aperture/aperture.pyx"],
121102
include_dirs=[np.get_include()], library_dirs=[], libraries=["m"],
122-
#extra_compile_args=["-fopenmp"],
123-
#extra_link_args=["-fopenmp"],
124-
#extra_compile_args=["-g"],
125-
#extra_link_args=["-g"],
126103
)
127104
]
128105

@@ -134,4 +111,11 @@
134111
packages=['PyHEADTAIL'],
135112
cmdclass={'build_ext': build_ext},
136113
ext_modules=cythonize(cy_ext, **cy_ext_options),
114+
install_requires=[
115+
'numpy',
116+
'scipy',
117+
'hdf5',
118+
'h5py',
119+
'cython'
120+
]
137121
)

testing/interactive-tests/WakeTest.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"outputs": [],
1010
"source": [
1111
"import sys, os\n",
12-
"#BIN = os.path.expanduser(\"~/cern/git/PyHEADTAIL-new/\")\n",
13-
"BIN = os.path.expanduser(\"../../../PyHEADTAIL/\")\n",
12+
"BIN = os.path.expanduser(\"../../../\")\n",
1413
"sys.path.append(BIN)"
1514
]
1615
},

testing/unittests/autoruntests/WakeTest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def track_n_show(bunch, slicer, map_woWakes, wake_field):
354354

355355
# Definition of WakeField as a composition of different sources.
356356
resis_circ = CircularResistiveWall(pipe_radius=5e-2, resistive_wall_length=C,
357-
conductivity=1e6, dz_min=1e-3)
357+
conductivity=1e6, dt_min=1e-3)
358358
wake_field = WakeField(uniform_bin_slicer, resis_circ)
359359

360360

@@ -376,7 +376,7 @@ def track_n_show(bunch, slicer, map_woWakes, wake_field):
376376

377377
# Definition of WakeField as a composition of different sources.
378378
resis_para = ParallelPlatesResistiveWall(pipe_radius=5e-2, resistive_wall_length=C,
379-
conductivity=1e6, dz_min=1e-3)
379+
conductivity=1e6, dt_min=1e-3)
380380
wake_field = WakeField(uniform_bin_slicer, resis_para)
381381

382382

@@ -398,7 +398,7 @@ def track_n_show(bunch, slicer, map_woWakes, wake_field):
398398

399399
# Definition of WakeField as a composition of different sources.
400400
resis_circ = CircularResistiveWall(pipe_radius=5e-2, resistive_wall_length=C,
401-
conductivity=1e6, dz_min=1e-3)
401+
conductivity=1e6, dt_min=1e-3)
402402
reson_para = ParallelPlatesResonator(R_shunt=1e6, frequency=1e8, Q=1)
403403
wake_file_columns = ['time', 'dipole_x', 'dipole_y', 'quadrupole_x', 'quadrupole_y',
404404
'dipole_xy', 'dipole_yx']

0 commit comments

Comments
 (0)