def regularize_array(A):
    """
    Takes an np.ndarray as an input.


    - If the array is one-dimensional, it's assumed to be an array of input values.

    - If the array is more than one-dimensional, its last index is assumed to curse
      over spatial dimension.


    Either way, the return value is at least two dimensional. A.shape[-1] gives the
    number of spatial dimensions.
    """
    if not isinstance(A,np.ndarray):
        A = np.array(A, dtype=float)
    else:
        A = np.asarray(A, dtype=float)

    if len(A.shape) <= 1:
        return A.reshape(-1,1)

    elif A.shape[-1]>1:
        return A.reshape(-1, A.shape[-1])

    else:
        return A