From: Paul Brossier Date: Sun, 4 Sep 2005 15:49:08 +0000 (+0000) Subject: add plotting of truth file for pitch X-Git-Tag: bzr2git~828 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=77671b495368580dd89e9b910db4ef284d1fa9f6;p=aubio.git add plotting of truth file for pitch --- diff --git a/python/aubio/gnuplot.py b/python/aubio/gnuplot.py index 15a80aec..5f38d129 100644 --- a/python/aubio/gnuplot.py +++ b/python/aubio/gnuplot.py @@ -241,7 +241,8 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): maxpitch = 100 for i in range(len(pitch)): downtime = (hopsize/samplerate)*numarray.arange(len(pitch[i])) - d.append(Gnuplot.Data(downtime,pitch[i],with='lines')) + d.append(Gnuplot.Data(downtime,pitch[i],with='lines', + title=('%d' % i))) maxpitch = max(maxpitch,max(pitch[i][:])*1.1) # check if datafile exists truth @@ -251,9 +252,12 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): t = Gnuplot.Data(0,0,with='impulses') else: title = "truth file plotting not implemented yet" - t = Gnuplot.Data(0,0,with='impulses') - #times,pitch = aubio.txtfile.read_datafile(datafile) - #t = Gnuplot.Data(times,pitch,with='lines') + values = aubio.txtfile.read_datafile(datafile) + time, pitch = [], [] + for i in range(len(values)): + time.append(values[i][0]) + pitch.append(values[i][1]) + d.append(Gnuplot.Data(time,pitch,with='lines',title='ground truth')) #orig, missed, merged, expc, bad, doubled = \ # onset_roc(x2,x1,tol) @@ -300,6 +304,7 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): g('set origin 0,0') g('set xrange [0:%f]' % max(time)) g('set yrange [40:%f]' % maxpitch) + g('set key right top') g.xlabel('time') g.ylabel('frequency (Hz)') g.plot(*d)