From c01a3e4a0d95d9be7c395d4b2cab4cd9e5893f74 Mon Sep 17 00:00:00 2001 From: Theo Steininger Date: Tue, 23 May 2017 03:15:02 +0200 Subject: [PATCH] Removed p from Field.norm --- nifty/field.py | 8 ++------ nifty/operators/smoothing_operator/smoothing_operator.py | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/nifty/field.py b/nifty/field.py index eea2af5e..d48e5a7b 100644 --- a/nifty/field.py +++ b/nifty/field.py @@ -1054,7 +1054,7 @@ class Field(Loggable, Versionable, object): dotted = diagonalOperator(x, spaces=spaces) return dotted.sum(spaces=spaces) - def norm(self, q=2): + def norm(self): """ Computes the Lq-norm of the field values. Parameters @@ -1068,11 +1068,7 @@ class Field(Loggable, Versionable, object): The Lq-norm of the field values. """ - - if q == 2: - return (self.dot(x=self)) ** (1 / 2) - else: - return self.dot(x=self ** (q - 1)) ** (1 / q) + return np.sqrt(np.abs(self.dot(x=self))) def conjugate(self, inplace=False): """ Retruns the complex conjugate of the field. diff --git a/nifty/operators/smoothing_operator/smoothing_operator.py b/nifty/operators/smoothing_operator/smoothing_operator.py index cdc34cff..741600c6 100644 --- a/nifty/operators/smoothing_operator/smoothing_operator.py +++ b/nifty/operators/smoothing_operator/smoothing_operator.py @@ -39,11 +39,12 @@ class SmoothingOperator(EndomorphicOperator): can only live on one space or FieldType sigma : float Sets the length of the Gaussian convolution kernel - log_distances : boolean - States whether the convolution happens on the logarithmic grid or not. + log_distances : boolean *optional* + States whether the convolution happens on the logarithmic grid or not + (default: False). default_spaces : tuple of ints *optional* Defines on which space(s) of a given field the Operator acts by - default (default: None) + default (default: None). Attributes ---------- @@ -117,7 +118,6 @@ class SmoothingOperator(EndomorphicOperator): raise NotImplementedError("For the given Space smoothing " " is not available.") else: - print 'new 4' return super(SmoothingOperator, cls).__new__(cls, domain, *args, -- GitLab