summaryrefslogtreecommitdiffstats
path: root/python/astra/utils.pyx
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-06-26 12:20:44 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-06-26 12:20:44 +0200
commit47b520d51fc4fc49db992b9117f6c0abfa8152b5 (patch)
tree8f494a765a3607afd1c9bac9c592f30536b950a1 /python/astra/utils.pyx
parent9f86a4c3f20ac8785f80288ec4cdefe79ed67e68 (diff)
parent62f3aa5792011792db866ce0841c8d164aa9a34d (diff)
downloadastra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.tar.gz
astra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.tar.bz2
astra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.tar.xz
astra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.zip
Merge branch 'master'
Diffstat (limited to 'python/astra/utils.pyx')
-rw-r--r--python/astra/utils.pyx11
1 files changed, 8 insertions, 3 deletions
diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx
index ddb37aa..260c308 100644
--- a/python/astra/utils.pyx
+++ b/python/astra/utils.pyx
@@ -95,7 +95,8 @@ cdef void readDict(XMLNode root, _dc):
if val.size == 0:
break
listbase = root.addChildNode(item)
- data = <double*>np.PyArray_DATA(np.ascontiguousarray(val,dtype=np.float64))
+ contig_data = np.ascontiguousarray(val,dtype=np.float64)
+ data = <double*>np.PyArray_DATA(contig_data)
if val.ndim == 2:
listbase.setContent(data, val.shape[1], val.shape[0], False)
elif val.ndim == 1:
@@ -129,7 +130,8 @@ cdef void readOptions(XMLNode node, dc):
break
listbase = node.addChildNode(six.b('Option'))
listbase.addAttribute(< string > six.b('key'), < string > item)
- data = <double*>np.PyArray_DATA(np.ascontiguousarray(val,dtype=np.float64))
+ contig_data = np.ascontiguousarray(val,dtype=np.float64)
+ data = <double*>np.PyArray_DATA(contig_data)
if val.ndim == 2:
listbase.setContent(data, val.shape[1], val.shape[0], False)
elif val.ndim == 1:
@@ -202,7 +204,10 @@ cdef XMLNode2dict(XMLNode node):
while it != nodes.end():
subnode = deref(it)
if castString(subnode.getName())=="Option":
- opts[castString(subnode.getAttribute('key'))] = stringToPythonValue(subnode.getAttribute('value'))
+ if subnode.hasAttribute('value'):
+ opts[castString(subnode.getAttribute('key'))] = stringToPythonValue(subnode.getAttribute('value'))
+ else:
+ opts[castString(subnode.getAttribute('key'))] = stringToPythonValue(subnode.getContent())
else:
dct[castString(subnode.getName())] = stringToPythonValue(subnode.getContent())
inc(it)