Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -117,7 +117,7 @@ class taskonset(task): · 116 unmodified lines | ||
| 117 | 117 | oplot.append(Gnuplot.Data(x1,y1,with='impulses')) |
| 118 | 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 | 122 | # check if ground truth datafile exists |
| 123 | 123 | datafile = self.input.replace('.wav','.txt') |
| @@ -145,29 +145,38 @@ class taskonset(task): · 21 unmodified lines | ||
| 145 | 145 | # audio data |
| 146 | 146 | time,data = audio_to_array(self.input) |
| 147 | 147 | wplot = [make_audio_plot(time,data)] + wplot |
| 148 | − self.title = self.input | |
| 149 | 148 | # prepare the plot |
| 150 | 149 | g = gnuplot_init(outplot) |
| 151 | 150 | |
| 152 | 151 | g('set multiplot') |
| 153 | 152 | |
| 154 | 153 | # hack to align left axis |
| 155 | − g('set lmargin 6') | |
| 154 | + g('set lmargin 3') | |
| 155 | + g('set rmargin 6') | |
| 156 | 156 | g('set tmargin 0') |
| 157 | 157 | g('set format x ""') |
| 158 | − g('set format y ""') | |
| 158 | + g('set format y "%3e"') | |
| 159 | 159 | g('set noytics') |
| 160 | 160 | |
| 161 | 161 | for i in range(len(oplots)): |
| 162 | 162 | # plot onset detection functions |
| 163 | 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 | 165 | g('set xrange [0:%f]' % (self.lenofunc*self.params.step)) |
| 166 | − g.plot(*oplots[i]) | |
| 167 | − | |
| 168 | − g('set tmargin 3.0') | |
| 169 | − g('set xlabel "time (s)" 1,0') | |
| 166 | + g('set nokey') | |
| 167 | + g('set yrange [0:%f]' % (1.1*oplots[i][2])) | |
| 168 | + g('set y2tics ("0" 0, "%d" %d)' % (round(oplots[i][2]),round(oplots[i][2]))) | |
| 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 | 176 | g('set format x "%1.1f"') |
| 177 | + g('set format y "%1f"') | |
| 178 | + g('set y2tics -1,1') | |
| 179 | + | |
| 171 | 180 | |
| 172 | 181 | g('set title \'%s %s\'' % (re.sub('.*/','',self.input),self.title)) |
| 173 | 182 | |