2010-10-22 15:10:58 -07:00
|
|
|
#!/usr/bin/env python
|
2010-04-23 15:29:31 -07:00
|
|
|
|
|
|
|
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-'
|
|
|
|
|
|
|
|
try:
|
|
|
|
verts = parse_qhull_file(sys.argv[1], verbose=True)
|
2010-04-30 15:23:29 -07:00
|
|
|
X = [float(sys.argv[2]), float(sys.argv[3])]
|
2010-04-23 15:29:31 -07:00
|
|
|
except:
|
2010-04-30 15:23:29 -07:00
|
|
|
print "usage: app.py qhullinputfile X Y"
|
2010-04-23 15:29:31 -07:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
q = [exact_func(i) for i in verts]
|
|
|
|
|
|
|
|
g = grid(verts,q)
|
|
|
|
|
|
|
|
exact = exact_func(X)
|
|
|
|
|
2010-10-22 15:10:58 -07:00
|
|
|
d = {True:0, False:0}
|
|
|
|
|
2010-04-23 15:29:31 -07:00
|
|
|
try:
|
|
|
|
answer = g.run_baker(X)
|
|
|
|
d[improved_answer(answer, exact)] += 1
|
|
|
|
except smberror as e:
|
|
|
|
print e
|