summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-01-09 14:37:20 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-01-09 15:17:44 +0100
commitf757ae3a98b49b34bbf08ab53e5724d17000e7c9 (patch)
treebad6252ec1af8ab3c9df109c8accf0ec2afbe077 /python
parent0ad6cb01b9176e99c3e4bb5643ac6a5dd477aad6 (diff)
downloadastra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.tar.gz
astra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.tar.bz2
astra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.tar.xz
astra-f757ae3a98b49b34bbf08ab53e5724d17000e7c9.zip
Add astra.test/astra_test function
Diffstat (limited to 'python')
-rw-r--r--python/astra/__init__.py4
-rw-r--r--python/astra/tests.py10
2 files changed, 12 insertions, 2 deletions
diff --git a/python/astra/__init__.py b/python/astra/__init__.py
index 4675229..e813194 100644
--- a/python/astra/__init__.py
+++ b/python/astra/__init__.py
@@ -27,7 +27,7 @@ from . import matlab as m
from .creators import astra_dict,create_vol_geom, create_proj_geom, create_backprojection, create_sino, create_reconstruction, create_projector,create_sino3d_gpu, create_backprojection3d_gpu
from .functions import data_op, add_noise_to_sino, clear, move_vol_geom
from .extrautils import clipCircle
-from .astra import set_gpu_index, get_gpu_info
+from .astra import set_gpu_index, get_gpu_info, use_cuda
from . import data2d
from . import astra
from . import data3d
@@ -39,7 +39,7 @@ from . import plugin
from . import plugins
from . import log
from .optomo import OpTomo
-from .tests import test_noCUDA, test_CUDA
+from .tests import test, test_noCUDA, test_CUDA
__version__ = '1.9.0dev'
diff --git a/python/astra/tests.py b/python/astra/tests.py
index 32afd36..f7c2c04 100644
--- a/python/astra/tests.py
+++ b/python/astra/tests.py
@@ -95,3 +95,13 @@ def test_CUDA():
ok3 = _basic_par3d_cuda()
if not (ok1 and ok2 and ok3):
raise RuntimeError("Test failed")
+
+def test():
+ """Perform a very basic functionality test"""
+
+ import astra
+ if astra.use_cuda():
+ test_CUDA()
+ else:
+ print("No GPU support available")
+ test_noCUDA()