Index: python/test/bench/onset/bench-delay
===================================================================
--- python/test/bench/onset/bench-delay	(revision a12563ea14df2b47881bd064768536f225683b0b)
+++ python/test/bench/onset/bench-delay	(revision 6ae3a77f49a78ea78a4dca71a42ac2da5768fa3d)
@@ -1,5 +1,4 @@
 #! /usr/bin/python
 
-from aubio.bench.node import *
 from aubio.tasks import *
 
@@ -10,42 +9,33 @@
 	def run_bench(self,modes=['dual'],thresholds=[0.5]):
 		from os.path import dirname,basename
-		self.modes = modes
 		self.thresholds = thresholds
 		self.pretty_titles()
-		for mode in self.modes:
+
+		for mode in modes:
 			d = []
-			outplot = "_-_".join(("delay",mode,
-				basename(self.datadir) ))
-
 			self.params.onsetmode = mode
+			self.params.localmin = True
+			self.params.delay = 1. 
 			self.params.threshold = thresholds[0]
-
+			#
 			self.params.localmin = False 
 			self.params.delay = 0. 
-
-			self.dir_exec()
-			self.dir_eval()
-			self.pretty_print()
+			self.dir_eval_print()
 			self.plotdiffs(d,plottitle="Causal")
-
+			#
 			self.params.localmin = True
 			self.params.delay = 0. 
-			self.dir_exec()
-			self.dir_eval()
-			self.pretty_print()
+			self.dir_eval_print()
 			self.plotdiffs(d,plottitle="Local min")
 
 			self.params.localmin = False 
 			self.params.delay = 6. 
-			self.dir_exec()
-			self.dir_eval()
-			self.pretty_print()
+			self.dir_eval_print()
 			self.plotdiffs(d,plottitle="Fixed delay")
 
-			self.plotplotdiffs(d)
-			self.plotplotdiffs(d,outplot=outplot,extension="png")
-			self.plotplotdiffs(d,outplot=outplot,extension="ps")
-			self.plotplotdiffs(d,outplot=outplot,extension="svg")
-
+			#self.plotplotdiffs(d)
+			outplot = "_-_".join(("delay",mode,basename(self.datadir) ))
+			for ext in ("png","svg","ps"):
+				self.plotplotdiffs(d,outplot=outplot,extension=ext)
 
 if __name__ == "__main__":
@@ -53,8 +43,8 @@
 	if len(sys.argv) > 1: datapath = sys.argv[1]
 	else: print "ERR: a path is required"; sys.exit(1)
-	modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
-	#modes = [ 'complex' ]
-	thresholds = [ 0.5]
-	#thresholds = [1.5]
+	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
+	#thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
+	#modes = [ 'hfc' ]
+	thresholds = [0.5]
 
 	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
Index: python/test/bench/onset/bench-onset
===================================================================
--- python/test/bench/onset/bench-onset	(revision a12563ea14df2b47881bd064768536f225683b0b)
+++ python/test/bench/onset/bench-onset	(revision 6ae3a77f49a78ea78a4dca71a42ac2da5768fa3d)
@@ -11,19 +11,26 @@
 		self.thresholds = thresholds
 		self.pretty_titles()
-		d,e,f = [],[],[]
+		d,e,f,g = [],[],[],[]
 		for mode in modes:
 			self.vlist = []
 			self.params.onsetmode = mode
+			#self.params.localmin = True
+			self.params.delay = 2. 
+			self.params.bufsize = 1024 
+			self.params.hopsize = 256
+			self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
+			#self.params.mintol = 8. 
+
 			for threshold in self.thresholds:
 				self.params.threshold = threshold
-				self.dir_exec()
-				self.dir_eval()
-				self.pretty_print()
-				#print self.v
+				self.dir_eval_print()
 				self.vlist.append(self.v)
 			self.plotroc(d)
 			self.plotfmeas(e)
 			self.plotpr(f)
-			#print vlist
+			#self.plothistcat(g)
+
+
+
 		#self.plotplotroc(d)
 		#self.plotplotfmeas(e)
@@ -34,91 +41,5 @@
 			self.plotplotfmeas(e,outplot=outplot,extension=ext)
 			self.plotplotpr(f,outplot=outplot,extension=ext)
