def _dtw_sakoechiba(x=None, y=None, dist='square', window_size=0.1,
                    precomputed_cost=None, return_cost=False,
                    return_accumulated=False, return_path=False):
    """Dynamic Time Warping (DTW) distance with Sakoe-Chiba band constraint.

    The Sakoe-Chiba constraint region is a band centered around the main
    diagonal. Any cell whose distance to the diagonale is lower than a
    given value is valid for the path.

    Options
    -------
    window_size : float or int (default = 0.1)
        The window size above and below the diagonal.
        If float, `window_size` must be between 0 and
        1, and the actual window size will be computed as
        ``ceil(window_size * max((n_timestamps_1, n_timestamps_2) - 1))``.
        If int, `window_size` must be the largest temporal shift allowed.
        Each cell whose distance with the diagonal is lower than or equal to
        `window_size` becomes a valid cell for the path.

    References
    ----------
    .. [1] H. Sakoe and S. Chiba, "Dynamic programming algorithm optimization
           for spoken word recognition". IEEE Transactions on Acoustics,
           Speech, and Signal Processing, 26(1), 43-49 (1978).


    """
    x, y, precomputed_cost, n_timestamps_1, n_timestamps_2 = \
        _check_input_dtw(x, y, precomputed_cost, dist, method="sakoechiba")
    region = sakoe_chiba_band(n_timestamps_1, n_timestamps_2, window_size)
    cost_mat = _input_to_cost(x, y, dist, precomputed_cost, region=region)

    acc_cost_mat = accumulated_cost_matrix(cost_mat, region)
    dtw_dist = acc_cost_mat[-1, -1]
    if dist == 'square':
        dtw_dist = sqrt(dtw_dist)

    res = _return_results(dtw_dist, cost_mat, acc_cost_mat,
                          return_cost, return_accumulated, return_path)
    return res
Dynamic Time Warping (DTW) distance with Sakoe-Chiba band constraint.

    The Sakoe-Chiba constraint region is a band centered around the main
    diagonal. Any cell whose distance to the diagonale is lower than a
    given value is valid for the path.

    Options
    -------
    window_size : float or int (default = 0.1)
        The window size above and below the diagonal.
        If float, `window_size` must be between 0 and
        1, and the actual window size will be computed as
        ``ceil(window_size * max((n_timestamps_1, n_timestamps_2) - 1))``.
        If int, `window_size` must be the largest temporal shift allowed.
        Each cell whose distance with the diagonal is lower than or equal to
        `window_size` becomes a valid cell for the path.

    References
    ----------
    .. [1] H. Sakoe and S. Chiba, "Dynamic programming algorithm optimization
           for spoken word recognition". IEEE Transactions on Acoustics,
           Speech, and Signal Processing, 26(1), 43-49 (1978).


    
pyts/metrics/dtw.py