diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-06-13 22:23:47 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-06-13 22:23:47 +0100 |
commit | 00a9428244fabe9d69f19470aae92b3b3ebdbb03 (patch) | |
tree | 093b1993d8ef893ddb28d537323bef6115b7d58c /Wrappers | |
parent | 1a33bb7fe818920e77c9e2dc38cee2c261479dae (diff) | |
download | framework-00a9428244fabe9d69f19470aae92b3b3ebdbb03.tar.gz framework-00a9428244fabe9d69f19470aae92b3b3ebdbb03.tar.bz2 framework-00a9428244fabe9d69f19470aae92b3b3ebdbb03.tar.xz framework-00a9428244fabe9d69f19470aae92b3b3ebdbb03.zip |
add numpy numerical types to allowed types for inline algebra
Diffstat (limited to 'Wrappers')
-rwxr-xr-x | Wrappers/Python/ccpi/framework/framework.py | 6 | ||||
-rwxr-xr-x | Wrappers/Python/test/test_algorithms.py | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Wrappers/Python/ccpi/framework/framework.py b/Wrappers/Python/ccpi/framework/framework.py index acb59ae..caea1e1 100755 --- a/Wrappers/Python/ccpi/framework/framework.py +++ b/Wrappers/Python/ccpi/framework/framework.py @@ -708,7 +708,11 @@ class DataContainer(object): return out else: raise ValueError(message(type(self),"Wrong size for data memory: out {} x2 {} expected {}".format( out.shape,x2.shape ,self.shape))) - elif issubclass(type(out), DataContainer) and isinstance(x2, (int,float,complex)): + elif issubclass(type(out), DataContainer) and \ + isinstance(x2, (int,float,complex, numpy.int, numpy.int8, \ + numpy.int16, numpy.int32, numpy.int64,\ + numpy.float, numpy.float16, numpy.float32,\ + numpy.float64, numpy.complex)): if self.check_dimensions(out): kwargs['out']=out.as_array() pwop(self.as_array(), x2, *args, **kwargs ) diff --git a/Wrappers/Python/test/test_algorithms.py b/Wrappers/Python/test/test_algorithms.py index 8c398f4..3bb3d57 100755 --- a/Wrappers/Python/test/test_algorithms.py +++ b/Wrappers/Python/test/test_algorithms.py @@ -64,10 +64,11 @@ class TestAlgorithms(unittest.TestCase): print ("Test CGLS") ig = ImageGeometry(124,153,154) x_init = ImageData(geometry=ig) + x_init = ig.allocate() b = x_init.copy() # fill with random numbers b.fill(numpy.random.random(x_init.shape)) - + b = ig.allocate('random') identity = Identity(ig) alg = CGLS(x_init=x_init, operator=identity, data=b) |