summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdoardo Pasca <edo.paskino@gmail.com>2019-03-15 17:21:39 +0000
committerEdoardo Pasca <edo.paskino@gmail.com>2019-03-15 17:21:39 +0000
commitbee897122ec1d39a097ba795585e24ec8da4104f (patch)
tree334ff7e7b9116982ffc3167359266f0571ae67b3
parent5585a3caf6832908ea64089fe47666a4e1b72c76 (diff)
downloadframework-bee897122ec1d39a097ba795585e24ec8da4104f.tar.gz
framework-bee897122ec1d39a097ba795585e24ec8da4104f.tar.bz2
framework-bee897122ec1d39a097ba795585e24ec8da4104f.tar.xz
framework-bee897122ec1d39a097ba795585e24ec8da4104f.zip
added first implementation
-rwxr-xr-xWrappers/Python/ccpi/framework/BlockGeometry.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/Wrappers/Python/ccpi/framework/BlockGeometry.py b/Wrappers/Python/ccpi/framework/BlockGeometry.py
new file mode 100755
index 0000000..87dfe92
--- /dev/null
+++ b/Wrappers/Python/ccpi/framework/BlockGeometry.py
@@ -0,0 +1,34 @@
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import numpy
+from numbers import Number
+import functools
+#from ccpi.framework import AcquisitionData, ImageData
+#from ccpi.optimisation.operators import Operator, LinearOperator
+
+class BlockGeometry(object):
+ '''Class to hold Geometry as column vector'''
+ #__array_priority__ = 1
+ def __init__(self, *args, **kwargs):
+ ''''''
+ self.geometries = args
+ self.index = 0
+ #shape = kwargs.get('shape', None)
+ #if shape is None:
+ # shape = (len(args),1)
+ shape = (len(args),1)
+ self.shape = shape
+ #print (self.shape)
+ n_elements = functools.reduce(lambda x,y: x*y, shape, 1)
+ if len(args) != n_elements:
+ raise ValueError(
+ 'Dimension and size do not match: expected {} got {}'
+ .format(n_elements, len(args)))
+
+ def allocate(self):
+ containers = [geom.allocate() for geom in self.geometries]
+ BlockDataContainer(*containers)
+