[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[freehaven-cvs] Update analysis/processing scripts
Update of /home/freehaven/cvsroot/doc/e2e-traffic/src
In directory moria.mit.edu:/tmp/cvs-serv11483/src
Modified Files:
analyze.py postproc.py
Added Files:
combine.py
Log Message:
Update analysis/processing scripts
--- NEW FILE: combine.py ---
#!/usr/bin/python2.3
import sys
f1 = sys.argv[1]
f2 = sys.argv[2]
data = {}
lineno = 1
for line in open(f1,'r'):
lineno += 1
k,v = line.split("|")
data[k] = (lineno, k, v)
for line in open(f2,'r'):
lineno += 1
k,v = line.split("|")
if data.has_key(k):
data[k]=(data[k][0],k,v)
else:
data[k] = (lineno,k,v)
lines = data.values()
lines.sort()
for _,k,v in lines:
if v.endswith("\n"): v = v[:-1]
print "%s|%s"%(k,v)
Index: analyze.py
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/analyze.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- analyze.py 22 Jan 2004 02:55:02 -0000 1.5
+++ analyze.py 22 Jan 2004 03:52:25 -0000 1.6
@@ -39,9 +39,9 @@
return 1.0
class UnkBGParams(Params):
- STRATEGIES = {"uniform-geometric":"UG",
- "smallworld-geometric":"SG",
- "smallworld-geometric-weighted":"SGW"}
+ STRATEGIES = {"uniform-geometric":"UU",
+ "smallworld-geometric":"BU",
+ "smallworld-geometric-weighted":"BB"}
def __init__(self,**test):
self.p = (test['b'],test['N'],test['m'],int(test['pMessage']*100),
self.STRATEGIES[test['aliceStrategy']])
@@ -59,13 +59,16 @@
test['m'],
test['l'],
int(test['pMessage']*100),
+ int(test['pDummy']*100),
int(test['pDelay']*100),
test['bgVolume'],
+ test['pading'], #Yes, it's misspelled. :/
+ int(test['pOnline']*100),
int(test['pObserve']*100))
def disp(self):
- N,m,l,pA,pD,bgV,pO=self.p
- return ("N:%5d m:%3d l:%1d pA:%2s%% pD:%2s%% bg:%5d pO:%2d%%"
- %(N,m,l,pA,pD,bgV,pO))
+ N,m,l,pA,pJ,pD,bgV,pad,pOn,pO=self.p
+ return ("N:%5d m:%3d l:%1d pA:%2s%% pJ:%2s%% pD:%2s%% bg:%5d pl:%d pOn:%d%% pOb:%2d%%"
+ %(N,m,l,pA,pJ,pD,bgV,pad,pOn,pO))
def getM(self):
return self.p[1]
def getPMsg(self):
@@ -92,12 +95,18 @@
(3, (M*15)//16),
(4, M-1),
(5, M) ]
+ self.nGuessedAtRoundN = {}
def addResult(self,res):
got=len(res)-1
self.items += 1
for idx, pos in self.positions:
if got>=pos:
self.lst[idx].append(res[pos])
+ for r in res[1:]:
+ try:
+ self.nGuessedAtRoundN[r] += 1
+ except KeyError:
+ self.nGuessedAtRoundN[r] = 1
def getPercentile(self,pctile):
r = []
p = int(math.ceil(self.items * (pctile/100.0)))
@@ -194,8 +203,6 @@
nrtgn = self.nRoundsToGuessN[p]
-
-
print ("%s | N:%3d succ:%3s%% guess:%3s%% rnds:%7d rndsA:%7s"
%(dp, nT, int(pS*100), int(pG*100), avgR, avgRA)),
Index: postproc.py
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/postproc.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- postproc.py 17 Jan 2004 22:21:19 -0000 1.2
+++ postproc.py 22 Jan 2004 03:52:25 -0000 1.3
@@ -9,7 +9,7 @@
except ValueError:
return s
-def pp(fn, xvar, yvar, gvars):
+def pp(fn, fixed, xvar, yvar, gvars):
f = open(fn, 'r')
data = {}
for line in f.xreadlines():
@@ -21,6 +21,9 @@
for item in items:
c = item.split(":")
if len(c) == 2:
+ if fixed.has_key(c[0]):
+ if fixed[c[0]] != c[1]:
+ continue
if c[0] == xvar and xval is None:
xval = float(c[1])
elif c[0] == yvar:
@@ -48,6 +51,11 @@
if __name__ == '__main__':
import sys
fn = sys.argv[1]
+ fixed = {}
+ while "=" in sys.argv[2]:
+ k,v= sys.argv[2].split("=")
+ fixed[k]=v
+ del sys.argv[2]
xv = sys.argv[2]
yv = sys.argv[3]
gv = sys.argv[4:]
@@ -55,4 +63,4 @@
print "# x variable:",xv
print "# y variable:",yv
print "# grouped by:",gv
- pp(fn,xv,yv,gv)
+ pp(fn,fixed,xv,yv,gv)
***********************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe freehaven-cvs in the body. http://freehaven.net/