def find_start_batch(data, s, initial_index=0):
    """
    Find the starting index of the first valid batch of sweep data and its corresponding header.
    :param data: Batch of data coming from the FPGA via the USB port.
    
    :param s: Settings dictionary
    :param initial_index: 0 if reading a new batch, non zero if finding the next valid sweep within a batch
    :return: Starting index of a sweep data, header of that sweep
    """
    flag_valid_header = False
    for index in range(initial_index, len(data) - s['nbytes_sweep'] - 2):
        current_header = [data[index], data[index + 1]]
        if current_header[0] == s['start'] and data[index + s[
            'nbytes_sweep'] + 2] == s['start']:
            print(
                '[INFO] Found start signal {} at position {} (jumped {} byte).'
                .format(current_header, index, index - initial_index))
            print('[INFO] Next header would read [{}, {}]'.format(data[
                index + s['nbytes_sweep'] + 2], data[index + s[
                'nbytes_sweep'] + 3]))
            flag_valid_header = True
            break
    if flag_valid_header:
        index += 2
    else:
        index = 0
        current_header = [0, 0]
    assert index >= 0
    assert current_header[0] == 127 or current_header[0] == 0
    return index, current_header
