Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -241,7 +241,8 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 240 unmodified lines | ||
| 241 | 241 | maxpitch = 100 |
| 242 | 242 | for i in range(len(pitch)): |
| 243 | 243 | downtime = (hopsize/samplerate)*numarray.arange(len(pitch[i])) |
| 244 | − d.append(Gnuplot.Data(downtime,pitch[i],with='lines')) | |
| 244 | + d.append(Gnuplot.Data(downtime,pitch[i],with='lines', | |
| 245 | + title=('%d' % i))) | |
| 245 | 246 | maxpitch = max(maxpitch,max(pitch[i][:])*1.1) |
| 246 | 247 | |
| 247 | 248 | # check if datafile exists truth |
| @@ -251,9 +252,12 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 3 unmodified lines | ||
| 251 | 252 | t = Gnuplot.Data(0,0,with='impulses') |
| 252 | 253 | else: |
| 253 | 254 | title = "truth file plotting not implemented yet" |
| 254 | − t = Gnuplot.Data(0,0,with='impulses') | |
| 255 | − #times,pitch = aubio.txtfile.read_datafile(datafile) | |
| 256 | − #t = Gnuplot.Data(times,pitch,with='lines') | |
| 255 | + values = aubio.txtfile.read_datafile(datafile) | |
| 256 | + time, pitch = [], [] | |
| 257 | + for i in range(len(values)): | |
| 258 | + time.append(values[i][0]) | |
| 259 | + pitch.append(values[i][1]) | |
| 260 | + d.append(Gnuplot.Data(time,pitch,with='lines',title='ground truth')) | |
| 257 | 261 | |
| 258 | 262 | #orig, missed, merged, expc, bad, doubled = \ |
| 259 | 263 | # onset_roc(x2,x1,tol) |
| @@ -300,6 +304,7 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 40 unmodified lines | ||
| 300 | 304 | g('set origin 0,0') |
| 301 | 305 | g('set xrange [0:%f]' % max(time)) |
| 302 | 306 | g('set yrange [40:%f]' % maxpitch) |
| 307 | + g('set key right top') | |
| 303 | 308 | g.xlabel('time') |
| 304 | 309 | g.ylabel('frequency (Hz)') |
| 305 | 310 | g.plot(*d) |