Changeset fb8bde7 for python/aubio
- Timestamp:
- May 4, 2006, 5:02:01 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 45fcbb8
- Parents:
- fe4f78a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/task/pitch.py
rfe4f78a rfb8bde7 152 152 return osil, esil, opit, epit, echr 153 153 154 def plot(self,pitch,wplot,oplots, outplot=None):154 def plot(self,pitch,wplot,oplots,titles,outplot=None): 155 155 import Gnuplot 156 156 … … 159 159 oplots.append(Gnuplot.Data(time,pitch,with='lines', 160 160 title=self.params.pitchmode)) 161 titles.append(self.params.pitchmode) 161 162 162 163 163 def plotplot(self,wplot,oplots, outplot=None,multiplot = 1, midi= 1):164 def plotplot(self,wplot,oplots,titles,outplot=None,multiplot = 1, midi = 1, truth = 1): 164 165 from aubio.gnuplot import gnuplot_init, audio_to_array, make_audio_plot 165 166 import re … … 170 171 171 172 # check if ground truth exists 172 timet,pitcht = self.gettruth() 173 if timet and pitcht: 174 oplots = [Gnuplot.Data(timet,pitcht,with='lines', 175 title='ground truth')] + oplots 173 if truth: 174 timet,pitcht = self.gettruth() 175 if timet and pitcht: 176 oplots = [Gnuplot.Data(timet,pitcht,with='lines', 177 title='ground truth')] + oplots 176 178 177 179 t = Gnuplot.Data(0,0,with='impulses') … … 181 183 g('set multiplot') 182 184 # hack to align left axis 183 g('set lmargin 15') 185 g('set lmargin 4') 186 g('set rmargin 4') 184 187 # plot waveform and onsets 185 188 g('set size 1,0.3') … … 188 191 g('set xrange [0:%f]' % max(time)) 189 192 g('set yrange [-1:1]') 193 g('set noytics') 194 g('set y2tics -1,1') 195 g.xlabel('time (s)',offset=(0,0.8)) 190 196 g.ylabel('amplitude') 191 197 g.plot(f) … … 205 211 g.ylabel('midi') 206 212 g('set yrange [%f:%f]' % (aubio_freqtomidi(self.params.pitchmin), aubio_freqtomidi(self.params.pitchmax))) 213 g('set y2tics %f,%f' % (round(aubio_freqtomidi(self.params.pitchmin)+.5),12)) 207 214 g('set key right top') 208 215 g('set noclip one') 209 216 g('set format x ""') 210 217 if multiplot: 218 g('set tmargin 0') 211 219 for i in range(len(oplots)): 212 220 # plot onset detection functions 213 221 g('set size 1,%f' % (0.7/(len(oplots)))) 214 g('set origin 0,%f' % ( float(i)*0.7/(len(oplots))))222 g('set origin 0,%f' % ((len(oplots)-float(i)-1)*0.7/(len(oplots)))) 215 223 g('set xrange [0:%f]' % max(time)) 224 g('set nokey') 225 g.ylabel(titles[i]) 226 g.xlabel('') 216 227 g.plot(oplots[i]) 217 228 else:
Note: See TracChangeset
for help on using the changeset viewer.