From 4d10b02607ccd6c376d65fb169e5d244d03c612e Mon Sep 17 00:00:00 2001 From: Martin Reinecke <martin@mpa-garching.mpg.de> Date: Mon, 3 Jul 2017 15:57:00 +0200 Subject: [PATCH] make a few more classes immutable --- nifty/operators/linear_operator/linear_operator.py | 6 +----- .../smoothing_operator/smoothing_operator.py | 12 ++---------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/nifty/operators/linear_operator/linear_operator.py b/nifty/operators/linear_operator/linear_operator.py index c57e03972..38b52f341 100644 --- a/nifty/operators/linear_operator/linear_operator.py +++ b/nifty/operators/linear_operator/linear_operator.py @@ -73,7 +73,7 @@ class LinearOperator(Loggable, object): __metaclass__ = NiftyMeta def __init__(self, default_spaces=None): - self.default_spaces = default_spaces + self._default_spaces = default_spaces @staticmethod def _parse_domain(domain): @@ -119,10 +119,6 @@ class LinearOperator(Loggable, object): def default_spaces(self): return self._default_spaces - @default_spaces.setter - def default_spaces(self, spaces): - self._default_spaces = utilities.cast_axis_to_tuple(spaces) - def __call__(self, *args, **kwargs): return self.times(*args, **kwargs) diff --git a/nifty/operators/smoothing_operator/smoothing_operator.py b/nifty/operators/smoothing_operator/smoothing_operator.py index b306b8c2d..63843630e 100644 --- a/nifty/operators/smoothing_operator/smoothing_operator.py +++ b/nifty/operators/smoothing_operator/smoothing_operator.py @@ -135,8 +135,8 @@ class SmoothingOperator(EndomorphicOperator): # "space as input domain.") self._domain = self._parse_domain(domain) - self.sigma = sigma - self.log_distances = log_distances + self._sigma = sigma + self._log_distances = log_distances def _inverse_times(self, x, spaces): if self.sigma == 0: @@ -183,18 +183,10 @@ class SmoothingOperator(EndomorphicOperator): def sigma(self): return self._sigma - @sigma.setter - def sigma(self, sigma): - self._sigma = np.float(sigma) - @property def log_distances(self): return self._log_distances - @log_distances.setter - def log_distances(self, log_distances): - self._log_distances = bool(log_distances) - @abc.abstractmethod def _smooth(self, x, spaces, inverse): raise NotImplementedError -- GitLab