From a98f7e72576ed3e28f1383cef29729b3d456c834 Mon Sep 17 00:00:00 2001 From: Martin Reinecke <martin@mpa-garching.mpg.de> Date: Mon, 2 Jul 2018 19:29:55 +0200 Subject: [PATCH] tweaks --- nifty5/operators/mask_operator.py | 3 +++ nifty5/operators/slope_operator.py | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nifty5/operators/mask_operator.py b/nifty5/operators/mask_operator.py index ef61ac250..87407ee9a 100644 --- a/nifty5/operators/mask_operator.py +++ b/nifty5/operators/mask_operator.py @@ -24,6 +24,9 @@ from ..field import Field from .linear_operator import LinearOperator +# MR FIXME: this needs a redesign to avoid most _global_data() calls +# Possible approach: keep everything living on `domain` distributed and only +# collect the unstructured Fields. class MaskOperator(LinearOperator): def __init__(self, mask): if not isinstance(mask, Field): diff --git a/nifty5/operators/slope_operator.py b/nifty5/operators/slope_operator.py index cbeefb3a6..4e2f851c4 100644 --- a/nifty5/operators/slope_operator.py +++ b/nifty5/operators/slope_operator.py @@ -25,9 +25,8 @@ class SlopeOperator(LinearOperator): rng = np.arange(target.shape[i]) tmp = np.minimum( rng, target.shape[i] + 1 - rng) * target.bindistances[i] - fst_dims = (1,) * i - lst_dims = (1,) * (self.ndim - i - 1) - self.pos[i] += tmp.reshape(fst_dims + (shape[i],) + lst_dims) + self.pos[i] += tmp.reshape( + (1,)*i + (shape[i],) + (1,)*(self.ndim-i-1)) @property def domain(self): -- GitLab