History

add plotting of truth file for pitch

Paul Brossier committed 21 years ago

Commit 77671b41 parent 3c86eb11 file · +9 −4Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/aubio/gnuplot.py+9−4
@@ -241,7 +241,8 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 240 unmodified lines
241241 maxpitch = 100
242242 for i in range(len(pitch)):
243243 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)))
245246 maxpitch = max(maxpitch,max(pitch[i][:])*1.1)
246247
247248 # check if datafile exists truth
@@ -251,9 +252,12 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 3 unmodified lines
251252 t = Gnuplot.Data(0,0,with='impulses')
252253 else:
253254 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'))
257261
258262 #orig, missed, merged, expc, bad, doubled = \
259263 # onset_roc(x2,x1,tol)
@@ -300,6 +304,7 @@ def plot_pitch(filename, pitch, samplerate=44100., hopsize=512, outplot=None): · 40 unmodified lines
300304 g('set origin 0,0')
301305 g('set xrange [0:%f]' % max(time))
302306 g('set yrange [40:%f]' % maxpitch)
307+ g('set key right top')
303308 g.xlabel('time')
304309 g.ylabel('frequency (Hz)')
305310 g.plot(*d)

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