def load_split_indices(file_path, fold_index=0):
    """
    Args:
        file_path: path to split indices file
        fold_index: index of the fold whose train and test indices you want

    Returns:
        train_index: list of integer indices for train data
        test_index: list of integer indices for test data

    File of the form
    train 0 1 0 2 ...
    test 3 4 6 ...
    train 1 5 2 ...
    test 6 8 9 ...
    ...
    """
    with open(file_path, 'r') as file:
        lines = file.readlines()
        assert len(lines) >= (2 * fold_index) + 2, 'Error: not enough information in fold indices file %d < % d' \
                                                   % (len(lines), (2 * fold_index) + 2)

        train_index = lines[(fold_index * 2)].split(' ')[1:]
        test_index = lines[(fold_index * 2) + 1].split(' ')[1:]

        # Convert string indices to ints
        train_index = [int(i) for i in train_index]
        test_index = [int(i) for i in test_index]

    return train_index, test_index