Пример #1
0
def normalize_integer_selection(dim_sel, dim_len):

    # normalize type to int
    dim_sel = int(dim_sel)

    # handle wraparound
    if dim_sel < 0:
        dim_sel = dim_len + dim_sel

    # handle out of bounds
    if dim_sel >= dim_len or dim_sel < 0:
        err_boundscheck(dim_len)

    return dim_sel
Пример #2
0
def normalize_integer_selection(dim_sel, dim_len):

    # normalize type to int
    dim_sel = int(dim_sel)

    # handle wraparound
    if dim_sel < 0:
        dim_sel = dim_len + dim_sel

    # handle out of bounds
    if dim_sel >= dim_len or dim_sel < 0:
        err_boundscheck(dim_len)

    return dim_sel
Пример #3
0
def boundscheck_indices(x, dim_len):
    if np.any(x < 0) or np.any(x >= dim_len):
        err_boundscheck(dim_len)
Пример #4
0
def boundscheck_indices(x, dim_len):
    if np.any(x < 0) or np.any(x >= dim_len):
        err_boundscheck(dim_len)