Commit 35041af2 authored by Joel Collins's avatar Joel Collins
Browse files

axes_to_array defaults to converting to int

parent c86d194c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ def set_properties(obj, **kwargs):
            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"""
    # If no base array is given
    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
    for axis, key in enumerate(axis_keys):
        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