From b39f819cf2c7bb6f04d0b5afee9bf8c648587faf Mon Sep 17 00:00:00 2001 From: Philipp Arras <parras@mpa-garching.mpg.de> Date: Thu, 7 Nov 2019 11:52:36 +0100 Subject: [PATCH] Move function --- nifty5/library/correlated_fields.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/nifty5/library/correlated_fields.py b/nifty5/library/correlated_fields.py index b78f7b707..7785ba511 100644 --- a/nifty5/library/correlated_fields.py +++ b/nifty5/library/correlated_fields.py @@ -72,18 +72,6 @@ class _SlopeRemover(EndomorphicOperator): return from_global_data(self._tgt(mode), res) -def _make_slope_Operator(smooth, loglogavgslope): - tg = smooth.target - logkl = _log_k_lengths(tg[0]) - assert logkl.shape[0] == tg[0].shape[0] - 1 - logkl -= logkl[0] - logkl = np.insert(logkl, 0, 0) - noslope = _SlopeRemover(tg, logkl) @ smooth - - _t = VdotOperator(from_global_data(tg, logkl)).adjoint - return _t @ loglogavgslope + noslope - - def _log_k_lengths(pspace): return np.log(pspace.k_lengths[1:]) @@ -186,7 +174,14 @@ class _Amplitude(Operator): scale = sigmasq*(Adder(shift) @ scale).sqrt() smooth = twolog @ (scale*ducktape(scale.target, None, key)) - smoothslope = _make_slope_Operator(smooth, loglogavgslope) + tg = smooth.target + logkl = _log_k_lengths(tg[0]) + assert logkl.shape[0] == tg[0].shape[0] - 1 + logkl -= logkl[0] + logkl = np.insert(logkl, 0, 0) + noslope = _SlopeRemover(tg, logkl) @ smooth + _t = VdotOperator(from_global_data(tg, logkl)).adjoint + smoothslope = _t @ loglogavgslope + noslope normal_ampl = _Normalization(target) @ smoothslope vol = target[0].harmonic_partner.get_default_codomain().total_volume -- GitLab