def _get_slice_len(idx):
    '\n    Get the number of elements in a slice.\n\n    Parameters\n    ----------\n    idx : np.ndarray\n        A (3,) shaped array containing start, stop, step\n\n    Returns\n    -------\n    n : int\n        The length of the slice.\n\n    Examples\n    --------\n    >>> idx = np.array([5, 15, 5])\n    >>> _get_slice_len(idx)\n    2\n    '
    (start, stop, step) = (idx[0], idx[1], idx[2])
    if (step > 0):
        return ((((stop - start) + step) - 1) // step)
    else:
        return ((((start - stop) - step) - 1) // (- step))
Get the number of elements in a slice.

Parameters
----------
idx : np.ndarray
    A (3,) shaped array containing start, stop, step

Returns
-------
n : int
    The length of the slice.

Examples
--------
>>> idx = np.array([5, 15, 5])
>>> _get_slice_len(idx)
2
def _get_slice_len(idx):
    '\n    Get the number of elements in a slice.\n\n    Parameters\n    ----------\n    idx : np.ndarray\n        A (3,) shaped array containing start, stop, step\n\n    Returns\n    -------\n    n : int\n        The length of the slice.\n\n    Examples\n    --------\n    >>> idx = np.array([5, 15, 5])\n    >>> _get_slice_len(idx)\n    2\n    '
    (start, stop, step) = (idx[0], idx[1], idx[2])
    if (step > 0):
        return ((((stop - start) + step) - 1) // step)
    else:
        return ((((start - stop) - step) - 1) // (- step))