aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/_libwarpx.py
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-09-04 12:46:58 -0600
committerGravatar GitHub <noreply@github.com> 2019-09-04 12:46:58 -0600
commit148de1b350f502cb08e45edb61fd0daadaa4388f (patch)
tree5d107ef3eb9c9f900a7ef45a6b27b04cd9affce1 /Python/pywarpx/_libwarpx.py
parent398cb2d82fc8e0753941e583ae622b2f8c4598d8 (diff)
parent939ef22db0ae5664f23365529b23fc58257a7eda (diff)
downloadWarpX-148de1b350f502cb08e45edb61fd0daadaa4388f.tar.gz
WarpX-148de1b350f502cb08e45edb61fd0daadaa4388f.tar.zst
WarpX-148de1b350f502cb08e45edb61fd0daadaa4388f.zip
Merge pull request #308 from ECP-WarpX/python_update
Python update
Diffstat (limited to 'Python/pywarpx/_libwarpx.py')
-rwxr-xr-xPython/pywarpx/_libwarpx.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py
index 2a37dbd5e..5df9aa0f9 100755
--- a/Python/pywarpx/_libwarpx.py
+++ b/Python/pywarpx/_libwarpx.py
@@ -392,7 +392,11 @@ def get_particle_arrays(species_number, comp):
particle_data = []
for i in range(num_tiles.value):
arr = np.ctypeslib.as_array(data[i], (particles_per_tile[i],))
- arr.setflags(write=1)
+ try:
+ # This fails on some versions of numpy
+ arr.setflags(write=1)
+ except ValueError:
+ pass
particle_data.append(arr)
_libc.free(particles_per_tile)
@@ -623,7 +627,11 @@ def _get_mesh_field_list(warpx_func, level, direction, include_ghosts):
shape = tuple([shapes[shapesize*i + d] for d in range(shapesize)])
# --- The data is stored in Fortran order, hence shape is reversed and a transpose is taken.
arr = np.ctypeslib.as_array(data[i], shape[::-1]).T
- arr.setflags(write=1)
+ try:
+ # This fails on some versions of numpy
+ arr.setflags(write=1)
+ except ValueError:
+ pass
if include_ghosts:
grid_data.append(arr)
else: