Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -47,7 +47,7 @@ class benchpitch(bench): · 46 unmodified lines | ||
| 47 | 47 | #print results#, computed_data |
| 48 | 48 | #print input, results, results - float(input.split('.')[-2]) |
| 49 | 49 | |
| 50 | − def run_bench(self,modes=['schmitt']): | |
| 50 | + def run_bench(self,modes=['schmitt'],multiplot=0): | |
| 51 | 51 | from os.path import basename |
| 52 | 52 | self.modes = modes |
| 53 | 53 | self.pretty_titles() |
| @@ -90,12 +90,12 @@ class benchpitch(bench): · 36 unmodified lines | ||
| 90 | 90 | allMpit, |
| 91 | 91 | plottitle="%s %s" % (self.v['mode'],self.params.bufsize), |
| 92 | 92 | plotmode='lines') |
| 93 | + """ | |
| 93 | 94 | self.plotpitchtessiture(plot, |
| 94 | 95 | truth, |
| 95 | 96 | allMchr, |
| 96 | 97 | plottitle="%s %s" % (self.v['mode'],"%12"), |
| 97 | 98 | plotmode='lines') |
| 98 | − """ | |
| 99 | 99 | self.plotpitchtessiture(plot, |
| 100 | 100 | truth, |
| 101 | 101 | allMsil, |
| @@ -103,17 +103,20 @@ class benchpitch(bench): · 1 unmodified line | ||
| 103 | 103 | plotmode='lines') |
| 104 | 104 | """ |
| 105 | 105 | title = basename(self.datadir) |
| 106 | − d.append(plot) | |
| 106 | + if multiplot: | |
| 107 | + d.append(plot) | |
| 108 | + else: | |
| 109 | + d += plot | |
| 107 | 110 | outplot = "_-_".join(('pitchtessiture',title)) |
| 108 | − self.xmin = 20. #min(self.v['truth']) | |
| 109 | − self.xmax = 110. #max(self.v['truth']) | |
| 110 | − for ext in ('ps','png','svg',''): | |
| 111 | + self.xmin = min(self.v['truth']) #20. | |
| 112 | + self.xmax = max(self.v['truth']) | |
| 113 | + for ext in ('ps','png','svg'): #,''): | |
| 111 | 114 | self.plotplotpitchtessiture(d, |
| 112 | 115 | plottitle="".join(['Performance against MIDI Note number (', |
| 113 | 116 | title, |
| 114 | 117 | ", %s" % len(self.sndlist), " samples)"]), |
| 115 | 118 | outplot=outplot, |
| 116 | − extension=ext) | |
| 119 | + extension=ext,multiplot=multiplot) | |
| 117 | 120 | #d.append('beta = .25,orig(x) title \"-2 octave\"') |
| 118 | 121 | #d.append('beta = .50,orig(x) title \"-1 octave\"') |
| 119 | 122 | #d.append('beta = 1.0,orig(x) title \"original\"') |
| @@ -132,28 +135,23 @@ class benchpitch(bench): · 12 unmodified lines | ||
| 132 | 135 | g = gnuplot_create(outplot=outplot,extension=extension) |
| 133 | 136 | #g.title(plottitle) |
| 134 | 137 | #g('orig(x) = beta*x') |
| 135 | − #g.xlabel('original pitch (Hz)') | |
| 136 | − #g.ylabel('detected pitch (Hz)') | |
| 137 | − #g('set key left top') | |
| 138 | − #g('set log xy') | |
| 139 | − #g('set xrange [50:2000]') | |
| 140 | − g('set yrange [0:100]') | |
| 138 | + g.title(plottitle) | |
| 139 | + g('set yrange [50:100]') | |
| 140 | + # erase axis | |
| 141 | + g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax)) | |
| 141 | 142 | #g.plot(*d) |
| 143 | + g('set border 3') | |
| 144 | + g('set xtics nomirror') | |
| 145 | + g('set ytics nomirror') | |
| 146 | + g('set key bottom') | |
| 142 | 147 | if multiplot: |
| 143 | 148 | g('set multiplot') |
| 144 | 149 | for i in range(len(d)): |
| 145 | 150 | # plot onset detection functions |
| 146 | 151 | g('set size 1,%f' % ( 1.0/float(len(d)) ) ) |
| 147 | 152 | g('set origin 0,%f' % ( 1.0*float(len(d)-i-1)/float(len(d)) ) ) |
| 148 | − # erase axis | |
| 149 | − g('set border 3') | |
| 150 | − g('set xtics nomirror') | |
| 151 | − g('set ytics nomirror') | |
| 152 | − g('set key left top') | |
| 153 | − g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax)) | |
| 154 | 153 | #g.ylabel('%Correct detections') |
| 155 | − if i == len(d)-1: | |
| 156 | − g.xlabel(plottitle) | |
| 154 | + g('set xrange [%f:%f]' % (self.xmin,self.xmax)) #(self.xmax - (self.xmax-self.xmin)*5./4.,self.xmax)) | |
| 157 | 155 | g.plot(*d[i]) |
| 158 | 156 | g('unset title') |
| 159 | 157 | g('unset multiplot') |
| @@ -168,11 +166,12 @@ if __name__ == "__main__": · 8 unmodified lines | ||
| 168 | 166 | if len(sys.argv) > 2: |
| 169 | 167 | for each in sys.argv[3:-1]: print each |
| 170 | 168 | modes = ['schmitt', 'yin', 'yinfft', 'mcomb', 'fcomb'] |
| 169 | + #modes = ['mcomb'] | |
| 171 | 170 | |
| 172 | 171 | params = taskparams() |
| 173 | − params.bufsize = 2048 #4096 | |
| 172 | + params.bufsize = 2048 # 4096 | |
| 174 | 173 | params.hopsize = 256 |
| 175 | − params.silence = -70. | |
| 174 | + params.silence = -60. | |
| 176 | 175 | params.pitchsmooth = 0 |
| 177 | 176 | params.pitchmax = 20000 |
| 178 | 177 | params.pitchmin = 20 |