Showing the changes to python (7 of 7 files). Show all
Unified · Split
| @@ -111,7 +111,7 @@ class benchonset(bench): · 110 unmodified lines | |||
| 111 | for i in self.vlist: | 111 | for i in self.vlist: |
| 112 | gd.append(i['GD']) | 112 | gd.append(i['GD']) |
| 113 | fp.append(i['FP']) | 113 | fp.append(i['FP']) |
| 114 | d.append(Gnuplot.Data(fp, gd, with='linespoints', | 114 | d.append(Gnuplot.Data(fp, gd, with_='linespoints', |
| 115 | title="%s %s" % (plottitle,i['mode']) )) | 115 | title="%s %s" % (plottitle,i['mode']) )) |
| 116 | 116 | ||
| 117 | def plotplotroc(self,d,outplot=0,extension='ps'): | 117 | def plotplotroc(self,d,outplot=0,extension='ps'): |
| @@ -147,7 +147,7 @@ class benchonset(bench): · 29 unmodified lines | |||
| 147 | for i in self.vlist: | 147 | for i in self.vlist: |
| 148 | x.append(i['prec']) | 148 | x.append(i['prec']) |
| 149 | y.append(i['recl']) | 149 | y.append(i['recl']) |
| 150 | d.append(Gnuplot.Data(x, y, with='linespoints', | 150 | d.append(Gnuplot.Data(x, y, with_='linespoints', |
| 151 | title="%s %s" % (plottitle,i['mode']) )) | 151 | title="%s %s" % (plottitle,i['mode']) )) |
| 152 | 152 | ||
| 153 | def plotplotpr(self,d,outplot=0,extension='ps'): | 153 | def plotplotpr(self,d,outplot=0,extension='ps'): |
| @@ -172,7 +172,7 @@ class benchonset(bench): · 18 unmodified lines | |||
| 172 | for i in self.vlist: | 172 | for i in self.vlist: |
| 173 | x.append(i['thres']) | 173 | x.append(i['thres']) |
| 174 | y.append(i['dist']) | 174 | y.append(i['dist']) |
| 175 | d.append(Gnuplot.Data(x, y, with='linespoints', | 175 | d.append(Gnuplot.Data(x, y, with_='linespoints', |
| 176 | title="%s %s" % (plottitle,i['mode']) )) | 176 | title="%s %s" % (plottitle,i['mode']) )) |
| 177 | 177 | ||
| 178 | def plotplotfmeas(self,d,outplot="",extension='ps', title="F-measure"): | 178 | def plotplotfmeas(self,d,outplot="",extension='ps', title="F-measure"): |
| @@ -205,7 +205,7 @@ class benchonset(bench): · 26 unmodified lines | |||
| 205 | for i in self.vlist: | 205 | for i in self.vlist: |
| 206 | x.append(i[var]) | 206 | x.append(i[var]) |
| 207 | y.append(i['dist']) | 207 | y.append(i['dist']) |
| 208 | d.append(Gnuplot.Data(x, y, with='linespoints', | 208 | d.append(Gnuplot.Data(x, y, with_='linespoints', |
| 209 | title="%s %s" % (plottitle,i['mode']) )) | 209 | title="%s %s" % (plottitle,i['mode']) )) |
| 210 | 210 | ||
| 211 | def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"): | 211 | def plotplotfmeasvar(self,d,var,outplot="",extension='ps', title="F-measure"): |
| @@ -244,7 +244,7 @@ class benchonset(bench): · 32 unmodified lines | |||
| 244 | total = v['Torig'] | 244 | total = v['Torig'] |
| 245 | for i in range(len(per)): per[i] /= total/100. | 245 | for i in range(len(per)): per[i] /= total/100. |
| 246 | 246 | ||
| 247 | d.append(Gnuplot.Data(val, per, with='fsteps', | 247 | d.append(Gnuplot.Data(val, per, with_='fsteps', |
| 248 | title="%s %s" % (plottitle,v['mode']) )) | 248 | title="%s %s" % (plottitle,v['mode']) )) |
| 249 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean)) | 249 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean)) |
| 250 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean)) | 250 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean)) |
| @@ -275,7 +275,7 @@ class benchonset(bench): · 24 unmodified lines | |||
| 275 | total = v['Torig'] | 275 | total = v['Torig'] |
| 276 | for i in range(len(per)): per[i] /= total/100. | 276 | for i in range(len(per)): per[i] /= total/100. |
| 277 | 277 | ||
| 278 | d.append(Gnuplot.Data(val, per, with='fsteps', | 278 | d.append(Gnuplot.Data(val, per, with_='fsteps', |
| 279 | title="%s %s" % (plottitle,v['mode']) )) | 279 | title="%s %s" % (plottitle,v['mode']) )) |
| 280 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean)) | 280 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (mean,smean)) |
| 281 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean)) | 281 | #d.append('mean=%f,sigma=%f,eps(x) title \"\"'% (amean,samean)) |
| @@ -51,7 +51,7 @@ def plotnote_withends(la,plot_title=None) : · 50 unmodified lines | |||
| 51 | la[:,2], # y centers | 51 | la[:,2], # y centers |
| 52 | x_widths, # x errors | 52 | x_widths, # x errors |
| 53 | __notesheight*ones(len(la)), # y errors | 53 | __notesheight*ones(len(la)), # y errors |
| 54 | title=plot_title,with=('boxxyerrorbars fs 3'))) | 54 | title=plot_title,with_=('boxxyerrorbars fs 3'))) |
| 55 | return d | 55 | return d |
| 56 | 56 | ||
| 57 | 57 | ||
| @@ -66,7 +66,7 @@ def plotnote_withoutends(la,plot_title=None) : · 8 unmodified lines | |||
| 66 | la[:-1,1], # y centers | 66 | la[:-1,1], # y centers |
| 67 | x_widths, # x errors | 67 | x_widths, # x errors |
| 68 | __notesheight*ones(len(la)-1), # y errors | 68 | __notesheight*ones(len(la)-1), # y errors |
| 69 | title=plot_title,with=('boxxyerrorbars fs 3'))) | 69 | title=plot_title,with_=('boxxyerrorbars fs 3'))) |
| 70 | return d | 70 | return d |
| 71 | 71 | ||
| 72 | def plotnote_do(d,fileout=None): | 72 | def plotnote_do(d,fileout=None): |
| @@ -247,7 +247,7 @@ class taskbeat(taskonset): · 246 unmodified lines | |||
| 247 | 247 | ||
| 248 | def plot(self,oplots,results): | 248 | def plot(self,oplots,results): |
| 249 | import Gnuplot | 249 | import Gnuplot |
| 250 | oplots.append(Gnuplot.Data(results,with='linespoints',title="auto")) | 250 | oplots.append(Gnuplot.Data(results,with_='linespoints',title="auto")) |
| 251 | 251 | ||
| 252 | def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False): | 252 | def plotplot(self,wplot,oplots,outplot=None,extension=None,xsize=1.,ysize=1.,spectro=False): |
| 253 | import Gnuplot | 253 | import Gnuplot |
| @@ -258,5 +258,5 @@ class taskbeat(taskonset): · 4 unmodified lines | |||
| 258 | #f = make_audio_plot(time,data) | 258 | #f = make_audio_plot(time,data) |
| 259 | 259 | ||
| 260 | g = gnuplot_create(outplot=outplot, extension=extension) | 260 | g = gnuplot_create(outplot=outplot, extension=extension) |
| 261 | oplots = [Gnuplot.Data(self.gettruth(),with='linespoints',title="orig")] + oplots | 261 | oplots = [Gnuplot.Data(self.gettruth(),with_='linespoints',title="orig")] + oplots |
| 262 | g.plot(*oplots) | 262 | g.plot(*oplots) |
| @@ -94,15 +94,15 @@ class tasknotes(task): · 93 unmodified lines | |||
| 94 | def plot(self,now,onset,freq,ifreq,oplots): | 94 | def plot(self,now,onset,freq,ifreq,oplots): |
| 95 | import Gnuplot | 95 | import Gnuplot |
| 96 | 96 | ||
| 97 | oplots.append(Gnuplot.Data(now,freq,with='lines', | 97 | oplots.append(Gnuplot.Data(now,freq,with_='lines', |
| 98 | title=self.params.pitchmode)) | 98 | title=self.params.pitchmode)) |
| 99 | oplots.append(Gnuplot.Data(now,ifreq,with='lines', | 99 | oplots.append(Gnuplot.Data(now,ifreq,with_='lines', |
| 100 | title=self.params.pitchmode)) | 100 | title=self.params.pitchmode)) |
| 101 | 101 | ||
| 102 | temponsets = [] | 102 | temponsets = [] |
| 103 | for i in onset: | 103 | for i in onset: |
| 104 | temponsets.append(i*1000) | 104 | temponsets.append(i*1000) |
| 105 | oplots.append(Gnuplot.Data(now,temponsets,with='impulses', | 105 | oplots.append(Gnuplot.Data(now,temponsets,with_='impulses', |
| 106 | title=self.params.pitchmode)) | 106 | title=self.params.pitchmode)) |
| 107 | 107 | ||
| 108 | def plotplot(self,wplot,oplots,outplot=None,multiplot = 0): | 108 | def plotplot(self,wplot,oplots,outplot=None,multiplot = 0): |
| @@ -116,10 +116,10 @@ class tasknotes(task): · 7 unmodified lines | |||
| 116 | # check if ground truth exists | 116 | # check if ground truth exists |
| 117 | #timet,pitcht = self.gettruth() | 117 | #timet,pitcht = self.gettruth() |
| 118 | #if timet and pitcht: | 118 | #if timet and pitcht: |
| 119 | # oplots = [Gnuplot.Data(timet,pitcht,with='lines', | 119 | # oplots = [Gnuplot.Data(timet,pitcht,with_='lines', |
| 120 | # title='ground truth')] + oplots | 120 | # title='ground truth')] + oplots |
| 121 | 121 | ||
| 122 | t = Gnuplot.Data(0,0,with='impulses') | 122 | t = Gnuplot.Data(0,0,with_='impulses') |
| 123 | 123 | ||
| 124 | g = gnuplot_init(outplot) | 124 | g = gnuplot_init(outplot) |
| 125 | g('set title \'%s\'' % (re.sub('.*/','',self.input))) | 125 | g('set title \'%s\'' % (re.sub('.*/','',self.input))) |
| @@ -92,7 +92,7 @@ class taskonset(task): · 91 unmodified lines | |||
| 92 | import Gnuplot, Gnuplot.funcutils | 92 | import Gnuplot, Gnuplot.funcutils |
| 93 | import aubio.txtfile | 93 | import aubio.txtfile |
| 94 | import os.path | 94 | import os.path |
| 95 | from numpy import arange, array, ones | 95 | from numpy import arange, array, ones |
| 96 | from aubio.onsetcompare import onset_roc | 96 | from aubio.onsetcompare import onset_roc |
| 97 | 97 | ||
| 98 | x1,y1,y1p = [],[],[] | 98 | x1,y1,y1p = [],[],[] |
| @@ -103,7 +103,7 @@ class taskonset(task): · 4 unmodified lines | |||
| 103 | self.maxofunc = max(ofunc) | 103 | self.maxofunc = max(ofunc) |
| 104 | # onset detection function | 104 | # onset detection function |
| 105 | downtime = arange(len(ofunc))*self.params.step | 105 | downtime = arange(len(ofunc))*self.params.step |
| 106 | oplot.append(Gnuplot.Data(downtime,ofunc,with='lines',title=self.params.onsetmode)) | 106 | oplot.append(Gnuplot.Data(downtime,ofunc,with_='lines',title=self.params.onsetmode)) |
| 107 | 107 | ||
| 108 | # detected onsets | 108 | # detected onsets |
| 109 | if not nplot: | 109 | if not nplot: |
| @@ -114,8 +114,8 @@ class taskonset(task): · 4 unmodified lines | |||
| 114 | #x1 = array(onsets)*self.params.step | 114 | #x1 = array(onsets)*self.params.step |
| 115 | #y1 = self.maxofunc*ones(len(onsets)) | 115 | #y1 = self.maxofunc*ones(len(onsets)) |
| 116 | if x1: | 116 | if x1: |
| 117 | oplot.append(Gnuplot.Data(x1,y1,with='impulses')) | 117 | oplot.append(Gnuplot.Data(x1,y1,with_='impulses')) |
| 118 | wplot.append(Gnuplot.Data(x1,y1p,with='impulses')) | 118 | wplot.append(Gnuplot.Data(x1,y1p,with_='impulses')) |
| 119 | 119 | ||
| 120 | oplots.append((oplot,self.params.onsetmode,self.maxofunc)) | 120 | oplots.append((oplot,self.params.onsetmode,self.maxofunc)) |
| 121 | 121 | ||
| @@ -128,7 +128,7 @@ class taskonset(task): · 6 unmodified lines | |||
| 128 | t_onsets = aubio.txtfile.read_datafile(datafile) | 128 | t_onsets = aubio.txtfile.read_datafile(datafile) |
| 129 | x2 = array(t_onsets).resize(len(t_onsets)) | 129 | x2 = array(t_onsets).resize(len(t_onsets)) |
| 130 | y2 = self.maxofunc*ones(len(t_onsets)) | 130 | y2 = self.maxofunc*ones(len(t_onsets)) |
| 131 | wplot.append(Gnuplot.Data(x2,y2,with='impulses')) | 131 | wplot.append(Gnuplot.Data(x2,y2,with_='impulses')) |
| 132 | 132 | ||
| 133 | tol = 0.050 | 133 | tol = 0.050 |
| 134 | 134 | ||
| @@ -156,7 +156,7 @@ class taskpitch(task): · 155 unmodified lines | |||
| 156 | 156 | ||
| 157 | time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ] | 157 | time = [ (i+self.params.pitchdelay)*self.params.step for i in range(len(pitch)) ] |
| 158 | pitch = [aubio_freqtomidi(i) for i in pitch] | 158 | pitch = [aubio_freqtomidi(i) for i in pitch] |
| 159 | oplots.append(Gnuplot.Data(time,pitch,with='lines', | 159 | oplots.append(Gnuplot.Data(time,pitch,with_='lines', |
| 160 | title=self.params.pitchmode)) | 160 | title=self.params.pitchmode)) |
| 161 | titles.append(self.params.pitchmode) | 161 | titles.append(self.params.pitchmode) |
| 162 | 162 | ||
| @@ -170,7 +170,7 @@ class taskpitch(task): · 7 unmodified lines | |||
| 170 | if truth: | 170 | if truth: |
| 171 | timet,pitcht = self.gettruth() | 171 | timet,pitcht = self.gettruth() |
| 172 | if timet and pitcht: | 172 | if timet and pitcht: |
| 173 | oplots = [Gnuplot.Data(timet,pitcht,with='lines', | 173 | oplots = [Gnuplot.Data(timet,pitcht,with_='lines', |
| 174 | title='ground truth')] + oplots | 174 | title='ground truth')] + oplots |
| 175 | 175 | ||
| 176 | g = gnuplot_create(outplot=outplot, extension=extension) | 176 | g = gnuplot_create(outplot=outplot, extension=extension) |
| @@ -73,10 +73,10 @@ while (taskfile.readsize == params.hopsize): · 72 unmodified lines | |||
| 73 | y = [yin.get(i,0) for i in range(params.bufsize/2)] | 73 | y = [yin.get(i,0) for i in range(params.bufsize/2)] |
| 74 | thresh = [0.1 for i in range(params.bufsize/2)] | 74 | thresh = [0.1 for i in range(params.bufsize/2)] |
| 75 | #t.append((i/float(params.hopsize)+taskfile.frameread)*params.step),t.pop(0) | 75 | #t.append((i/float(params.hopsize)+taskfile.frameread)*params.step),t.pop(0) |
| 76 | d = [plotdata(n,a,plottitle="signal", with='lines'), | 76 | d = [plotdata(n,a,plottitle="signal", with_='lines'), |
| 77 | plotdata(n,c,plottitle="d[t]",axes='x1y2', with='lines lt 1'), | 77 | plotdata(n,c,plottitle="d[t]",axes='x1y2', with_='lines lt 1'), |
| 78 | plotdata(n,y,plottitle="d'[t]",axes='x1y1', with='lines lt 2'), | 78 | plotdata(n,y,plottitle="d'[t]",axes='x1y1', with_='lines lt 2'), |
| 79 | plotdata(n,thresh,plottitle="threshold",axes='x1y1', with='lines lt 3')] | 79 | plotdata(n,thresh,plottitle="threshold",axes='x1y1', with_='lines lt 3')] |
| 80 | #g('set xrange [%f:%f]' % (t[0],t[-1])) | 80 | #g('set xrange [%f:%f]' % (t[0],t[-1])) |
| 81 | #time.sleep(.2) | 81 | #time.sleep(.2) |
| 82 | g.reset() | 82 | g.reset() |