History

added bench-window, bench-delay, benchonset added bench-window, bench-delay, benchonset

Paul Brossier committed 20 years ago

Commit 83c67341 parent 79c04d85 files · +425 −79Browse files

Showing the changes to python (5 of 5 files). Show all

Unified · Split

5 files
  1. python/test/bench/onset/Makefile.am +27 −7
  2. python/test/bench/onset/bench-delay +72 −0
  3. python/test/bench/onset/bench-onset +28 −72
  4. python/test/bench/onset/bench-window +63 −0
  5. python/test/bench/onset/benchonset.py +235 −0
python/test/bench/onset/Makefile.am+27−7
@@ -2,22 +2,42 @@ export BASEDIR=../../../.. · 1 unmodified line
22 export PYTHONPATH=$(BASEDIR)/python
33 export LD_LIBRARY_PATH=$(BASEDIR)/src/.libs:$(BASEDIR)/ext/.libs
44
5−SOURCE = \
6− /archives/samples/DB/PercussivePhrases/CM18/Samba_Audio \
5+DETAILSOURCE = \
76 /var/tmp/Onset-Mirex2005/poly_pitched \
87 /var/tmp/Onset-Mirex2005/solo_bars_and_bells \
9− /var/tmp/Onset-Mirex2005/solo_brass \
108 /var/tmp/Onset-Mirex2005/solo_drums \
119 /var/tmp/Onset-Mirex2005/solo_plucked_strings \
1210 /var/tmp/Onset-Mirex2005/solo_singing_voice \
1311 /var/tmp/Onset-Mirex2005/solo_sustained_strings \
1412 /var/tmp/Onset-Mirex2005/solo_winds \
15− /var/tmp/Onset-Mirex2005/complex \
16− /var/tmp/Onset-Mirex2005
13+ /var/tmp/Onset-Mirex2005/complex
1714
18−test-aubiocut: $(patsubst %, %.aubiocut, $(SOURCE))
15+SOURCE = /var/tmp/Onset-Mirex2005
16+
17+TESTSOURCE = \
18+ /var/tmp/Onset-Mirex2005/solo_bars_and_bells \
19+ /var/tmp/Onset-Mirex2005/solo_winds \
20+ /archives/samples/DB/PercussivePhrases/CM18/Samba_Audio
21+
22+test-aubiocut: $(patsubst %, %.aubiocut, $(TESTSOURCE))
23+test-aubiodelay: $(patsubst %, %.aubiodelay, $(TESTSOURCE))
24+test-aubiowindow: $(patsubst %, %.aubiowindow, $(TESTSOURCE))
25+
26+final-aubiocut: $(patsubst %, %.aubiocut, $(DETAILSOURCE) $(SOURCE))
27+final-aubiodelay: $(patsubst %, %.aubiodelay, $(SOURCE))
28+final-aubiowindow: $(patsubst %, %.aubiowindow, $(SOURCE))
1929
2030 %.aubiocut: %
2131 rm -f `basename $<`.aubiocut
2232 ./bench-onset $< | tee `basename $<`.aubiocut
23− diff `basename $<`.aubiocut.ref `basename $<`.aubiocut
33+ -diff `basename $<`.aubiocut.ref `basename $<`.aubiocut
34+
35+%.aubiodelay: %
36+ rm -f `basename $@`
37+ ./bench-delay $< | tee `basename $@`
38+ -diff `basename $@`.ref `basename $@`
39+
40+%.aubiowindow: %
41+ rm -f `basename $@`
42+ ./bench-window $< | tee `basename $@`
43+ -diff `basename $@`.ref `basename $@`
python/test/bench/onset/bench-delay+72−0
@@ -0,0 +1,72 @@
1+#! /usr/bin/python
2+
3+from aubio.bench.node import *
4+from aubio.tasks import *
5+
6+from benchonset import mmean, stdev, benchonset
7+
8+class mybenchonset(benchonset):
9+
10+ def run_bench(self,modes=['dual'],thresholds=[0.5]):
11+ from os.path import dirname,basename
12+ self.modes = modes
13+ self.thresholds = thresholds
14+ self.pretty_titles()
15+ for mode in self.modes:
16+ d = []
17+ outplot = "_-_".join(("delay",mode,
18+ basename(self.datadir) ))
19+
20+ self.params.onsetmode = mode
21+ self.params.threshold = thresholds[0]
22+
23+ self.params.localmin = False
24+ self.params.delay = 0.
25+
26+ self.dir_exec()
27+ self.dir_eval()
28+ self.pretty_print()
29+ self.plotdiffs(d,plottitle="Causal")
30+
31+ self.params.localmin = True
32+ self.params.delay = 0.
33+ self.dir_exec()
34+ self.dir_eval()
35+ self.pretty_print()
36+ self.plotdiffs(d,plottitle="Local min")
37+
38+ self.params.localmin = False
39+ self.params.delay = 6.
40+ self.dir_exec()
41+ self.dir_eval()
42+ self.pretty_print()
43+ self.plotdiffs(d,plottitle="Fixed delay")
44+
45+ self.plotplotdiffs(d)
46+ self.plotplotdiffs(d,outplot=outplot,extension="png")
47+ self.plotplotdiffs(d,outplot=outplot,extension="ps")
48+ self.plotplotdiffs(d,outplot=outplot,extension="svg")
49+
50+
51+if __name__ == "__main__":
52+ import sys
53+ if len(sys.argv) > 1: datapath = sys.argv[1]
54+ else: print "ERR: a path is required"; sys.exit(1)
55+ modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
56+ #modes = [ 'complex' ]
57+ thresholds = [ 0.5]
58+ #thresholds = [1.5]
59+
60+ #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
61+ respath = '/var/tmp/DB-testings'
62+
63+ benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
64+ benchonset.params = taskparams()
65+ benchonset.task = taskonset
66+ benchonset.valuesdict = {}
67+
68+ try:
69+ #benchonset.auto_learn2(modes=modes)
70+ benchonset.run_bench(modes=modes,thresholds=thresholds)
71+ except KeyboardInterrupt:
72+ sys.exit(1)
python/test/bench/onset/bench-onset+28−72
@@ -1,80 +1,18 @@
11 #! /usr/bin/python
22
3−from aubio.bench.node import *
43 from aubio.tasks import *
54
5+from benchonset import mmean, stdev, benchonset
66
7−
8−
9−def mmean(l):
10− return sum(l)/float(len(l))
11−
12−def stdev(l):
13− smean = 0
14− lmean = mmean(l)
15− for i in l:
16− smean += (i-lmean)**2
17− smean *= 1. / len(l)
18− return smean**.5
19−
20−class benchonset(bench):
21−
22− """ list of values to store per file """
23− valuenames = ['orig','missed','Tm','expc','bad','Td']
24− """ list of lists to store per file """
25− valuelists = ['l','labs']
26− """ list of values to print per dir """
27− printnames = [ 'mode', 'thres', 'dist', 'prec', 'recl',
28− 'Ttrue', 'Tfp', 'Tfn', 'Tm', 'Td',
29− 'aTtrue', 'aTfp', 'aTfn', 'aTm', 'aTd',
30− 'mean', 'smean', 'amean', 'samean']
31−
32− """ per dir """
33− formats = {'mode': "%12s" , 'thres': "%5.4s",
34− 'dist': "%5.4s", 'prec': "%5.4s", 'recl': "%5.4s",
35− 'Ttrue': "%5.4s", 'Tfp': "%5.4s", 'Tfn': "%5.4s",
36− 'Tm': "%5.4s", 'Td': "%5.4s",
37− 'aTtrue':"%5.4s", 'aTfp': "%5.4s", 'aTfn': "%5.4s",
38− 'aTm': "%5.4s", 'aTd': "%5.4s",
39− 'mean': "%5.40s", 'smean': "%5.40s",
40− 'amean': "%5.40s", 'samean': "%5.40s"}
41−
42− def dir_eval(self):
43− """ evaluate statistical data over the directory """
44− totaltrue = sum(self.v['expc'])-sum(self.v['bad'])-sum(self.v['Td'])
45− totalfp = sum(self.v['bad'])+sum(self.v['Td'])
46− totalfn = sum(self.v['missed'])+sum(self.v['Tm'])
47− self.P = 100*float(totaltrue)/max(totaltrue + totalfp,1)
48− self.R = 100*float(totaltrue)/max(totaltrue + totalfn,1)
49− if self.R < 0: self.R = 0
50− self.F = 2.* self.P*self.R / max(float(self.P+self.R),1)
51− N = float(len(self.reslist))
52− self.v['mode'] = self.params.onsetmode
53− self.v['thres'] = self.params.threshold
54− self.v['thres'] = "%2.3f" % self.params.threshold
55− self.v['dist'] = "%2.3f" % self.F
56− self.v['prec'] = "%2.3f" % self.P
57− self.v['recl'] = "%2.3f" % self.R
58− self.v['Ttrue'] = totaltrue
59− self.v['Tfp'] = totalfp
60− self.v['Tfn'] = totalfn
61− self.v['aTtrue'] = totaltrue/N
62− self.v['aTfp'] = totalfp/N
63− self.v['aTfn'] = totalfn/N
64− self.v['aTm'] = sum(self.v['Tm'])/N
65− self.v['aTd'] = sum(self.v['Td'])/N
66− self.v['Tm'] = sum(self.v['Tm'])
67− self.v['Td'] = sum(self.v['Td'])
68− self.v['mean'] = mmean(self.v['l'])
69− self.v['smean'] = stdev(self.v['l'])
70− self.v['amean'] = mmean(self.v['labs'])
71− self.v['samean'] = stdev(self.v['labs'])
7+class mybenchonset(benchonset):
728
739 def run_bench(self,modes=['dual'],thresholds=[0.5]):
74− self.modes = modes
10+ from os.path import dirname,basename
7511 self.thresholds = thresholds
7612 self.pretty_titles()
77− for mode in self.modes:
13+ d,e,f = [],[],[]
14+ for mode in modes:
15+ self.vlist = []
7816 self.params.onsetmode = mode
7917 for threshold in self.thresholds:
8018 self.params.threshold = threshold
@@ -82,6 +20,20 @@ class benchonset(bench): · 1 unmodified line
8220 self.dir_eval()
8321 self.pretty_print()
8422 #print self.v
23+ self.vlist.append(self.v)
24+ self.plotroc(d)
25+ self.plotfmeas(e)
26+ self.plotpr(f)
27+ #print vlist
28+ #self.plotplotroc(d)
29+ #self.plotplotfmeas(e)
30+ #self.plotplotpr(f)
31+ outplot = basename(self.datadir)
32+ for ext in ("png","svg","ps"):
33+ self.plotplotroc(d,outplot=outplot,extension=ext)
34+ self.plotplotfmeas(e,outplot=outplot,extension=ext)
35+ self.plotplotpr(f,outplot=outplot,extension=ext)
36+
8537
8638 def auto_learn(self,modes=['dual'],thresholds=[0.1,1.5]):
8739 """ simple dichotomia like algorithm to optimise threshold """
@@ -106,6 +58,10 @@ class benchonset(bench): · 18 unmodified lines
10658 lessF = self.F
10759
10860 for i in range(steps):
61+ self.params.localmin = True
62+ self.params.delay = 1.
63+ self.dir_exec()
64+ self.dir_eval()
10965 self.params.threshold = ( lesst + topt ) * .5
11066 self.dir_exec()
11167 self.dir_eval()
@@ -169,15 +125,15 @@ if __name__ == "__main__": · 57 unmodified lines
169125 import sys
170126 if len(sys.argv) > 1: datapath = sys.argv[1]
171127 else: print "ERR: a path is required"; sys.exit(1)
172− modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
173− #modes = [ 'mkl' ]
128+ modes = ['complex', 'energy', 'phase', 'hfc', 'specdiff', 'kl', 'mkl', 'dual']
174129 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]
175− #thresholds = [1.5]
130+ #modes = [ 'hfc' ]
131+ #thresholds = [0.1, 1.5]
176132
177133 #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
178134 respath = '/var/tmp/DB-testings'
179135
180− benchonset = benchonset(datapath,respath,checkres=True,checkanno=True)
136+ benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
181137 benchonset.params = taskparams()
182138 benchonset.task = taskonset
183139 benchonset.valuesdict = {}
python/test/bench/onset/bench-window+63−0
@@ -0,0 +1,63 @@
1+#! /usr/bin/python
2+
3+from aubio.tasks import *
4+
5+from benchonset import mmean, stdev, plotdiffs, plotplotdiffs, benchonset
6+
7+class mybenchonset(benchonset):
8+
9+ def run_bench(self,modes=['dual'],thresholds=[0.5]):
10+ from os.path import dirname,basename
11+ self.thresholds = thresholds
12+ self.pretty_titles()
13+ for mode in modes:
14+
15+ self.params.onsetmode = mode
16+ self.params.threshold = thresholds[0]
17+ self.params.localmin = False
18+
19+ for delay in (0., 4.):
20+ d = []
21+ outplot = "_-_".join(("window",mode,"delay-%s" % delay,
22+ basename(self.datadir) ))
23+ self.params.delay = delay
24+
25+ for buf in (2048, 1024, 512):
26+ for hop in (buf/2, buf/4):
27+ self.params.bufsize = buf
28+ self.params.hopsize = hop
29+ self.params.step = float(self.params.hopsize)/float(self.params.samplerate)
30+
31+ self.dir_exec()
32+ self.dir_eval()
33+ self.pretty_print()
34+ plotdiffs(self.v,d,plottitle="%s %s" % (buf,hop))
35+
36+ plotplotdiffs(d)
37+ plotplotdiffs(d,outplot=outplot,extension="png")
38+ plotplotdiffs(d,outplot=outplot,extension="ps")
39+ plotplotdiffs(d,outplot=outplot,extension="svg")
40+
41+
42+if __name__ == "__main__":
43+ import sys
44+ if len(sys.argv) > 1: datapath = sys.argv[1]
45+ else: print "ERR: a path is required"; sys.exit(1)
46+ modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
47+ #modes = [ 'complex' ]
48+ thresholds = [ 0.5]
49+ #thresholds = [1.5]
50+
51+ #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
52+ respath = '/var/tmp/DB-testings'
53+
54+ benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
55+ benchonset.params = taskparams()
56+ benchonset.task = taskonset
57+ benchonset.valuesdict = {}
58+
59+ try:
60+ #benchonset.auto_learn2(modes=modes)
61+ benchonset.run_bench(modes=modes,thresholds=thresholds)
62+ except KeyboardInterrupt:
63+ sys.exit(1)
python/test/bench/onset/benchonset.py+235−0
@@ -0,0 +1,235 @@
1+#! /usr/bin/python
2+
3+from aubio.bench.node import *
4+from os.path import dirname,basename
5+
6+def mmean(l):
7+ return sum(l)/max(float(len(l)),1)
8+
9+def stdev(l):
10+ smean = 0
11+ if not len(l): return smean
12+ lmean = mmean(l)
13+ for i in l:
14+ smean += (i-lmean)**2
15+ smean *= 1. / len(l)
16+ return smean**.5
17+
18+class benchonset(bench):
19+
20+ """ list of values to store per file """
21+ valuenames = ['orig','missed','Tm','expc','bad','Td']
22+ """ list of lists to store per file """
23+ valuelists = ['l','labs']
24+ """ list of values to print per dir """
25+ printnames = [ 'mode', 'thres', 'dist', 'prec', 'recl',
26+ 'GD', 'FP',
27+ 'Torig', 'Ttrue', 'Tfp', 'Tfn', 'TTm', 'TTd',
28+ 'aTtrue', 'aTfp', 'aTfn', 'aTm', 'aTd',
29+ 'mean', 'smean', 'amean', 'samean']
30+
31+ """ per dir """
32+ formats = {'mode': "%12s" , 'thres': "%5.4s",
33+ 'dist': "%5.4s", 'prec': "%5.4s", 'recl': "%5.4s",
34+ 'Torig': "%5.4s", 'Ttrue': "%5.4s", 'Tfp': "%5.4s", 'Tfn': "%5.4s",
35+ 'TTm': "%5.4s", 'TTd': "%5.4s",
36+ 'aTtrue':"%5.4s", 'aTfp': "%5.4s", 'aTfn': "%5.4s",
37+ 'aTm': "%5.4s", 'aTd': "%5.4s",
38+ 'mean': "%5.40s", 'smean': "%5.40s",
39+ 'amean': "%5.40s", 'samean': "%5.40s",
40+ "GD": "%5.4s", "FP": "%5.4s",
41+ "GDm": "%5.4s", "FPd": "%5.4s"}
42+
43+ def dir_eval(self):
44+ """ evaluate statistical data over the directory """
45+ v = self.v
46+
47+ v['mode'] = self.params.onsetmode
48+ v['thres'] = self.params.threshold
49+
50+ v['Torig'] = sum(v['orig'])
51+ v['TTm'] = sum(v['Tm'])
52+ v['TTd'] = sum(v['Td'])
53+ v['Texpc'] = sum(v['expc'])
54+ v['Tbad'] = sum(v['bad'])
55+ v['Tmissed'] = sum(v['missed'])
56+ v['aTm'] = mmean(v['Tm'])
57+ v['aTd'] = mmean(v['Td'])
58+
59+ v['mean'] = mmean(v['l'])
60+ v['smean'] = stdev(v['l'])
61+
62+ v['amean'] = mmean(v['labs'])
63+ v['samean'] = stdev(v['labs'])
64+
65+ # old type calculations
66+ # good detection rate
67+ v['GD'] = 100.*(v['Torig']-v['Tmissed']-v['TTm'])/v['Torig']
68+ # false positive rate
69+ v['FP'] = 100.*(v['Tbad']+v['TTd'])/v['Torig']
70+ # good detection counting merged detections as good
71+ v['GDm'] = 100.*(v['Torig']-v['Tmissed'])/v['Torig']
72+ # false positives counting doubled as good
73+ v['FPd'] = 100.*v['Tbad']/v['Torig']
74+
75+ # mirex type annotations
76+ totaltrue = v['Texpc']-v['Tbad']-v['TTd']
77+ totalfp = v['Tbad']+v['TTd']
78+ totalfn = v['Tmissed']+v['TTm']
79+ self.v['Ttrue'] = totaltrue
80+ self.v['Tfp'] = totalfp
81+ self.v['Tfn'] = totalfn
82+ # average over the number of annotation files
83+ N = float(len(self.reslist))
84+ self.v['aTtrue'] = totaltrue/N
85+ self.v['aTfp'] = totalfp/N
86+ self.v['aTfn'] = totalfn/N
87+
88+ # F-measure
89+ self.P = 100.*float(totaltrue)/max(totaltrue + totalfp,1)
90+ self.R = 100.*float(totaltrue)/max(totaltrue + totalfn,1)
91+ #if self.R < 0: self.R = 0
92+ self.F = 2.* self.P*self.R / max(float(self.P+self.R),1)
93+ self.v['dist'] = self.F
94+ self.v['prec'] = self.P
95+ self.v['recl'] = self.R
96+
97+ def plotroc(self,d,plottitle=""):
98+ import Gnuplot, Gnuplot.funcutils
99+ gd = []
100+ fp = []
101+ for i in self.vlist:
102+ gd.append(i['GD'])
103+ fp.append(i['FP'])
104+ d.append(Gnuplot.Data(fp, gd, with='linespoints',
105+ title="%s %s" % (plottitle,i['mode']) ))
106+
107+ def plotplotroc(self,d,outplot=0,extension='ps'):
108+ import Gnuplot, Gnuplot.funcutils
109+ from sys import exit
110+ g = Gnuplot.Gnuplot(debug=0, persist=1)
111+ if outplot:
112+ if extension == 'ps': ext, extension = '.ps' , 'postscript'
113+ elif extension == 'png': ext, extension = '.png', 'png'
114+ elif extension == 'svg': ext, extension = '.svg', 'svg'
115+ else: exit("ERR: unknown plot extension")
116+ g('set terminal %s' % extension)
117+ g('set output \'roc-%s%s\'' % (outplot,ext))
118+ xmax = 30 #max(fp)
119+ ymin = 50
120+ g('set xrange [0:%f]' % xmax)
121+ g('set yrange [%f:100]' % ymin)
122+ # grid set
123+ g('set grid')
124+ g('set xtics 0,5,%f' % xmax)
125+ g('set ytics %f,5,100' % ymin)
126+ g('set key 27,65')
127+ #g('set format \"%g\"')
128+ g.title(basename(self.datadir))
129+ g.xlabel('false positives (%)')
130+ g.ylabel('correct detections (%)')
131+ g.plot(*d)
132+
133+ def plotpr(self,d,plottitle=""):
134+ import Gnuplot, Gnuplot.funcutils
135+ x = []
136+ y = []
137+ for i in self.vlist:
138+ x.append(i['prec'])
139+ y.append(i['recl'])
140+ d.append(Gnuplot.Data(x, y, with='linespoints',
141+ title="%s %s" % (plottitle,i['mode']) ))
142+
143+ def plotplotpr(self,d,outplot=0,extension='ps'):
144+ import Gnuplot, Gnuplot.funcutils
145+ from sys import exit
146+ g = Gnuplot.Gnuplot(debug=0, persist=1)
147+ if outplot:
148+ if extension == 'ps': ext, extension = '.ps' , 'postscript'
149+ elif extension == 'png': ext, extension = '.png', 'png'
150+ elif extension == 'svg': ext, extension = '.svg', 'svg'
151+ else: exit("ERR: unknown plot extension")
152+ g('set terminal %s' % extension)
153+ g('set output \'pr-%s%s\'' % (outplot,ext))
154+ g.title(basename(self.datadir))
155+ g.xlabel('Recall (%)')
156+ g.ylabel('Precision (%)')
157+ g.plot(*d)
158+
159+ def plotfmeas(self,d,plottitle=""):
160+ import Gnuplot, Gnuplot.funcutils
161+ x,y = [],[]
162+ for i in self.vlist:
163+ x.append(i['thres'])
164+ y.append(i['dist'])
165+ d.append(Gnuplot.Data(x, y, with='linespoints',
166+ title="%s %s" % (plottitle,i['mode']) ))
167+
168+ def plotplotfmeas(self,d,outplot="",extension='ps', title="F-measure"):
169+ import Gnuplot, Gnuplot.funcutils
170+ from sys import exit
171+ g = Gnuplot.Gnuplot(debug=0, persist=1)
172+ if outplot:
173+ if extension == 'ps': terminal = 'postscript'
174+ elif extension == 'png': terminal = 'png'
175+ elif extension == 'svg': terminal = 'svg'
176+ else: exit("ERR: unknown plot extension")
177+ g('set terminal %s' % terminal)
178+ g('set output \'fmeas-%s.%s\'' % (outplot,extension))
179+ g.xlabel('threshold \\delta')
180+ g.ylabel('F-measure (%)')
181+ g('set xrange [0:1.2]')
182+ g('set yrange [0:100]')
183+ g.title(basename(self.datadir))
184+ # grid set
185+ #g('set grid')
186+ #g('set xtics 0,5,%f' % xmax)
187+ #g('set ytics %f,5,100' % ymin)
188+ #g('set key 27,65')
189+ #g('set format \"%g\"')
190+ g.plot(*d)
191+
192+ def plotdiffs(self,d,plottitle=""):
193+ import Gnuplot, Gnuplot.funcutils
194+ v = self.v
195+ l = v['l']
196+ mean = v['mean']
197+ smean = v['smean']
198+ amean = v['amean']
199+ samean = v['samean']
200+ val = []
201+ per = [0] * 100
202+ for i in range(0,100):
203+ val.append(i*.001-.05)
204+ for j in l:
205+ if abs(j-val[i]) <= 0.001:
206+ per[i] += 1
207+ total = v['Torig']
208+ for i in range(len(per)): per[i] /= total/100.
209+
210+ d.append(Gnuplot.Data(val, per, with='fsteps',
211+ title="%s %s" % (plottitle,v['mode']) ))
212+ #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean))
213+ #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean))
214+
215+
216+ def plotplotdiffs(self,d,outplot=0,extension='ps'):
217+ import Gnuplot, Gnuplot.funcutils
218+ from sys import exit
219+ g = Gnuplot.Gnuplot(debug=0, persist=1)
220+ if outplot:
221+ if extension == 'ps': ext, extension = '.ps' , 'postscript'
222+ elif extension == 'png': ext, extension = '.png', 'png'
223+ elif extension == 'svg': ext, extension = '.svg', 'svg'
224+ else: exit("ERR: unknown plot extension")
225+ g('set terminal %s' % extension)
226+ g('set output \'diffhist-%s%s\'' % (outplot,ext))
227+ g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))')
228+ g.title(basename(self.datadir))
229+ g.xlabel('delay to hand-labelled onset (s)')
230+ g.ylabel('% number of correct detections / ms ')
231+ g('set xrange [-0.05:0.05]')
232+ g('set yrange [0:50]')
233+ g.plot(*d)
234+
235+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t