Commit 53d607e9 authored by Martin Reinecke's avatar Martin Reinecke

more fixes; nosetests are passin now

parent de7c2aba
Pipeline #23750 passed with stage
in 4 minutes and 36 seconds
......@@ -55,10 +55,10 @@ class WienerFilterCurvature(EndomorphicOperator):
covariance.
"""
power = sqrt(power_analyze(self.S.diagonal()))
power = power_analyze(sqrt(self.S.diagonal()))
mock_signal = power_synthesize(power, real_signal=True)
noise = self.N.diagonal().weight(-1)
noise = self.N.diagonal()
mock_noise = Field.from_random(random_type="normal",
domain=self.N.domain, dtype=noise.dtype)
......
......@@ -62,7 +62,7 @@ class DOFProjectionOperator(LinearOperator):
self._pshape = (presize, self._dofdex.size, postsize)
def _times(self, x):
arr = dobj.local_data(x.weight(1).val)
arr = dobj.local_data(x.val)
arr = arr.reshape(self._pshape)
oarr = np.zeros(self._hshape, dtype=x.dtype)
np.add.at(oarr, (slice(None), self._dofdex, slice(None)), arr)
......@@ -75,7 +75,7 @@ class DOFProjectionOperator(LinearOperator):
res = Field(self._target,
dobj.from_local_data(self._target.shape, oarr,
dobj.default_distaxis()))
return res.weight(-1, spaces=self._space)
return res
def _adjoint_times(self, x):
res = Field.empty(self._domain, dtype=x.dtype)
......
......@@ -96,13 +96,13 @@ class LaplaceOperator(EndomorphicOperator):
ret[sl_l] = deriv
ret[prefix + (-1,)] = 0.
ret[sl_r] -= deriv
ret /= np.sqrt(dposc)
ret /= dposc
ret[prefix + (slice(None, 2),)] = 0.
ret[prefix + (-1,)] = 0.
ret = dobj.from_local_data(locval.shape, ret, dobj.distaxis(locval))
if dobj.distaxis(locval) != dobj.distaxis(x.val):
ret = dobj.redistribute(ret, dist=dobj.distaxis(x.val))
return Field(self.domain, val=ret).weight(-0.5, spaces=self._space)
return Field(self.domain, val=ret)
def _adjoint_times(self, x):
axes = x.domain.axes[self._space]
......@@ -113,11 +113,11 @@ class LaplaceOperator(EndomorphicOperator):
sl_r = prefix + (slice(1, None),) # "right" slice
dpos = self._dpos.reshape((1,)*axis + (nval-1,))
dposc = self._dposc.reshape((1,)*axis + (nval,))
yf = x.weight(0.5, spaces=self._space).val
yf = x.val
if axis == dobj.distaxis(yf):
yf = dobj.redistribute(yf, nodist=(axis,))
y = dobj.local_data(yf)
y /= np.sqrt(dposc)
y /= dposc
y[prefix + (slice(None, 2),)] = 0.
y[prefix + (-1,)] = 0.
deriv = (y[sl_r]-y[sl_l])/dpos # defined between points
......@@ -128,7 +128,7 @@ class LaplaceOperator(EndomorphicOperator):
ret = dobj.from_local_data(x.shape, ret, dobj.distaxis(yf))
if dobj.distaxis(yf) != dobj.distaxis(x.val):
ret = dobj.redistribute(ret, dist=dobj.distaxis(x.val))
return Field(self.domain, val=ret).weight(-1, spaces=self._space)
return Field(self.domain, val=ret)
def apply(self, x, mode):
self._check_input(x, mode)
......
......@@ -37,9 +37,9 @@ class TraceProberMixin(object):
def finish_probe(self, probe, pre_result):
if self.__evaluate_probe_in_signal_space:
fft = create_composed_fft_operator(self._domain, all_to='position')
result = fft(probe[1]).weight(-1).vdot(fft(pre_result))
result = fft(probe[1]).vdot(fft(pre_result))
else:
result = probe[1].weight(-1).vdot(pre_result)
result = probe[1].vdot(pre_result)
self.__sum_of_probings += result
if self.compute_variance:
......
......@@ -40,7 +40,7 @@ def PS_field(pspace, func, dtype=None):
def _single_power_analyze(field, idx, binbounds):
power_domain = PowerSpace(field.domain[idx], binbounds)
ppo = PowerProjectionOperator(field.domain, power_domain, idx)
return ppo(field.weight(-1))
return ppo(field.weight(1)).weight(-1) # divides by bin size
def power_analyze(field, spaces=None, binbounds=None,
......@@ -103,7 +103,6 @@ def power_analyze(field, spaces=None, binbounds=None,
else:
parts = [field.real*field.real + field.imag*field.imag]
parts = [part.weight(1, spaces) for part in parts]
for space_index in spaces:
parts = [_single_power_analyze(field=part,
idx=space_index,
......
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