Commit 706b4326 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

fixes

parent 57ef1b82
Pipeline #21470 passed with stage
in 4 minutes and 28 seconds
......@@ -233,10 +233,10 @@ class data_object(object):
return data_object(self._shape, np.abs(self._data), self._distaxis)
def all(self):
return self._data.all()
return self.sum() == self.size
def any(self):
return self._data.any()
return self.sum() != 0
def full(shape, fill_value, dtype=None, distaxis=0):
......
......@@ -82,8 +82,12 @@ class RGRGTransformation(Transformation):
Tval = Field(tdom, tmp)
else:
ldat = dobj.local_data(x.val)
ldat = fftn(ldat,axes=axes)
ldat = ldat.real+ldat.imag
# these two alternatives are equivalent, with the second being faster
if False:
ldat = fftn(ldat,axes=axes)
ldat = ldat.real+ldat.imag
else:
ldat = hartley(ldat,axes=axes)
tmp = dobj.from_local_data(x.val.shape, ldat, distaxis=dobj.distaxis(x.val))
Tval = Field(tdom,tmp)
fct = self.fct_p2h if p2h else self.fct_h2p
......
......@@ -153,6 +153,10 @@ class PowerSpace(Space):
temp_k_lengths = np.bincount(dobj.local_data(temp_pindex).ravel(),
weights=dobj.local_data(k_length_array.val).ravel(),
minlength=nbin)
# This conversion is necessary because bincount sometimes returns
# its result as an integer array, even when floating-point weights
# are present ...
temp_k_lengths = temp_k_lengths.astype(np.float64)
temp_k_lengths = dobj.np_allreduce_sum(temp_k_lengths) / temp_rho
temp_dvol = temp_rho*pdvol
self._powerIndexCache[key] = (binbounds,
......
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