def _check_sakoe_chiba_params(n_timestamps_1, n_timestamps_2, window_size):
    """Check and set some parameters of the sakoe-chiba band."""
    if not isinstance(n_timestamps_1, (int, np.integer)):
        raise TypeError("'n_timestamps_1' must be an integer.")
    else:
        if not n_timestamps_1 >= 2:
            raise ValueError("'n_timestamps_1' must be an integer greater than"
                             " or equal to 2.")
    if not isinstance(window_size, (int, np.integer, float, np.floating)):
        raise TypeError("'window_size' must be an integer or a float.")
    n_timestamps = max(n_timestamps_1, n_timestamps_2)

    if isinstance(window_size, (float, np.floating)):
        if not 0. <= window_size <= 1.:
            raise ValueError("The given 'window_size' is a float, "
                             "it must be between "
                             "0. and 1. To set the size of the sakoe-chiba "
                             "manually, 'window_size' must be an integer.")
        window_size = ceil(window_size * (n_timestamps - 1))
    else:
        if not 0 <= window_size <= (n_timestamps - 1):
            raise ValueError(
                "The given 'window_size' is an integer, it must "
                "be greater "
                "than or equal to 0 and lower than max('n_timestamps_1', "
                "'n_timestamps_2')."
            )

    scale = (n_timestamps_2 - 1) / (n_timestamps_1 - 1)

    if n_timestamps_2 > n_timestamps_1:
        window_size = max(window_size, scale / 2)
        horizontal_shift = 0
        vertical_shift = window_size
    elif n_timestamps_1 > n_timestamps_2:
        window_size = max(window_size, 0.5 / scale)
        horizontal_shift = window_size
        vertical_shift = 0
    else:
        horizontal_shift = 0
        vertical_shift = window_size
    return scale, horizontal_shift, vertical_shift
Check and set some parameters of the sakoe-chiba band.
pyts/metrics/dtw.py