def plotplot(self,wplot,oplots,outplot=None,multiplot = 0): from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot import re import Gnuplot # audio data time,data = audio_to_array(self.input) f = make_audio_plot(time,data) # check if ground truth exists #timet,pitcht = self.gettruth() #if timet and pitcht: # oplots = [Gnuplot.Data(timet,pitcht,with_='lines', # title='ground truth')] + oplots t = Gnuplot.Data(0,0,with_='impulses') g = gnuplot_init(outplot) g('set title \'%s\'' % (re.sub('.*/','',self.input))) g('set multiplot') # hack to align left axis g('set lmargin 15') # plot waveform and onsets g('set size 1,0.3') g('set origin 0,0.7') g('set xrange [0:%f]' % max(time)) g('set yrange [-1:1]') g.ylabel('amplitude') g.plot(f) g('unset title') # plot onset detection function g('set size 1,0.7') g('set origin 0,0') g('set xrange [0:%f]' % max(time)) g('set yrange [20:100]') g('set key right top') g('set noclip one') #g('set format x ""') #g('set log y') #g.xlabel('time (s)') g.ylabel('f0 (Hz)') if multiplot: for i in range(len(oplots)): # plot onset detection functions g('set size 1,%f' % (0.7/(len(oplots)))) g('set origin 0,%f' % (float(i)*0.7/(len(oplots)))) g('set xrange [0:%f]' % max(time)) g.plot(oplots[i]) else: g.plot(*oplots)
def plotplot(self, wplot, oplots, outplot=None, multiplot=0): from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot import re import Gnuplot # audio data time, data = audio_to_array(self.input) f = make_audio_plot(time, data) # check if ground truth exists #timet,pitcht = self.gettruth() #if timet and pitcht: # oplots = [Gnuplot.Data(timet,pitcht,with_='lines', # title='ground truth')] + oplots t = Gnuplot.Data(0, 0, with_='impulses') g = gnuplot_init(outplot) g('set title \'%s\'' % (re.sub('.*/', '', self.input))) g('set multiplot') # hack to align left axis g('set lmargin 15') # plot waveform and onsets g('set size 1,0.3') g('set origin 0,0.7') g('set xrange [0:%f]' % max(time)) g('set yrange [-1:1]') g.ylabel('amplitude') g.plot(f) g('unset title') # plot onset detection function g('set size 1,0.7') g('set origin 0,0') g('set xrange [0:%f]' % max(time)) g('set yrange [20:100]') g('set key right top') g('set noclip one') #g('set format x ""') #g('set log y') #g.xlabel('time (s)') g.ylabel('f0 (Hz)') if multiplot: for i in range(len(oplots)): # plot onset detection functions g('set size 1,%f' % (0.7 / (len(oplots)))) g('set origin 0,%f' % (float(i) * 0.7 / (len(oplots)))) g('set xrange [0:%f]' % max(time)) g.plot(oplots[i]) else: g.plot(*oplots)
from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot import re import Gnuplot # audio data time,data = audio_to_array(self.input) f = make_audio_plot(time,data) # check if ground truth exists #timet,pitcht = self.gettruth() #if timet and pitcht: # oplots = [Gnuplot.Data(timet,pitcht,with='lines', # title='ground truth')] + oplots t = Gnuplot.Data(0,0,with='impulses') g = gnuplot_init(outplot) g('set title \'%s\'' % (re.sub('.*/','',self.input))) g('set multiplot') # hack to align left axis g('set lmargin 15') # plot waveform and onsets g('set size 1,0.3') g('set origin 0,0.7') g('set xrange [0:%f]' % max(time)) g('set yrange [-1:1]') g.ylabel('amplitude') g.plot(f) g('unset title') # plot onset detection function