diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2020-06-23 15:19:06 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2020-07-02 15:54:12 +0200 |
commit | 492c0211608fa756ba6642ff7ae3b479765a955b (patch) | |
tree | 325b34d12f5969f7b90d6eaacb4d023e2a386213 /python/astra/data3d.py | |
parent | ecfb65a05b8ed5171ad65173581d5fe328926995 (diff) | |
download | astra-492c0211608fa756ba6642ff7ae3b479765a955b.tar.gz astra-492c0211608fa756ba6642ff7ae3b479765a955b.tar.bz2 astra-492c0211608fa756ba6642ff7ae3b479765a955b.tar.xz astra-492c0211608fa756ba6642ff7ae3b479765a955b.zip |
Check numpy array type
Diffstat (limited to 'python/astra/data3d.py')
-rw-r--r-- | python/astra/data3d.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/python/astra/data3d.py b/python/astra/data3d.py index b0d54b2..3eea0e3 100644 --- a/python/astra/data3d.py +++ b/python/astra/data3d.py @@ -26,7 +26,7 @@ from . import data3d_c as d import numpy as np -from .pythonutils import GPULink +from .pythonutils import GPULink, checkArrayForLink def create(datatype,geometry,data=None): """Create a 3D object. @@ -57,10 +57,7 @@ def link(datatype, geometry, data): if not isinstance(data,np.ndarray) and not isinstance(data,GPULink): raise TypeError("Input should be a numpy ndarray or GPULink object") if isinstance(data, np.ndarray): - if data.dtype != np.float32: - raise ValueError("Numpy array should be float32") - if not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): - raise ValueError("Numpy array should be C_CONTIGUOUS and ALIGNED") + checkArrayForLink(data) return d.create(datatype,geometry,data,True) |