Skip to content

Commit 4302cd5

Browse files
committed
release-script: Merge branch 'release/v1.12.2'
2 parents 646092f + a11544d commit 4302cd5

File tree

8 files changed

+61
-30
lines changed

8 files changed

+61
-30
lines changed

PyHEADTAIL/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.12.1'
1+
__version__ = '1.12.2'

PyHEADTAIL/feedback/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from .. import __version__
2+
from .. import Element

PyHEADTAIL/feedback/transverse_damper.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,31 @@
1010
from scipy.special import k0
1111
from scipy.constants import c, e
1212

13+
from . import Element
1314

14-
class TransverseDamper(object):
15+
class TransverseDamper(Element):
1516

16-
def __init__(self, dampingrate_x, dampingrate_y):
17-
self.gain_x = 2/dampingrate_x
18-
self.gain_y = 2/dampingrate_y
17+
def __init__(self, dampingrate_x, dampingrate_y, *args, **kwargs):
1918

2019
if dampingrate_x and not dampingrate_y:
20+
self.gain_x = 2/dampingrate_x
2121
self.track = self.track_horizontal
22+
self.prints('Damper in V active')
2223
elif not dampingrate_x and dampingrate_y:
24+
self.gain_y = 2/dampingrate_y
2325
self.track = self.track_vertical
26+
self.prints('Damper in Y active')
27+
elif not dampingrate_x and not dampingrate_y:
28+
self.prints('Dampers not active')
2429
else:
30+
self.gain_x = 2/dampingrate_x
31+
self.gain_y = 2/dampingrate_y
2532
self.track = self.track_all
33+
self.prints('Dampers active')
34+
35+
# will be overwritten at initialisation
36+
def track(self, beam):
37+
pass
2638

2739
def track_horizontal(self, beam):
2840
beam.xp -= self.gain_x * beam.mean_xp()

PyHEADTAIL/general/contextmanager.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
@data 30.09.2015
55
'''
66
import numpy as np
7+
8+
class UnknownContextManagerError(Exception):
9+
'''Raise if context manager is not found, e.g. cannot determine
10+
whether on CPU or on GPU.
11+
'''
12+
def __init__(self, message='Failed to determine current context, e.g. '
13+
'whether pmath.device is "CPU" or "GPU".'):
14+
self.message = message
15+
716
import pmath as pm
817
from ..gpu import gpu_utils
918
try:
@@ -104,15 +113,6 @@ def _patch_binop(self, other):
104113
pycuda.gpuarray.GPUArray.__truediv__ = pycuda.gpuarray.GPUArray.__div__
105114

106115

107-
class UnknownContextManagerError(Exception):
108-
'''Raise if context manager is not found, e.g. cannot determine
109-
whether on CPU or on GPU.
110-
'''
111-
def __init__(self, message='Failed to determine current context, e.g. '
112-
'whether pmath.device is "CPU" or "GPU".'):
113-
self.message = message
114-
115-
116116
class Context(object):
117117
'''
118118
Example contextmanager class providing enter and exit methods

PyHEADTAIL/spacecharge/pypic_spacecharge.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,13 @@ def track(self, beam):
270270

271271
# update field?
272272
if self.sigma_rtol is not None:
273-
if (np.abs(pm.ensure_CPU(beam.sigma_x()) - self.sigma_x)
274-
> self.sigma_rtol * self.sigma_x):
273+
x_too_large = (
274+
np.abs(pm.ensure_CPU(beam.sigma_x()) - self.sigma_x)
275+
> self.sigma_rtol * self.sigma_x)
276+
y_too_large = (
277+
np.abs(pm.ensure_CPU(beam.sigma_y()) - self.sigma_y)
278+
> self.sigma_rtol * self.sigma_y)
279+
if x_too_large or y_too_large:
275280
self.prints('FrozenGaussianSpaceCharge25D: '
276281
'updating field maps...')
277282
self.update_field(beam)

PyHEADTAIL/testing/unittests/test_gpu_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def test_transverse_damper(self):
296296
bunch_gpu = self.create_all1_bunch()
297297
dampingrate_x = 0.01
298298
dampingrate_y = 0.05
299-
damp = TransverseDamper(dampingrate_x, dampingrate_y)
299+
damp = TransverseDamper(dampingrate_x, dampingrate_y, printer=SilentPrinter())
300300
self.assertTrue(self._track_cpu_gpu([damp], bunch_cpu, bunch_gpu),
301301
'Tracking TransverseDamper CPU/GPU differs')
302302

README.rst

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,27 @@ PyHEADTAIL
44
CERN PyHEADTAIL numerical n-body simulation code
55
for simulating macro-particle beam dynamics with collective effects.
66

7-
Installation
8-
------------
7+
PyHEADTAIL is written in C and Python.
8+
Currently, PyHEADTAIL is compatible with Python v2.7.
9+
10+
Installation for Users
11+
----------------------
12+
13+
For using PyHEADTAIL without modifying the source code,
14+
we recommend to install the latest version via PyPI:
15+
16+
$ pip install PyHEADTAIL
17+
18+
Installation for Developers
19+
---------------------------
20+
21+
For developers of PyHEADTAIL, we recommend to install a stand-alone
22+
package from the source code using git. For GPU usage, the developer
23+
version is required (the Makefile is included in the source code
24+
version only).
25+
26+
We recommend to use the Anaconda package manager (for Python 2.7) to simplify installing.
27+
You can obtain it from anaconda.org .
928

1029
Installation of PyHEADTAIL on linux (having git installed)
1130
is straight forward.
@@ -36,13 +55,7 @@ And there you go, start using PyHEADTAIL!
3655
3756
In [1]: import PyHEADTAIL
3857
39-
PyHEADTAIL v1.11.2
40-
41-
42-
-------------------------------------------------------------------------------
43-
44-
Please use the pre-push script ``prepush.py`` if you want to contribute
45-
to the repository. It only lets you push to the develop and master branch if
46-
no unit tests fail.
58+
PyHEADTAIL v1.12.2
4759
48-
To install (creates a symlink): ``ln -s ../../prepush.py .git/hooks/pre-push``
60+
For a single installation of PyHEADTAIL we recommended to add
61+
the PyHEADTAIL path to your PYTHONPATH.

release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ def finalise_release():
388388
release_failed = subprocess.call(
389389
['gothub', 'release', '-u', github_user, '-r', github_repo,
390390
'-t', 'v' + new_version,
391-
'-n', '"PyHEADTAIL v{}"'.format(new_version),
392-
'-d', '"{}"'.format(message),
391+
'-n', 'PyHEADTAIL v{}'.format(new_version),
392+
'-d', '{}'.format(message),
393393
'-c', 'master'])
394394
if release_failed:
395395
print ('*** Drafting the release via gothub failed. '

0 commit comments

Comments
 (0)