import copy


def peakfinder(data, look=10):
    """
    Find the location of the peaks in a single vector.

    :type data: list[float]
    :param data: Data to find a peak in.

    :type look: int
    :param look: Amount of position to each side to decide if it is a local 
        maximum. The default is 10.

    :returns: A vector of same length with 1 or 0 if it finds or not a peak in 
        that position
    :rtype: list[int]
    """
    y = copy.deepcopy(data)
    is_max = [0 for _ in data]
    is_min = [0 for _ in data]
    for i in range(look, len(y) - look):  # start at "look" to avoid o.o.r
        lower = 0  # negative if lower, positive if higher
        higher = 0
        for j in range(look):
            if y[i] <= y[i - look + j] and y[i] <= y[i + j]:  # search all range lower
                lower += 1  # +1 if lower
            elif (y[i] >= y[i - look + j] and
                  y[i] >= y[i + j]):  # search all range higher
                higher += 1  # +1 if higher
        if higher == look:  # if all higher then its local max
            is_max[i] = 1
            is_min[i] = 0
        elif lower == look:  # if all lower then its local min
            is_max[i] = 0
            is_min[i] = 1
        else:
            is_max[i] = 0
            is_min[i] = 0
    return is_max