-
-
-	def auto_learn(self,modes=['dual'],thresholds=[0.1,1.5]):
-		""" simple dichotomia like algorithm to optimise threshold """
-		self.modes = modes
-		self.pretty_titles()
-		for mode in self.modes:
-			steps = 11 
-			lesst = thresholds[0] 
-			topt = thresholds[1]
-			self.params.onsetmode = mode
-
-			self.params.threshold = topt 
-			self.dir_exec()
-			self.dir_eval()
-			self.pretty_print()
-			topF = self.F 
-
-			self.params.threshold = lesst 
-			self.dir_exec()
-			self.dir_eval()
-			self.pretty_print()
-			lessF = self.F 
-
-			for i in range(steps):
-				self.params.localmin = True
-				self.params.delay = 1. 
-				self.dir_exec()
-				self.dir_eval()
-				self.params.threshold = ( lesst + topt ) * .5 
-				self.dir_exec()
-				self.dir_eval()
-				self.pretty_print()
-				if self.F == 100.0 or self.F == topF: 
-					print "assuming we converged, stopping" 
-					break
-				#elif abs(self.F - topF) < 0.01 :
-				#	print "done converging"
-				#	break
-				if topF < self.F:
-					#lessF = topF
-					#lesst = topt 
-					topF = self.F
-					topt = self.params.threshold
-				elif lessF < self.F:
-					lessF = self.F
-					lesst = self.params.threshold
-				if topt == lesst:
-					lesst /= 2.
-
-	def auto_learn2(self,modes=['dual'],thresholds=[0.00001,1.0]):
-		""" simple dichotomia like algorithm to optimise threshold """
-		self.modes = modes
-		self.pretty_titles([])
-		for mode in self.modes:
-			steps = 10 
-			step = 0.4
-			self.params.onsetmode = mode
-			self.params.threshold = thresholds[0] 
-			cur = 0
-
-			for i in range(steps):
-				self.dir_exec()
-				self.dir_eval()
-				self.pretty_print()
-				new = self.P
-				if self.R == 0.0:
-					#print "Found maximum, highering"
-					step /= 2.
-					self.params.threshold -= step 
-				elif new == 100.0:
-					#print "Found maximum, highering"
-					step *= .99
-					self.params.threshold += step 
-				elif cur > new:
-					#print "lower"
-					step /= 2.
-					self.params.threshold -= step 
-				elif cur < new:
-					#print "higher"
-					step *= .99
-					self.params.threshold += step 
-				else:
-					print "Assuming we converged"
-					break
-				cur = new
-
+			#self.plotplothistcat(g,outplot=outplot,extension=ext)
 
 if __name__ == "__main__":
@@ -129,5 +50,5 @@
 	thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
 	#modes = [ 'hfc' ]
-	#thresholds = [0.1, 1.5]
+	#thresholds = [0.5]
 
 	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
Index: python/test/bench/onset/bench-window
===================================================================
--- python/test/bench/onset/bench-window	(revision a12563ea14df2b47881bd064768536f225683b0b)
+++ python/test/bench/onset/bench-window	(revision 6ae3a77f49a78ea78a4dca71a42ac2da5768fa3d)
@@ -3,5 +3,5 @@
 from aubio.tasks import *
 
-from benchonset import mmean, stdev, plotdiffs, plotplotdiffs, benchonset
+from benchonset import mmean, stdev, benchonset
 
 class mybenchonset(benchonset):
@@ -11,16 +11,16 @@
 		self.thresholds = thresholds
 		self.pretty_titles()
+
 		for mode in modes:
 
 			self.params.onsetmode = mode
+			self.params.localmin = True
+			self.params.delay = 1. 
 			self.params.threshold = thresholds[0]
 			self.params.localmin = False 
-
+			#
 			for delay in (0., 4.):
 				d = []
-				outplot = "_-_".join(("window",mode,"delay-%s" % delay,
-					basename(self.datadir) ))
 				self.params.delay = delay 
-
 				for buf in (2048, 1024, 512):
 					for hop in (buf/2, buf/4):
@@ -28,15 +28,11 @@
 						self.params.hopsize = hop 
 						self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
