[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[freehaven-cvs] Commit analysis tweaks used in pynchon gate paper



Update of /home/freehaven/cvsroot/doc/e2e-traffic/src
In directory moria.mit.edu:/tmp/cvs-serv1640/e2e-traffic/src

Modified Files:
	analyze.py 
Log Message:
Commit analysis tweaks used in pynchon gate paper

Index: analyze.py
===================================================================
RCS file: /home/freehaven/cvsroot/doc/e2e-traffic/src/analyze.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- analyze.py	1 May 2004 01:59:32 -0000	1.11
+++ analyze.py	28 Sep 2004 17:06:10 -0000	1.12
@@ -74,6 +74,23 @@
     def getPMsg(self):
         return self.p[3]/100.0
 
+class NymTrialParams(Params):
+    def __init__(self,**test):
+        self.p = (test['N'],
+                  test['l'],
+                  int(test['pA']*100),
+                  int(test['pD']*100),
+                  test['bgVol'],
+                  int(test['pObs']*100))
+    def disp(self):
+        N,l,pA,pD,bgV,pO=self.p
+        return ("N:%5d l:%1d pA:%2s%% pD:%2s%% bg:%5d pOb:%2d%%"
+                %(N,l,pA,pD,bgV,pO))
+    def getM(self):
+        return 1
+    def getPMsg(self):
+        return self.p[2]/100.0
+
 def kwdict(**kw): return kw
 def pct(x):
     return int(x*100)
@@ -129,10 +146,12 @@
     SCOPE = { 'MixTrial' : MixTrialParams,
               'UnkBGBatchTrial' : UnkBGParams,
               'SDTrial' : SDParams,
+              'NymTrial' : NymTrialParams,
               'Result' : kwdict }
     def __init__(self):
         self.nTrials = {}
         self.nSuccess = {}
+        self.nSent = {}
         self.nRounds = {}
         self.nRoundsAlice = {}
         self.nGuessed = {}
@@ -146,6 +165,7 @@
 
         nTrials = self.nTrials
         nSuccess = self.nSuccess
+        nSent = self.nSent
         nRounds = self.nRounds
         nRoundsAlice = self.nRoundsAlice
         nGuessed = self.nGuessed
@@ -177,6 +197,7 @@
                 except KeyError:
                     nTrials[params]=1
                     nSuccess[params]=0
+                    nSent[params]=0
                     nRounds[params]=0
                     nRoundsAlice[params]=0
                     nGuessed[params]=0
@@ -186,6 +207,7 @@
                     nSuccess[params] += 1
                     nRounds[params] += result['rounds']
                     nRoundsAlice[params] += result['roundsWithAlice']
+                    nSent[params] += result['msgsFromAlice']
                 nGuessed[params] += len(result['nRoundsToGuessNth'])-1
                 nRoundsToGuessN[params].addResult(result['nRoundsToGuessNth'])
                 #i += 1
@@ -206,17 +228,19 @@
             if self.nSuccess[p]:
                 avgR = self.nRounds[p]/float(self.nSuccess[p])
                 avgRA = self.nRoundsAlice[p]/float(self.nSuccess[p])
+                avgSent = self.nSent[p]/float(self.nSuccess[p])
             else:
                 avgR = 5000000
                 avgRA = (5000000*p.getPMsg())//100
+                avgSent = 5000000
 
             pG = self.nGuessed[p]/(fT*p.getM())
             dp = p.disp()
 
             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)),
+            print ("%s | N:%3d succ:%3s%% guess:%3s%% rnds:%7d rndsA:%7s sentA:%5d"
+                   %(dp, nT, int(pS*100), int(pG*100), avgR, avgRA,avgSent)),
 
             N_NAMES=7
             names = ["1st","1_2","3_4", "7_8", None, "but1", "all"]

***********************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe freehaven-cvs       in the body. http://freehaven.net/