diff --git a/nifty/field.py b/nifty/field.py index eea2af5e1172a0f63ecf4317c4266f9fd185669f..d48e5a7ba16a33b0f03a92ba30dd305c2dcf7a37 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 cdc34cfff71f2f811045275c9685d05387decd0e..741600c6787a0c5890d14e9743e90b377b9c3a7a 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,