mirror of
https://github.com/triqs/dft_tools
synced 2024-12-26 14:23:38 +01:00
Add list/tuple of long in python parameter class
modified: pytriqs/parameters/parameters.pyx
This commit is contained in:
parent
1906dc30a5
commit
68e742df53
@ -43,6 +43,7 @@ cdef class Parameters:
|
|||||||
if extract_strict[array_view[double,THREE]]().is_possible(_o) : return extract_strict[array_view[double,THREE]]().invoke(_o).to_python()
|
if extract_strict[array_view[double,THREE]]().is_possible(_o) : return extract_strict[array_view[double,THREE]]().invoke(_o).to_python()
|
||||||
|
|
||||||
if extract_strict[vector[std_string]]().is_possible(_o) : return extract_strict[vector[std_string]]().invoke(_o)
|
if extract_strict[vector[std_string]]().is_possible(_o) : return extract_strict[vector[std_string]]().invoke(_o)
|
||||||
|
if extract_strict[vector[long]]().is_possible(_o) : return extract_strict[vector[long]]().invoke(_o)
|
||||||
|
|
||||||
raise ValueError, "Can not extract the key %s"%key
|
raise ValueError, "Can not extract the key %s"%key
|
||||||
|
|
||||||
@ -55,6 +56,8 @@ cdef class Parameters:
|
|||||||
elif isinstance(rhs, list) or isinstance(rhs,tuple) :
|
elif isinstance(rhs, list) or isinstance(rhs,tuple) :
|
||||||
if set([type(x) for x in rhs]) == set([type('')]) : # list or tuple of string
|
if set([type(x) for x in rhs]) == set([type('')]) : # list or tuple of string
|
||||||
inserter_in_map[parameters,vector[std_string]](self._c)(key, rhs)
|
inserter_in_map[parameters,vector[std_string]](self._c)(key, rhs)
|
||||||
|
elif set([type(x) for x in rhs]) == set([type(1)]) : # list or tuple of int
|
||||||
|
inserter_in_map[parameters,vector[long]](self._c)(key, rhs)
|
||||||
else :
|
else :
|
||||||
raise TypeError, "List and tuple are not supported by Parameters. Please use numpy arrays"
|
raise TypeError, "List and tuple are not supported by Parameters. Please use numpy arrays"
|
||||||
elif isinstance(rhs, np.ndarray) :
|
elif isinstance(rhs, np.ndarray) :
|
||||||
|
Loading…
Reference in New Issue
Block a user