getting stuff from qdelaunay
mostly spent time trying to figure out subprocess (which i though i already understood). I am concerned for what will happen with large datasets. next steps include: 1) design data struture 2) implement slurping of stdout into this structure 3) drink coke --HG-- rename : lib/smcqhull.py => lib/smcqdelaunay.py
This commit is contained in:
parent
f9973e7580
commit
50daeb5d74
@ -122,4 +122,4 @@ if __name__ == '__main__':
|
|||||||
errors.append(cur_error)
|
errors.append(cur_error)
|
||||||
|
|
||||||
print rms(errors)
|
print rms(errors)
|
||||||
print "%s of %s won" % (success, options.destination_total)
|
print "%s of %s won" % (success, len(mesh_dest.points))
|
||||||
|
@ -15,8 +15,8 @@ class grid(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
r = ''
|
r = ''
|
||||||
assert( len(self.points) == len(self.q) )
|
assert( len(self.points) == len(self.q) )
|
||||||
for i in xrange(len(self.points)):
|
for c, i in enumerate(zip(self.points, self.q)):
|
||||||
r += "%r: %0.4f\n" % ( self.points[i], self.q[i] )
|
r += "%d %r: %0.4f\n" % (c,i[0], i[1])
|
||||||
return r
|
return r
|
||||||
|
|
||||||
class simple_rect_grid(grid):
|
class simple_rect_grid(grid):
|
||||||
|
17
lib/smcqdelaunay.py
Normal file
17
lib/smcqdelaunay.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
from grid import simple_rect_grid
|
||||||
|
|
||||||
|
def get_qdelaunay_dump(g):
|
||||||
|
cmd = 'qdelaunay Qt f'
|
||||||
|
p = Popen(cmd.split(), bufsize=1, stdin=PIPE, stdout=PIPE)
|
||||||
|
so, se = p.communicate(g.for_qhull())
|
||||||
|
for i in so.splitlines():
|
||||||
|
yield i
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
g = simple_rect_grid(3,3)
|
||||||
|
print g
|
||||||
|
for i in get_qdelaunay_dump(g):
|
||||||
|
print i
|
@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
print "hello world"
|
|
@ -25,6 +25,13 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||||||
self.q = [1, 0, 0, 0, 0, 0, 0, 0, 0]
|
self.q = [1, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
self.X = [1.5, 10.25]
|
self.X = [1.5, 10.25]
|
||||||
|
|
||||||
|
def testImports(self):
|
||||||
|
import numpy
|
||||||
|
import scipy
|
||||||
|
import grid
|
||||||
|
import baker
|
||||||
|
import delaunay
|
||||||
|
|
||||||
def testGetPhis(self):
|
def testGetPhis(self):
|
||||||
|
|
||||||
X = [0,0]
|
X = [0,0]
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
|
||||||
import random
|
|
||||||
import unittest
|
import unittest
|
||||||
import delaunay
|
|
||||||
|
|
||||||
class TestSequenceFunctions(unittest.TestCase):
|
class TestSequenceFunctions(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -11,6 +8,7 @@ class TestSequenceFunctions(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def testQhull(self):
|
def testQhull(self):
|
||||||
|
import delaunay
|
||||||
dt = delaunay.Triangulation(self.l)
|
dt = delaunay.Triangulation(self.l)
|
||||||
answer = [
|
answer = [
|
||||||
[4,1,3],
|
[4,1,3],
|
||||||
|
Loading…
Reference in New Issue
Block a user