got this test file to work appropriately
This commit is contained in:
parent
b8cb32d819
commit
7f0d8e0589
30
bin/test.py
30
bin/test.py
@ -3,10 +3,13 @@
|
||||
import sys
|
||||
from interp.grid.DDD import random_grid
|
||||
from interp.baker import get_phis, run_baker
|
||||
from interp.tools import log
|
||||
from interp.tools import exact_func_3D, improved_answer
|
||||
from interp.tools import baker_exact_3D, improved_answer
|
||||
from interp.grid.simplex import contains
|
||||
|
||||
import interp
|
||||
import logging
|
||||
log = logging.getLogger("interp")
|
||||
|
||||
try:
|
||||
total_points = int(sys.argv[1])
|
||||
except:
|
||||
@ -15,32 +18,37 @@ except:
|
||||
|
||||
log.info(total_points)
|
||||
g = random_grid(total_points)
|
||||
g.q = [baker_exact_3D(i) for i in g.verts]
|
||||
|
||||
open('/tmp/for_qhull.txt', 'w').write(g.for_qhull())
|
||||
|
||||
X = [0.5, 0.3, 0.4]
|
||||
|
||||
R, S = g.get_simplex_and_nearest_points(X, extra_points = 6, simplex_size=4)
|
||||
sys.exit()
|
||||
log.info("Containing Simplex: %s" % contains(X, R.points))
|
||||
R, S = g.get_simplex_and_nearest_points(X, extra_points = 16, simplex_size=4)
|
||||
|
||||
exact = exact_func_3D(X)
|
||||
log.info("Containing Simplex: %s" % contains(X, R.verts))
|
||||
|
||||
exact = baker_exact_3D(X)
|
||||
log.info("exact solution: %0.6f" % exact)
|
||||
|
||||
phis = get_phis(X, R.points)
|
||||
phis = get_phis(X, R.verts)
|
||||
log.info("phi values (should all be positive): %s %s" % (phis, sum(phis)))
|
||||
if [i for i in phis if i < 0.0]:
|
||||
log.error("problems")
|
||||
|
||||
|
||||
print exact
|
||||
try:
|
||||
r = run_baker(X, R, S)
|
||||
log.info("run_baker manual: %s" % improved_answer(r, exact))
|
||||
r = run_baker(X, R, S, order = 2)
|
||||
print r
|
||||
print "run_baker manual: %s" % improved_answer(r, exact)
|
||||
except Exception as e:
|
||||
log.error(e)
|
||||
|
||||
|
||||
try:
|
||||
answer = g.run_baker(X)
|
||||
log.info("run_baker from grid: %s" % improved_answer(answer, exact))
|
||||
answer = g.run_baker(X, order = 2, extra_points = 16)
|
||||
print answer
|
||||
print "run_baker from grid: %s" % improved_answer(answer, exact)
|
||||
except Exception as e:
|
||||
log.error(e)
|
||||
|
Loading…
Reference in New Issue
Block a user