Commit a98f7e72 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweaks

parent f4a2efa7
...@@ -24,6 +24,9 @@ from ..field import Field ...@@ -24,6 +24,9 @@ from ..field import Field
from .linear_operator import LinearOperator 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): class MaskOperator(LinearOperator):
def __init__(self, mask): def __init__(self, mask):
if not isinstance(mask, Field): if not isinstance(mask, Field):
......
...@@ -25,9 +25,8 @@ class SlopeOperator(LinearOperator): ...@@ -25,9 +25,8 @@ class SlopeOperator(LinearOperator):
rng = np.arange(target.shape[i]) rng = np.arange(target.shape[i])
tmp = np.minimum( tmp = np.minimum(
rng, target.shape[i] + 1 - rng) * target.bindistances[i] rng, target.shape[i] + 1 - rng) * target.bindistances[i]
fst_dims = (1,) * i self.pos[i] += tmp.reshape(
lst_dims = (1,) * (self.ndim - i - 1) (1,)*i + (shape[i],) + (1,)*(self.ndim-i-1))
self.pos[i] += tmp.reshape(fst_dims + (shape[i],) + lst_dims)
@property @property
def domain(self): def domain(self):
......
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