[redistricter] r203 committed - fix setting kmpp threshold based on 10th best result

1 view
Skip to first unread message

redist...@googlecode.com

unread,
Mar 1, 2011, 1:41:43 AM3/1/11
to redistrict...@googlegroups.com
Revision: 203
Author: brian.olson
Date: Mon Feb 28 22:40:36 2011
Log: fix setting kmpp threshold based on 10th best result
http://code.google.com/p/redistricter/source/detail?r=203

Modified:
/trunk/analyze_submissions.py

=======================================
--- /trunk/analyze_submissions.py Sun Feb 27 12:50:04 2011
+++ /trunk/analyze_submissions.py Mon Feb 28 22:40:36 2011
@@ -368,10 +368,13 @@
out.write('%s:weight:%f\n' % (cname, rweight(data['count'])))
if (cname in bestconfigs) and (bestconfigs[cname]['count'] >= 10):
c = self.db.cursor()
- rows = c.execute('SELECT kmpp FROM submissions WHERE config = ? ORDER
BY kmpp ASC LIMIT 10', (cname,))
+ rows = c.execute('SELECT kmpp FROM submissions WHERE config = ? AND
kmpp > 0 ORDER BY kmpp ASC LIMIT 10', (cname,))
rows = list(rows)
- kmpplimit = float(rows[-1][0])
- out.write('%s:kmppSendThreshold:%f' % (cname, kmpplimit))
+ if rows and (len(rows) == 10):
+ kmpplimit = float(rows[-1][0])
+ out.write('%s:kmppSendThreshold:%f' % (cname, kmpplimit))
+ else:
+ logging.warn('%s count=%s but fetched %s', cname,
bestconfigs[cname]['count'], len(rows))
# TODO: tweak spreadSendThreshold automatically ?
mpath = outpath + '_manual'
if os.path.exists(mpath):

Reply all
Reply to author
Forward
0 new messages