-
-						self.dir_exec()
-						self.dir_eval()
-						self.pretty_print()
-						plotdiffs(self.v,d,plottitle="%s %s" % (buf,hop))
-
-				plotplotdiffs(d)
-				plotplotdiffs(d,outplot=outplot,extension="png")
-				plotplotdiffs(d,outplot=outplot,extension="ps")
-				plotplotdiffs(d,outplot=outplot,extension="svg")
-
+						self.dir_eval_print()
+						self.plotdiffs(d,plottitle="%s %s" % (buf,hop))
+				#plotplotdiffs(d)
+				outplot = "_-_".join(("window",mode,"delay-%s" % int(delay),
+					basename(self.datadir) ))
+				for ext in ("png","svg","ps"):
+					self.plotplotdiffs(d,outplot=outplot,extension=ext)
 
 if __name__ == "__main__":
@@ -44,8 +40,8 @@
 	if len(sys.argv) > 1: datapath = sys.argv[1]
 	else: print "ERR: a path is required"; sys.exit(1)
-	modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
-	#modes = [ 'complex' ]
-	thresholds = [ 0.5]
-	#thresholds = [1.5]
+	modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
+	#thresholds = [ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2]
+	#modes = [ 'hfc' ]
+	thresholds = [0.5]
 
 	#datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
Index: python/test/bench/onset/benchonset.py
===================================================================
--- python/test/bench/onset/benchonset.py	(revision a12563ea14df2b47881bd064768536f225683b0b)
+++ python/test/bench/onset/benchonset.py	(revision 6ae3a77f49a78ea78a4dca71a42ac2da5768fa3d)
@@ -47,4 +47,8 @@
 		v['mode']      = self.params.onsetmode
 		v['thres']     = self.params.threshold 
+		v['bufsize']   = self.params.bufsize
+		v['hopsize']   = self.params.hopsize
+		v['silence']   = self.params.silence
+		v['mintol']   = self.params.mintol
 
 		v['Torig']     = sum(v['orig'])
@@ -95,4 +99,9 @@
 		self.v['recl']      = self.R
 
+
+	"""
+	Plot functions 
+	"""
+
 	def plotroc(self,d,plottitle=""):
 		import Gnuplot, Gnuplot.funcutils
@@ -188,4 +197,31 @@
 		#g('set key 27,65')
 		#g('set format \"%g\"')
+		g.plot(*d)
+
+	def plotfmeasvar(self,d,var,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		x,y = [],[]
+		for i in self.vlist:
+			x.append(i[var]) 
+			y.append(i['dist']) 
+		d.append(Gnuplot.Data(x, y, with='linespoints', 
+			title="%s %s" % (plottitle,i['mode']) ))
+	
+	def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  terminal = 'postscript'
+			elif extension == 'png': terminal = 'png'
+			elif extension == 'svg': terminal = 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % terminal)
+			g('set output \'fmeas-%s.%s\'' % (outplot,extension))
+		g.xlabel(var)
+		g.ylabel('F-measure (%)')
+		#g('set xrange [0:1.2]')
+		g('set yrange [0:100]')
+		g.title(basename(self.datadir))
 		g.plot(*d)
 
@@ -230,6 +266,37 @@
 		g.ylabel('% number of correct detections / ms ')
 		g('set xrange [-0.05:0.05]')
-		g('set yrange [0:50]')
-		g.plot(*d)
-
-
+		g('set yrange [0:20]')
+		g.plot(*d)
+
+
+	def plothistcat(self,d,plottitle=""):
+		import Gnuplot, Gnuplot.funcutils
+		total = v['Torig']
+		for i in range(len(per)): per[i] /= total/100.
+
+		d.append(Gnuplot.Data(val, per, with='fsteps', 
+			title="%s %s" % (plottitle,v['mode']) ))
+		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
+		#d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
+
+
+	def plotplothistcat(self,d,outplot=0,extension='ps'):
+		import Gnuplot, Gnuplot.funcutils
+		from sys import exit
+		g = Gnuplot.Gnuplot(debug=0, persist=1)
+		if outplot:
+			if   extension == 'ps':  ext, extension = '.ps' , 'postscript'
+			elif extension == 'png': ext, extension = '.png', 'png'
+			elif extension == 'svg': ext, extension = '.svg', 'svg'
+			else: exit("ERR: unknown plot extension")
+			g('set terminal %s' % extension)
+			g('set output \'diffhist-%s%s\'' % (outplot,ext))
+		g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))')
+		g.title(basename(self.datadir))
+		g.xlabel('delay to hand-labelled onset (s)')
+		g.ylabel('% number of correct detections / ms ')
+		g('set xrange [-0.05:0.05]')
+		g('set yrange [0:20]')
+		g.plot(*d)
+
+
