diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-01-26 14:57:57 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-02-08 14:39:01 +0100 |
commit | d85a660f064e8130b27e11c7fd762221c754c315 (patch) | |
tree | 72382e8414c8dc51a7a7ef45845b4c61b25dfed9 /python/astra/data3d.py | |
parent | ebd5fe932fd2d6c4a516bc1cdc69e37aa4f5cf55 (diff) | |
download | astra-d85a660f064e8130b27e11c7fd762221c754c315.tar.gz astra-d85a660f064e8130b27e11c7fd762221c754c315.tar.bz2 astra-d85a660f064e8130b27e11c7fd762221c754c315.tar.xz astra-d85a660f064e8130b27e11c7fd762221c754c315.zip |
Start work on CFloat32Data3DGPU to allow persistent/external GPU memory
Diffstat (limited to 'python/astra/data3d.py')
-rw-r--r-- | python/astra/data3d.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/astra/data3d.py b/python/astra/data3d.py index 9c2bea4..a825700 100644 --- a/python/astra/data3d.py +++ b/python/astra/data3d.py @@ -26,6 +26,8 @@ from . import data3d_c as d import numpy as np +from .pythonutils import GPULink + def create(datatype,geometry,data=None): """Create a 3D object. @@ -52,11 +54,11 @@ def link(datatype, geometry, data): :returns: :class:`int` -- the ID of the constructed object. """ - if not isinstance(data,np.ndarray): + if not isinstance(data,np.ndarray) and not isinstance(data,GPULink): raise ValueError("Input should be a numpy array") - if not data.dtype==np.float32: + if not isinstance(data,GPULink) and not data.dtype==np.float32: raise ValueError("Numpy array should be float32") - if not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): + if not isinstance(data,GPULink) and not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): raise ValueError("Numpy array should be C_CONTIGUOUS and ALIGNED") return d.create(datatype,geometry,data,True) |