History

add bench-pitch-plot-isolated add bench-pitch-plot-isolated

Paul Brossier committed 20 years ago

Commit 742c9b81 parent 4b4e6ae1 file · +63 −0Browse files

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

Unified · Split

python/test/bench/pitch/bench-pitch-plot-isolated+63−0
@@ -0,0 +1,63 @@
1+#! /usr/bin/python
2+
3+if __name__ == '__main__':
4+ import sys, Gnuplot
5+ from aubio.gnuplot import gnuplot_create
6+ from aubio.txtfile import read_datafile
7+ from aubio.plot.keyboard import draw_keyboard
8+ lines = []
9+ titles = []
10+ for file in range(len(sys.argv)-1):
11+ l = read_datafile(sys.argv[file+1])
12+ notes, score = [],[]
13+ for i in range(len(l)):
14+ notes.append(l[i][0])
15+ score.append(l[i][2])
16+ lines.append(Gnuplot.Data(notes,score,
17+ with='linespoints',
18+ title=sys.argv[file+1].split('.')[-1]))
19+ titles.append(sys.argv[file+1].split('.')[-1])
20+ blacks,whites = draw_keyboard(firstnote = notes[0], lastnote = notes[-1],
21+ y0= 40, y1 = 50)
22+
23+ g = gnuplot_create(sys.argv[file+1].split('.')[-3],'ps')
24+ #g = gnuplot_create('','')
25+ #g = gnuplot_create('/tmp/test','eps')
26+ g('set yrange [40:100]')
27+ #g('set xrange [%f:%f]' % (notes[0],notes[-1]+60))
28+ g('set size 0.5')
29+ g('set key outside')
30+
31+ g('set border 3')
32+ g('set xtics nomirror')
33+ g('set ytics nomirror')
34+ multiplot = 1
35+ oplots = lines
36+ g('set size 1,2')
37+ if multiplot:
38+ height = 2.
39+ g('set lmargin 10')
40+ #g('set rmargin 15')
41+ g('set multiplot')
42+ g('set yrange [50:100]')
43+ g('set xrange [%f:%f]' % (notes[0],notes[-1]))
44+ g('set xtics %f,12' % notes[0])
45+ g('set nokey')
46+ for i in range(len(oplots)):
47+ g.ylabel(titles[i])
48+ g('set size %f,%f' % (1.,height*.85/float(len(oplots))))
49+ g('set origin 0,%f' % (height*(.15+.85*float(len(oplots)-i-1)/float(len(oplots)))))
50+ g.plot(oplots[i])
51+ g('set title "Raw pitch accuracy (%) against midi note numbers"')
52+ g('set noxtics')
53+ g('set noytics')
54+ g('set size %f,%f' % (1.,.15*height))
55+ g('set origin 0,%f' % 0)
56+ g('set yrange [40:50]')
57+ g('set xrange [%f:%f]' % (notes[0],notes[-1]))
58+ g.xlabel('')
59+ g.ylabel('')
60+ g.plot(whites,blacks)
61+ g('unset multiplot')
62+ else:
63+ g.plot(whites,blacks,*lines)

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