[or-cvs] r15340: 100ms timeslice properly factored into theta estimators (torflow/branches/gsoc2008/tools/BTAnalysis)

fallon at seul.org fallon at seul.org
Tue Jun 17 21:19:59 UTC 2008


Author: fallon
Date: 2008-06-17 17:19:58 -0400 (Tue, 17 Jun 2008)
New Revision: 15340

Modified:
   torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py
Log:
100ms timeslice properly factored into theta estimators



Modified: torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py
===================================================================
--- torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py	2008-06-17 20:57:54 UTC (rev 15339)
+++ torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py	2008-06-17 21:19:58 UTC (rev 15340)
@@ -67,7 +67,7 @@
       if v < res * i: count += 1
       else:
         count += 1
-        self.buckets[res * i] = count
+        self.buckets[int(res * i * 10)] = count
         i += 1
         count = 0
     f = open(histname,'w')
@@ -83,13 +83,13 @@
     # theta estimator for gamma PDF
     # maxlikelihood estimator
     # theta = sum(values) / N*k 
-     return sum(self.values)/(k * len(self.values)) 
+     return sum(self.values * 10)/(k * len(self.values)) 
 
   def bayesian(self,k):
     # bayesian estimator for gamma PDF
     # y = sum(values)
     # theta = y/(Nk - 1) +/- y^2/((Nk-1)^2(Nk -2))
-    y = sum(self.values)
+    y = sum(self.values) * 10
     N = len(self.values)
     mean = y/(N*k - 1)
     sdev = (y*y)/((N*k - 1)* (N*k - 1) * (N*k - 2))
@@ -158,7 +158,7 @@
   print 'Shuffling...',
 
   newfile = dirname + '/' + filename + '.' + ncircuits 
-  cmd = 'sort -R ' + filename + ' | head -n ' + ncircuits  + ' > ' + newfile
+  cmd = '/usr/local/bin/sort -R ' + filename + ' | head -n ' + ncircuits  + ' > ' + newfile
 
   p = popen2.Popen4(cmd)
   p.wait()
@@ -197,7 +197,8 @@
 
   #FIX? Other potential values of N: #circuits that match mode? median? mean?
   #print 'Mean:',mean,'Median:', median,'Mode:', mode
-  #i = float("%3.1f" % mean) # crappy way of rounding
+  #i = float("%3.0f" % int(mean * 10)) # crappy way of rounding
+  #i = int(mode * 10)
   #N = s.buckets[i]            # num. circuits that have buildtimes 
                               #close to mean/median/mode from histogram 
 
@@ -220,7 +221,8 @@
 
   # plot the file
   print 'Plotting...',
-  p = popen2.Popen4('gnuplot ' + plotname)
+#  p = popen2.Popen4('gnuplot ' + plotname)
+  p = popen2.Popen4('gp4.2 ' + plotname)
 
   p.wait()
   for err in p.fromchild:



More information about the tor-commits mailing list