X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=tools%2Fgpubounds_error.py;fp=tools%2Fgpubounds_error.py;h=0000000000000000000000000000000000000000;hp=ecf13c48b418056e5176a693f003509a630e6738;hb=9bdc5bae5786db07e19a43136a126ae8723eb191;hpb=5d9bd33375efe24796ed442077385f67d9661520 diff --git a/tools/gpubounds_error.py b/tools/gpubounds_error.py deleted file mode 100755 index ecf13c4..0000000 --- a/tools/gpubounds_error.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/python -import sys -import os -import math - -# Calculates the total error in coordinates of GPU bounds rectangles of objects - -def ComputeError(reference, other): - reference = open(reference, "r") - other = open(other, "r") - total = 0.0 - while True: - a = reference.readline() - b = other.readline() - if a == "" and b == "": - reference.close() - other.close() - return total - if a[0] == '#' and b[0] == '#': - continue - a = map(float, a.strip(" \r\n").split("\t")) - b = map(float, b.strip(" \r\n").split("\t")) - deltaArea = abs(b[3]*b[4] - a[3]*a[4]) - - deltaCoord = b[1] - a[1] + b[2] - a[2] - total += math.sqrt(deltaArea) + abs(deltaCoord) - -# Counts the number of unique bounds -def UniqueBounds(other): - other = open(other, "r") - store = {} - for l in other.readlines(): - if l[0] == "#": - continue - #print "L is " + str(l) - l = map(float, l.strip(" \r\n").split("\t")) - l = tuple(l[1:]) - if not l in store.keys(): - store[l] = 1 - else: - store[l] += 1 - other.close() - return len(store.keys()) - -def main(argv): - print str(ComputeError(argv[1], argv[2])) + "\t" + str(UniqueBounds(argv[1])) + "\t" + str(UniqueBounds(argv[2])) - return 0 - - -if __name__ == "__main__": - sys.exit(main(sys.argv))