This commit is contained in:
Stephen Mardson McQuay
2009-12-27 10:48:27 -07:00
commit 961b3b7b26
19 changed files with 560 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/python
import sqlite3
import sys, os
import numpy as np
output_file = 'points.db'
if os.path.exists(output_file):
print "found old db, erasing"
os.unlink(output_file)
create = 'CREATE TABLE points (point_id integer primary key, x float, y float)'
sqconn = sqlite3.connect(output_file)
sqc = sqconn.cursor()
sqc.execute(create)
for i in xrange(int(1e6)):
rx = np.random.rand() * 2 - 1
ry = np.random.rand() * 2 - 1
sqc.execute('INSERT INTO points VALUES (NULL, ?, ?)', (rx, ry))
sqconn.commit()
sqconn.close()