History

update onset plot update onset plot

Paul Brossier committed 20 years ago

Commit 45fcbb81 parent fb8bde71 file · +18 −9Browse files

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

Unified · Split

python/aubio/task/onset.py+18−9
@@ -117,7 +117,7 @@ class taskonset(task): · 116 unmodified lines
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)120 oplots.append((oplot,self.params.onsetmode,self.maxofunc))
121 121
122 # check if ground truth datafile exists122 # check if ground truth datafile exists
123 datafile = self.input.replace('.wav','.txt')123 datafile = self.input.replace('.wav','.txt')
@@ -145,29 +145,38 @@ class taskonset(task): · 21 unmodified lines
145 # audio data145 # audio data
146 time,data = audio_to_array(self.input)146 time,data = audio_to_array(self.input)
147 wplot = [make_audio_plot(time,data)] + wplot147 wplot = [make_audio_plot(time,data)] + wplot
148 self.title = self.input
149 # prepare the plot148 # prepare the plot
150 g = gnuplot_init(outplot)149 g = gnuplot_init(outplot)
151 150
152 g('set multiplot')151 g('set multiplot')
153 152
154 # hack to align left axis153 # hack to align left axis
155 g('set lmargin 6')154 g('set lmargin 3')
155 g('set rmargin 6')
156 g('set tmargin 0')156 g('set tmargin 0')
157 g('set format x ""')157 g('set format x ""')
158 g('set format y ""')158 g('set format y "%3e"')
159 g('set noytics')159 g('set noytics')
160 160
161 for i in range(len(oplots)):161 for i in range(len(oplots)):
162 # plot onset detection functions162 # plot onset detection functions
163 g('set size 1,%f' % (0.7/(len(oplots))))163 g('set size 1,%f' % (0.7/(len(oplots))))
164 g('set origin 0,%f' % (float(i)*0.7/(len(oplots))))164 g('set origin 0,%f' % ((len(oplots)-float(i)-1)*0.7/(len(oplots))))
165 g('set xrange [0:%f]' % (self.lenofunc*self.params.step))165 g('set xrange [0:%f]' % (self.lenofunc*self.params.step))
166 g.plot(*oplots[i])166 g('set nokey')
167 167 g('set yrange [0:%f]' % (1.1*oplots[i][2]))
168 g('set tmargin 3.0')168 g('set y2tics ("0" 0, "%d" %d)' % (round(oplots[i][2]),round(oplots[i][2])))
169 g('set xlabel "time (s)" 1,0')169 g.ylabel(oplots[i][1])
170 if i == len(oplots)-1:
171 g.xlabel('time (s)',offset=(0,0.7))
172 g.plot(*oplots[i][0])
173
174 g('set tmargin 2')
175 g.xlabel('time (s)',offset=(0,0.7))
170 g('set format x "%1.1f"')176 g('set format x "%1.1f"')
177 g('set format y "%1f"')
178 g('set y2tics -1,1')
179
171 180
172 g('set title \'%s %s\'' % (re.sub('.*/','',self.input),self.title))181 g('set title \'%s %s\'' % (re.sub('.*/','',self.input),self.title))
173 182

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