won't be needing these

This commit is contained in:
Stephen McQuay 2011-03-24 15:48:50 -06:00
parent 928a4ccdab
commit 385294a040
2 changed files with 0 additions and 139 deletions

View File

@ -1,69 +0,0 @@
#!/usr/bin/env python
import sys
import os
import pickle
from glob import glob
from interp.grid.DD import random_grid
from interp.baker import get_phis, run_baker
from interp.tools import friendly_exact_2D as exact_func, improved_answer
import numpy as np
import pylab
def draw_gb(bad, good):
pylab.xlabel('total runs')
pylab.ylabel('count')
pylab.grid(True)
pylab.plot(bad)
pylab.plot(good)
pylab.legend(('bad', 'good'))
pylab.savefig("output.png")
FILE_PREFIX='/tmp/qhull-'
if __name__ == '__main__':
for g in glob('%s*' % FILE_PREFIX):
os.remove(g)
try:
total_points = int(sys.argv[1])
random_points = int(sys.argv[2])
total_tries = int(sys.argv[3])
except:
print "usage: app.py [total points in random grid] [number of random points to attempt] [total attempts]"
sys.exit(1)
d = {True: 0, False: 0}
good = []
bad = []
for cur_try in xrange(total_tries):
g = random_grid(total_points)
open('%s%0.3d.txt' % (FILE_PREFIX, cur_try), 'w').write(g.for_qhull())
for i in xrange(random_points):
X = [np.random.rand(), np.random.rand()]
exact = exact_func(X)
try:
try:
answer = g.run_baker(X)
d[improved_answer(answer, exact)] += 1
except ValueError as e:
smblog.error(e)
except smberror as e:
print e
print d
print d
bad.append(d[False])
good.append(d[True])
draw_gb(bad = bad, good = good)
pickle.dump((bad,good), open("test.p", 'w'))

View File

@ -1,70 +0,0 @@
#!/usr/bin/env python
import sys
import os
import pickle
from glob import glob
from interp.grid.DDD import random_grid
from interp.baker import get_phis, run_baker
from interp.tools import baker_exact_3D as exact_func, improved_answer
import numpy as np
import pylab
def draw_gb(bad, good):
pylab.xlabel('total runs')
pylab.ylabel('count')
pylab.grid(True)
pylab.plot(bad)
pylab.plot(good)
pylab.legend(('bad', 'good'))
pylab.savefig("output.png")
FILE_PREFIX='/tmp/qhull-'
if __name__ == '__main__':
for g in glob('%s*' % FILE_PREFIX):
os.remove(g)
try:
total_points = int(sys.argv[1])
random_points = int(sys.argv[2])
total_tries = int(sys.argv[3])
except:
print "usage: app.py [total points in random grid] [number of random points to attempt] [total attempts]"
sys.exit(1)
print "total points", total_points
good = []
bad = []
for cur_try in xrange(1,total_tries + 1):
d = {True: 0, False: 0}
g = random_grid(total_points * cur_try)
open('%s%0.3d.txt' % (FILE_PREFIX, cur_try), 'w').write(g.for_qhull())
for i in xrange(random_points):
X = [np.random.rand(), np.random.rand(), np.random.rand()]
exact = exact_func(X)
try:
try:
answer = g.run_baker(X, order=2, extra_points=10)
d[improved_answer(answer, exact)] += 1
except ValueError as e:
print e
except Exception as e:
print e
print d
print d
bad.append(d[False])
good.append(d[True])
draw_gb(bad = bad, good = good)