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:
Stephen Mardson McQuay
2010-02-07 00:01:02 -07:00
parent f9973e7580
commit 50daeb5d74
6 changed files with 28 additions and 10 deletions
+2 -2
View File
@@ -15,8 +15,8 @@ class grid(object):
def __str__(self):
r = ''
assert( len(self.points) == len(self.q) )
for i in xrange(len(self.points)):
r += "%r: %0.4f\n" % ( self.points[i], self.q[i] )
for c, i in enumerate(zip(self.points, self.q)):
r += "%d %r: %0.4f\n" % (c,i[0], i[1])
return r
class simple_rect_grid(grid):
+17
View 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
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/python
if __name__ == '__main__':
print "hello world"