summaryrefslogtreecommitdiffstats
path: root/python/astra/utils.pyx
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-12-04 12:05:38 +0100
committerWillem Jan Palenstijn <wjp@usecode.org>2015-12-04 12:05:38 +0100
commit7ba1ff9ff08daf043cc131434373cde38434f46b (patch)
tree99fc05d3d90a27d61eaf9d14602a30068cf55b83 /python/astra/utils.pyx
parentc335c53178cf63374599682dfbd7e08d318a20f2 (diff)
parent4621453bb753f17614b8ac4b6314a142ecbe278c (diff)
downloadastra-7ba1ff9ff08daf043cc131434373cde38434f46b.tar.gz
astra-7ba1ff9ff08daf043cc131434373cde38434f46b.tar.bz2
astra-7ba1ff9ff08daf043cc131434373cde38434f46b.tar.xz
astra-7ba1ff9ff08daf043cc131434373cde38434f46b.zip
Merge pull request #73 from dmpelt/python-plugins
Add support for Python algorithm plugins
Diffstat (limited to 'python/astra/utils.pyx')
-rw-r--r--python/astra/utils.pyx10
1 files changed, 9 insertions, 1 deletions
diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx
index 260c308..07727ce 100644
--- a/python/astra/utils.pyx
+++ b/python/astra/utils.pyx
@@ -29,9 +29,13 @@
cimport numpy as np
import numpy as np
import six
+if six.PY3:
+ import builtins
+else:
+ import __builtin__
from libcpp.string cimport string
-from libcpp.list cimport list
from libcpp.vector cimport vector
+from libcpp.list cimport list
from cython.operator cimport dereference as deref, preincrement as inc
from cpython.version cimport PY_MAJOR_VERSION
@@ -91,6 +95,8 @@ cdef void readDict(XMLNode root, _dc):
dc = convert_item(_dc)
for item in dc:
val = dc[item]
+ if isinstance(val, __builtins__.list) or isinstance(val, tuple):
+ val = np.array(val,dtype=np.float64)
if isinstance(val, np.ndarray):
if val.size == 0:
break
@@ -125,6 +131,8 @@ cdef void readOptions(XMLNode node, dc):
val = dc[item]
if node.hasOption(item):
raise Exception('Duplicate Option: %s' % item)
+ if isinstance(val, __builtins__.list) or isinstance(val, tuple):
+ val = np.array(val,dtype=np.float64)
if isinstance(val, np.ndarray):
if val.size == 0:
break