Changeset 6ae3a77 for python/test/bench/onset/benchonset.py
- Timestamp:
- Feb 23, 2006, 3:23:30 AM (18 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- ee7b9da
- Parents:
- a12563ea
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/test/bench/onset/benchonset.py
ra12563ea r6ae3a77 47 47 v['mode'] = self.params.onsetmode 48 48 v['thres'] = self.params.threshold 49 v['bufsize'] = self.params.bufsize 50 v['hopsize'] = self.params.hopsize 51 v['silence'] = self.params.silence 52 v['mintol'] = self.params.mintol 49 53 50 54 v['Torig'] = sum(v['orig']) … … 95 99 self.v['recl'] = self.R 96 100 101 102 """ 103 Plot functions 104 """ 105 97 106 def plotroc(self,d,plottitle=""): 98 107 import Gnuplot, Gnuplot.funcutils … … 188 197 #g('set key 27,65') 189 198 #g('set format \"%g\"') 199 g.plot(*d) 200 201 def plotfmeasvar(self,d,var,plottitle=""): 202 import Gnuplot, Gnuplot.funcutils 203 x,y = [],[] 204 for i in self.vlist: 205 x.append(i[var]) 206 y.append(i['dist']) 207 d.append(Gnuplot.Data(x, y, with='linespoints', 208 title="%s %s" % (plottitle,i['mode']) )) 209 210 def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"): 211 import Gnuplot, Gnuplot.funcutils 212 from sys import exit 213 g = Gnuplot.Gnuplot(debug=0, persist=1) 214 if outplot: 215 if extension == 'ps': terminal = 'postscript' 216 elif extension == 'png': terminal = 'png' 217 elif extension == 'svg': terminal = 'svg' 218 else: exit("ERR: unknown plot extension") 219 g('set terminal %s' % terminal) 220 g('set output \'fmeas-%s.%s\'' % (outplot,extension)) 221 g.xlabel(var) 222 g.ylabel('F-measure (%)') 223 #g('set xrange [0:1.2]') 224 g('set yrange [0:100]') 225 g.title(basename(self.datadir)) 190 226 g.plot(*d) 191 227 … … 230 266 g.ylabel('% number of correct detections / ms ') 231 267 g('set xrange [-0.05:0.05]') 232 g('set yrange [0:50]') 233 g.plot(*d) 234 235 268 g('set yrange [0:20]') 269 g.plot(*d) 270 271 272 def plothistcat(self,d,plottitle=""): 273 import Gnuplot, Gnuplot.funcutils 274 total = v['Torig'] 275 for i in range(len(per)): per[i] /= total/100. 276 277 d.append(Gnuplot.Data(val, per, with='fsteps', 278 title="%s %s" % (plottitle,v['mode']) )) 279 #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean)) 280 #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean)) 281 282 283 def plotplothistcat(self,d,outplot=0,extension='ps'): 284 import Gnuplot, Gnuplot.funcutils 285 from sys import exit 286 g = Gnuplot.Gnuplot(debug=0, persist=1) 287 if outplot: 288 if extension == 'ps': ext, extension = '.ps' , 'postscript' 289 elif extension == 'png': ext, extension = '.png', 'png' 290 elif extension == 'svg': ext, extension = '.svg', 'svg' 291 else: exit("ERR: unknown plot extension") 292 g('set terminal %s' % extension) 293 g('set output \'diffhist-%s%s\'' % (outplot,ext)) 294 g('eps(x) = 1./(sigma*(2.*3.14159)**.5) * exp ( - ( x - mean ) ** 2. / ( 2. * sigma ** 2. ))') 295 g.title(basename(self.datadir)) 296 g.xlabel('delay to hand-labelled onset (s)') 297 g.ylabel('% number of correct detections / ms ') 298 g('set xrange [-0.05:0.05]') 299 g('set yrange [0:20]') 300 g.plot(*d) 301 302
Note: See TracChangeset
for help on using the changeset viewer.