Commit 69792e0f authored by Theo Steininger's avatar Theo Steininger

Merge branch 'master' of gitlab.mpcdf.mpg.de:ift/NIFTy

parents f8fcace5 ea96116b
Pipeline #13483 passed with stages
in 11 minutes and 12 seconds
...@@ -53,10 +53,13 @@ class DirectSmoothingOperator(SmoothingOperator): ...@@ -53,10 +53,13 @@ class DirectSmoothingOperator(SmoothingOperator):
wgt = [] wgt = []
expfac = 1. / (2. * sigma*sigma) expfac = 1. / (2. * sigma*sigma)
for i in range(x.size): for i in range(x.size):
t = x[ibegin[i]:ibegin[i]+nval[i]]-x[i] if nval[i]>0:
t = np.exp(-t*t*expfac) t = x[ibegin[i]:ibegin[i]+nval[i]]-x[i]
t *= 1./np.sum(t) t = np.exp(-t*t*expfac)
wgt.append(t) t *= 1./np.sum(t)
wgt.append(t)
else:
wgt.append(np.array([]))
return ibegin, nval, wgt return ibegin, nval, wgt
...@@ -146,7 +149,7 @@ class DirectSmoothingOperator(SmoothingOperator): ...@@ -146,7 +149,7 @@ class DirectSmoothingOperator(SmoothingOperator):
#MR FIXME: this causes calls of log(0.) which should probably be avoided #MR FIXME: this causes calls of log(0.) which should probably be avoided
if self.log_distances: if self.log_distances:
np.log(distance_array, out=distance_array) np.log(np.maximum(distance_array,1e-15), out=distance_array)
# collect the local data + ghost cells # collect the local data + ghost cells
local_data_Q = False local_data_Q = False
......
...@@ -55,5 +55,5 @@ def create_power_operator(domain, power_spectrum, dtype=None, ...@@ -55,5 +55,5 @@ def create_power_operator(domain, power_spectrum, dtype=None,
fp = Field(power_domain, val=power_spectrum, dtype=dtype, fp = Field(power_domain, val=power_spectrum, dtype=dtype,
distribution_strategy=distribution_strategy) distribution_strategy=distribution_strategy)
f = fp.power_synthesize(mean=1, std=0, real_signal=False) f = fp.power_synthesize(mean=1, std=0, real_signal=False)
f **= 2
return DiagonalOperator(domain, diagonal=f, bare=True) return DiagonalOperator(domain, diagonal=f, bare=True)
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