axes_to_array defaults to converting to int
This commit is contained in:
parent
c86d194c8c
commit
35041af234
1 changed files with 2 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ def set_properties(obj, **kwargs):
|
||||||
setattr(obj, k, v)
|
setattr(obj, k, v)
|
||||||
|
|
||||||
|
|
||||||
def axes_to_array(coordinate_dictionary, axis_keys=('x', 'y', 'z'), base_array=None):
|
def axes_to_array(coordinate_dictionary, axis_keys=('x', 'y', 'z'), base_array=None, asint=True):
|
||||||
"""Takes key-value pairs of a JSON value, and maps onto an array"""
|
"""Takes key-value pairs of a JSON value, and maps onto an array"""
|
||||||
# If no base array is given
|
# If no base array is given
|
||||||
if not base_array:
|
if not base_array:
|
||||||
|
|
@ -39,7 +39,7 @@ def axes_to_array(coordinate_dictionary, axis_keys=('x', 'y', 'z'), base_array=N
|
||||||
# Do the mapping
|
# Do the mapping
|
||||||
for axis, key in enumerate(axis_keys):
|
for axis, key in enumerate(axis_keys):
|
||||||
if key in coordinate_dictionary:
|
if key in coordinate_dictionary:
|
||||||
base_array[axis] = coordinate_dictionary[key]
|
base_array[axis] = int(coordinate_dictionary[key]) if asint else coordinate_dictionary[key]
|
||||||
|
|
||||||
return base_array
|
return base_array
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue