smbinterp/bin/test2d-qhull-specific.py
Stephen Mardson McQuay 2db4169bfa major refactoring
--HG--
rename : lib/baker/__init__.py => interp/baker/__init__.py
rename : lib/grid/DD.py => interp/grid/DD.py
rename : lib/grid/DDD.py => interp/grid/DDD.py
rename : lib/grid/__init__.py => interp/grid/__init__.py
rename : lib/grid/qhull.py => interp/grid/qhull.py
rename : lib/grid/simplex.py => interp/grid/simplex.py
rename : lib/grid/smcqdelaunay.py => interp/grid/smcqdelaunay.py
rename : lib/baker/tools.py => interp/tools.py
2010-10-22 16:10:58 -06:00

34 lines
650 B
Python
Executable File

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