#!/usr/bin/python2.6 import sys from grid.DD import grid from grid.qhull import parse_qhull_file from baker import get_phis, run_baker from baker.tools import exact_func, smberror, improved_answer from glob import glob from os import remove FILE_PREFIX='/tmp/qhull-' for g in glob('%s*' % FILE_PREFIX): remove(g) try: verts = parse_qhull_file(sys.argv[1], verbose=True) except: print "usage: app.py qhullinputfile" sys.exit(1) q = [exact_func(i) for i in verts] g = grid(verts,q) X = [0.3, 0.3] g.get_containing_simplex(X) exact = exact_func(X) try: answer = g.run_baker(X) d[improved_answer(answer, exact)] += 1 except smberror as e: print e