Commit 36c7db94 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

address some numpy FutureWarnings

parent 9e21f080
......@@ -391,7 +391,7 @@ def from_global_data(arr, sum_up=False, distaxis=0):
lo, hi = _shareRange(arr.shape[distaxis], ntask, rank)
sl = [slice(None)]*len(arr.shape)
sl[distaxis] = slice(lo, hi)
return data_object(arr.shape, arr[sl], distaxis)
return data_object(arr.shape, arr[tuple(sl)], distaxis)
def to_global_data(arr):
......@@ -467,7 +467,7 @@ def redistribute(arr, dist=None, nodist=None):
lo, hi = _shareRange(arr.shape[dist], ntask, i)
sslice[dist] = slice(lo, hi)
ssz[i] = ssz0*(hi-lo)
sbuf[ofs:ofs+ssz[i]] = arr._data[sslice].flat
sbuf[ofs:ofs+ssz[i]] = arr._data[tuple(sslice)].flat
ofs += ssz[i]
rsz[i] = rsz0*_shareSize(arr.shape[arr._distaxis], ntask, i)
ssz *= arr._data.itemsize
......@@ -489,7 +489,7 @@ def redistribute(arr, dist=None, nodist=None):
lo, hi = _shareRange(arr.shape[arr._distaxis], ntask, i)
rslice[arr._distaxis] = slice(lo, hi)
sz = rsz[i]//arr._data.itemsize
arrnew[rslice].flat = rbuf[ofs:ofs+sz]
arrnew[tuple(rslice)].flat = rbuf[ofs:ofs+sz]
ofs += sz
arrnew = from_local_data(arr.shape, arrnew, distaxis=dist)
return arrnew
......
......@@ -269,7 +269,7 @@ def my_fftn_r2c(a, axes=None):
lastaxis = axes[-1]
ntmplast = tmp.shape[lastaxis]
slice1 = [slice(None)]*lastaxis + [slice(0, ntmplast)]
res[slice1] = tmp
res[tuple(slice1)] = tmp
def _fill_upper_half_complex(tmp, res, axes):
lastaxis = axes[-1]
......@@ -282,9 +282,9 @@ def my_fftn_r2c(a, axes=None):
slice1[i] = slice(1, None)
slice2[i] = slice(None, 0, -1)
# np.conjugate(tmp[slice2], out=res[slice1])
res[slice1] = np.conjugate(tmp[slice2])
res[tuple(slice1)] = np.conjugate(tmp[tuple(slice2)])
for i, ax in enumerate(axes[:-1]):
dim1 = [slice(None)]*ax + [slice(0, 1)]
dim1 = tuple([slice(None)]*ax + [slice(0, 1)])
axes2 = axes[:i] + axes[i+1:]
_fill_upper_half_complex(tmp[dim1], res[dim1], axes2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment