merge
This commit is contained in:
commit
fca5a5c600
@ -7,29 +7,15 @@ import numpy as np
|
||||
|
||||
import interp.bootstrap
|
||||
from interp.grid.gmsh import gmsh_grid3D
|
||||
from interp.tools import improved_answer, log, exact
|
||||
from interp.tools import improved_answer, exact
|
||||
|
||||
from interp.grid import grid
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
print >> sys.stderr, "usage: %s <gmsh file>" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
g = gmsh_grid3D(sys.argv[1])
|
||||
def test_success(input_file, count):
|
||||
g = gmsh_grid3D(input_file)
|
||||
g.q = np.array([exact(x) for x in g.verts])
|
||||
|
||||
X = np.array([0.2, 0.5, 0.01])
|
||||
R = g.get_containing_simplex(X)
|
||||
R, S = g.get_simplex_and_nearest_points(X, 10)
|
||||
print R
|
||||
print "r", R
|
||||
print "s", S
|
||||
|
||||
results = {True:0, False:0}
|
||||
# import pdb; pdb.set_trace()
|
||||
for i in xrange(1000):
|
||||
for i in xrange(count):
|
||||
X = np.random.random((1,3))[0]
|
||||
|
||||
a = g.run_baker(X, order = 3, extra_points = 32)
|
||||
@ -37,8 +23,13 @@ if __name__ == '__main__':
|
||||
|
||||
results[improved_answer(a, e)] += 1
|
||||
|
||||
print results
|
||||
# g.normalize_q()
|
||||
# print g.toxml()
|
||||
return results
|
||||
|
||||
igg = grid(g.verts, g.q)
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print >> sys.stderr, "usage: %s <input file> <number of attempts>" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
input_file, count = sys.argv[1:]
|
||||
|
||||
print test_success(input_file, int(count))
|
||||
|
38
tools/install.ubuntu.sh
Normal file
38
tools/install.ubuntu.sh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
PACKAGES="\
|
||||
build-essential \
|
||||
gfortran \
|
||||
python-dev \
|
||||
python-setuptools \
|
||||
libblas-dev \
|
||||
liblapack-dev \
|
||||
libqhull-dev \
|
||||
qhull-bin \
|
||||
"
|
||||
|
||||
echo "we'll ask for your password to install a few things:"
|
||||
echo "like theses packages: $PACKAGES"
|
||||
|
||||
sudo aptitude install -y $PACKAGES
|
||||
|
||||
sudo easy_install pip
|
||||
sudo pip install mercurial
|
||||
|
||||
sudo pip install virtualenv
|
||||
sudo pip install virtualenvwrapper
|
||||
|
||||
mkdir ~/.virtualenvs
|
||||
echo 'source $(which virtualenvwrapper.sh)' >> .bashrc
|
||||
source $(which virtualenvwrapper.sh)
|
||||
|
||||
mkvirtualenv --no-site-packages research
|
||||
workon research
|
||||
|
||||
pip install numpy
|
||||
pip install scipy
|
||||
|
||||
mkdir ~/src
|
||||
cd ~/src && hg clone https://mcquay.me/hg/research
|
||||
cd ~/src/research && python setup.py develop
|
||||
cd ~/src/research && python test/all.py
|
Loading…
Reference in New Issue
Block a user