def read_patches(data, start = 0):
    """
    Reads a PMVS patch file, typically called something like option-0000.patch. 
    Returns an array of patches.
    """

    if data.readline().strip() != "PATCHES":
        raise RuntimeError("expected PATCHES header")

    patches = []
    for patch in range(int(data.readline().strip())):
        line = data.readline().strip()
        while not line:
            line = data.readline().strip()
        if line != "PATCHS":
            raise RuntimeError("expected PATCH for patch {0}".format(patch))

        line = data.readline().strip()
        realcoords = [float(x) for x in line.split()]

        line = data.readline().strip()
        normal = [float(x) for x in line.split()]

        line = data.readline().strip()
        score, _, _ = [float(x) for x in line.split()]

        data.readline()
        line = data.readline()
        visibles = [start - int(x) for x in line.split()]

        data.readline()
        line = data.readline().strip()
        disagrees = [int(x) - start for x in line.split()]

        patches.append(Patch(realcoords, normal, score, visibles, disagrees))

    return patches
dataset/ETHPy150Open cvondrick/pyvision/vision/reconstruction/pmvs.py/read_patches/swapped operands of `-`