History

python/aubio: use Gnuplot.Data with_ keywords, with is a reserved keyword in python 2.6 (debian #512622)

Paul Brossier committed 17 years ago

Commit 5f23f661 parent 55ed67a7 files · +26 −26Browse files

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

Unified · Split

7 files
  1. python/aubio/bench/onset.py +6 −6
  2. python/aubio/plot/notes.py +2 −2
  3. python/aubio/task/beat.py +2 −2
  4. python/aubio/task/notes.py +5 −5
  5. python/aubio/task/onset.py +5 −5
  6. python/aubio/task/pitch.py +2 −2
  7. python/aubioplot-yinfft +4 −4
python/aubio/bench/onset.py+6−6
@@ -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))
python/aubio/plot/notes.py+2−2
@@ -51,7 +51,7 @@ def plotnote_withends(la,plot_title=None) : · 50 unmodified lines
51 la[:,2], # y centers51 la[:,2], # y centers
52 x_widths, # x errors52 x_widths, # x errors
53 __notesheight*ones(len(la)), # y errors53 __notesheight*ones(len(la)), # y errors
54 title=plot_title,with=('boxxyerrorbars fs 3')))54 title=plot_title,with_=('boxxyerrorbars fs 3')))
55 return d55 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 centers66 la[:-1,1], # y centers
67 x_widths, # x errors67 x_widths, # x errors
68 __notesheight*ones(len(la)-1), # y errors68 __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 d70 return d
71 71
72def plotnote_do(d,fileout=None):72def plotnote_do(d,fileout=None):
python/aubio/task/beat.py+2−2
@@ -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 Gnuplot249 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 Gnuplot253 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")] + oplots261 oplots = [Gnuplot.Data(self.gettruth(),with_='linespoints',title="orig")] + oplots
262 g.plot(*oplots)262 g.plot(*oplots)
python/aubio/task/notes.py+5−5
@@ -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 Gnuplot95 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 exists116 # 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')] + oplots120 # 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)))
python/aubio/task/onset.py+5−5
@@ -92,7 +92,7 @@ class taskonset(task): · 91 unmodified lines
92 import Gnuplot, Gnuplot.funcutils92 import Gnuplot, Gnuplot.funcutils
93 import aubio.txtfile93 import aubio.txtfile
94 import os.path94 import os.path
95 from numpy import arange, array, ones95 from numpy import arange, array, ones
96 from aubio.onsetcompare import onset_roc96 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.step105 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 onsets108 # 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.step114 #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
python/aubio/task/pitch.py+2−2
@@ -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')] + oplots174 title='ground truth')] + oplots
175 175
176 g = gnuplot_create(outplot=outplot, extension=extension)176 g = gnuplot_create(outplot=outplot, extension=extension)
python/aubioplot-yinfft+4−4
@@ -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()

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