def diag_indices_from(arr):
    if not arr.ndim >= 2:
        raise ValueError("input array must be at least 2-d")
    # For more than d=2, the strided formula is only valid for arrays with
    # all dimensions equal, so we check first.
    if not np.alltrue(np.diff(arr.shape) == 0):
        raise ValueError("All dimensions of input must be of equal length")

    return diag_indices(arr.shape[0], arr.ndim)
Return the indices to access the main diagonal of an n-dimensional
dataset/ETHPy150Open nipy/nitime/nitime/utils.py/diag_indices_from