[or-cvs] r15810: Changed the way the pareto curve is shifted; now the scale ( (torflow/branches/gsoc2008/tools/BTAnalysis)

fallon at seul.org fallon at seul.org
Wed Jul 9 17:49:52 UTC 2008


Author: fallon
Date: 2008-07-09 13:49:51 -0400 (Wed, 09 Jul 2008)
New Revision: 15810

Modified:
   torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py
Log:
Changed the way the pareto curve is shifted; now the scale (at least for resolutions close to 100) looks better, but the shape is still off.


Modified: torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py
===================================================================
--- torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py	2008-07-09 16:41:14 UTC (rev 15809)
+++ torflow/branches/gsoc2008/tools/BTAnalysis/shufflebt.py	2008-07-09 17:49:51 UTC (rev 15810)
@@ -83,6 +83,7 @@
   def paretoK(self, Xm):
     n = 0
     log_sum = 0
+    X = min(self.values)
     for x in self.values:
       if x < Xm: continue
       n += 1
@@ -136,7 +137,7 @@
 def pareto(k,Xm,N,fname):
   # gnuplot string for shifted, normalized exponential PDF
   # g(x,k,B) = (N * k*(Xm**k)/x**(k+1)))
-  ps = fname+'(x)=(x<'+str(Xm)+') ? 0 : ('+str(N*k*(Xm**k))+'/x**('+str(k+1)+'))\n'
+  ps = fname+'(x)=(x<='+str(Xm)+') ? 0 : (('+str((N*k)*(Xm**k))+')/(x-'+str(Xm)+ ')**('+str(k+1)+'))\n'
   #ps = fname+'(x)='+str(N*k*(Xm**k))+'/x**('+str(k+1)+')\n'
   return ps
 
@@ -288,7 +289,8 @@
     print 'Resolution of histogram:',res,'ms'
     print 'Mean: '+str(mean)+', mode: '+str(mode)
     print 'ParK: '+str(parK)
-  
+    print 'ModeN',modeN 
+    print '#successful runs:',len(s.values)
     # get stats
   
     if graph:
@@ -300,7 +302,7 @@
       ncircuits = str(len(s.values))
     
       xtics =  max(s.values) / 10.0
-      plotstr = "set terminal png transparent nocrop enhanced size 800,600\nset output '" + histfilename + ".png'\nset style fill  solid 1.00 border -1\nset style histogram clustered gap 1 title  offset character 0, 0, 0\nset datafile missing '-'\nset title 'Buildtime Distribution Function for "+ ncircuits +" Circuits k=" + str(k) + "\nset ylabel '# Circuits'\nset xlabel 'time (ms)'\nset xtics " + str(xtics) + " \n"
+      plotstr = "set terminal png transparent nocrop enhanced size 800,600\nset output '" + histfilename + ".png'\nset style fill  solid 1.00 border -1\nset style histogram clustered gap 1 title  offset character 0, 0, 0\nset datafile missing '-'\nset title 'Buildtime Distribution Function for "+ ncircuits +" Circuits k=" + str(parK) + "\nset ylabel '# Circuits'\nset xlabel 'time (ms)'\nset xtics " + str(xtics) + " \n"
       plotstr += "set label 'std dev=" + str(stddev) + "' at 25000,100\n"
     
       # FIXME: Hrmm... http://en.wikipedia.org/wiki/Skewness? Seems like a hack
@@ -326,7 +328,7 @@
     #  plotstr += gamma(k,baytheta[0],N,'bayplus') # + stddev
     #  plotstr += gamma(k,baytheta[1],N,'bayminus') # - stddev
     
-      plotstr += pareto(parK,mode,modeN*10,'pareto')
+      plotstr += pareto(parK,mode,modeN,'pareto')
       plotstr += exp(modeMean*10,mode*10,modeN,'expShifted')
 
       #plotstr += pareto(parK,mode*10,modeN,'pareto')
@@ -334,8 +336,8 @@
    #   plotstr += "plot '" + newfile + ".hist' using 2,\\\n"
       plotstr += "plot '" + histfilename + ".hist' using 1:2 with boxes,\\\n"
     
-      plotstr += "pareto(x) title '" + "Shifted Pareto', \\\n"
-      plotstr += "expShifted(x) title '" + "Shifted Exp' \n"
+      plotstr += "pareto(x) title '" + "Shifted Pareto' \\\n"
+      #plotstr += "expShifted(x) title '" + "Shifted Exp' \n"
     
     
       f = open(plotname,'w')



More information about the tor-commits mailing list