Skip to content

Commit 5cc739c

Browse files
author
(Py)thon (Co)llective (M)acro-(P)article Simulation (L)ibrary with (E)xtendible (T)racking (E)lements
authored
Merge pull request #96 from PyCOMPLETE/hotfix/aperture-slicemonitor-fix
aperture: fixing bug with aperture on GPU...
2 parents bfb793e + b783aa1 commit 5cc739c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

PyHEADTAIL/aperture/aperture.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import numpy as np
2020

2121
def make_int32(array):
22-
# return np.array(array, dtype=np.int32)
2322
return array.astype(np.int32)
2423

2524

@@ -89,8 +88,9 @@ def relocate_lost_particles(beam, alive):
8988

9089
beam.reorder(perm)
9190

92-
n_alive = make_int32(pm.sum(alive))
93-
return n_alive
91+
# on CPU: (even if pm.device == 'GPU', as pm.sum returns np.ndarray)
92+
n_alive = pm.sum(alive)
93+
return np.int32(n_alive)
9494

9595

9696
class RectangularApertureX(Aperture):

0 commit comments

Comments
 (0)