summaryrefslogtreecommitdiffstats
path: root/python/astra/utils.pyx
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-12-04 16:35:00 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-12-04 16:35:00 +0100
commitf3ac1849f2b141ea1845752e1ca2317845e90e3a (patch)
treeadcdc9013af5cca4165857408ed7181ffdf0de64 /python/astra/utils.pyx
parent8144bf0397ee1913b830d82058ccd40df741f1b3 (diff)
parent0d015b1c91581ee5ef3e936f03e4c62fbc7ea362 (diff)
downloadastra-f3ac1849f2b141ea1845752e1ca2317845e90e3a.tar.gz
astra-f3ac1849f2b141ea1845752e1ca2317845e90e3a.tar.bz2
astra-f3ac1849f2b141ea1845752e1ca2317845e90e3a.tar.xz
astra-f3ac1849f2b141ea1845752e1ca2317845e90e3a.zip
Merge branch 'master'
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