Commit e51171cc authored by Philipp Frank's avatar Philipp Frank

fixup refactor slope handling

parent e3d7fc8e
Pipeline #63052 failed with stages
in 4 minutes and 16 seconds
...@@ -63,7 +63,7 @@ class _SlopeRemover(EndomorphicOperator): ...@@ -63,7 +63,7 @@ class _SlopeRemover(EndomorphicOperator):
if mode == self.TIMES: if mode == self.TIMES:
res = x - x[-1] * self._sc res = x - x[-1] * self._sc
else: else:
res = np.empty(x.shape) res = np.zeros(x.shape,dtype=x.dtype)
res += x res += x
res[-1] -= (x*self._sc).sum() res[-1] -= (x*self._sc).sum()
return from_global_data(self._tgt(mode),res) return from_global_data(self._tgt(mode),res)
...@@ -75,8 +75,11 @@ def _make_slope_Operator(smooth,loglogavgslope): ...@@ -75,8 +75,11 @@ def _make_slope_Operator(smooth,loglogavgslope):
logkl -= logkl[0] logkl -= logkl[0]
logkl = np.insert(logkl, 0, 0) logkl = np.insert(logkl, 0, 0)
noslope = _SlopeRemover(tg,logkl) @ smooth noslope = _SlopeRemover(tg,logkl) @ smooth
# FIXME Move to tests
consistency_check(_SlopeRemover(tg,logkl))
_t = VdotOperator(from_global_data(tg, logkl)).adjoint _t = VdotOperator(from_global_data(tg, logkl)).adjoint
return noslope + _t @ loglogavgslope return _t @ loglogavgslope + noslope
def _log_k_lengths(pspace): def _log_k_lengths(pspace):
return np.log(pspace.k_lengths[1:]) return np.log(pspace.k_lengths[1:])
...@@ -186,6 +189,7 @@ class CorrelatedFieldMaker: ...@@ -186,6 +189,7 @@ class CorrelatedFieldMaker:
smooth = twolog @ (scale*ducktape(scale.target, None, key)) smooth = twolog @ (scale*ducktape(scale.target, None, key))
smoothslope = _make_slope_Operator(smooth,loglogavgslope) smoothslope = _make_slope_Operator(smooth,loglogavgslope)
#smoothslope = smooth
# move to tests # move to tests
assert_allclose( assert_allclose(
......
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