From 5ff4c802b06b9e7c1fe557c324bd7041b331f4a8 Mon Sep 17 00:00:00 2001 From: Edoardo Pasca Date: Fri, 15 Feb 2019 16:09:34 +0000 Subject: add norm to DataContainer (#195) --- Wrappers/Python/ccpi/framework.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Wrappers') diff --git a/Wrappers/Python/ccpi/framework.py b/Wrappers/Python/ccpi/framework.py index 9938fb7..318eb92 100644 --- a/Wrappers/Python/ccpi/framework.py +++ b/Wrappers/Python/ccpi/framework.py @@ -720,6 +720,10 @@ class DataContainer(object): ## reductions def sum(self, out=None, *args, **kwargs): return self.as_array().sum(*args, **kwargs) + def norm(self): + '''return the norm of the DataContainer''' + y = self.as_array() + return numpy.dot(y, y.conjugate()) class ImageData(DataContainer): '''DataContainer for holding 2D or 3D DataContainer''' -- cgit v1.2.3