From e80f8c108871245f06dc3e570502e95a4acba64b Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Thu, 11 Apr 2019 15:43:54 +0100 Subject: clean code closes #240 --- .../ccpi/optimisation/functions/MixedL21Norm.py | 23 ++-------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Wrappers/Python/ccpi/optimisation/functions/MixedL21Norm.py b/Wrappers/Python/ccpi/optimisation/functions/MixedL21Norm.py index c6b6e95..a655e03 100755 --- a/Wrappers/Python/ccpi/optimisation/functions/MixedL21Norm.py +++ b/Wrappers/Python/ccpi/optimisation/functions/MixedL21Norm.py @@ -99,27 +99,8 @@ class MixedL21Norm(Function): else: res1 = functools.reduce(lambda a,b: a + b*b, x.containers, x.get_item(0) * 0 ) res = res1.sqrt().maximum(1.0) - - if False: - # works but not memory efficient as allocating a new BlockDataContainer - a = x / res - out.fill(a) - elif False: - # this leads to error -# File "ccpi\framework\BlockDataContainer.py", line 142, in divide -# return type(self)(*[ el.divide(other, *args, **kwargs) for el in self.containers], shape=self.shape) -# File "ccpi\framework\BlockDataContainer.py", line 142, in -# return type(self)(*[ el.divide(other, *args, **kwargs) for el in self.containers], shape=self.shape) -# File "ccpi\framework\framework.py", line 814, in divide -# return self.pixel_wise_binary(numpy.divide, other, *args, **kwargs) -# File "ccpi\framework\framework.py", line 802, in pixel_wise_binary -# raise ValueError (message(type(self), "incompatible class:" , pwop.__name__, type(out))) -# ValueError: ImageData: incompatible class: true_divide - x.divide(res, out=out) - else: - for i,el in enumerate(x.containers): - #a = out.get_item(i) - el.divide(res, out=out.get_item(i)) + for i,el in enumerate(x.containers): + el.divide(res, out=out.get_item(i)) def __rmul__(self, scalar): return ScaledFunction(self, scalar) -- cgit v1.2.3