History

update bench-pitch update bench-pitch

Paul Brossier committed 20 years ago

Commit 807f0291 parent 66101431 file · +21 −9Browse files

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

Unified · Split

python/test/bench/pitch/bench-pitch+21−9
@@ -9,15 +9,18 @@ class benchpitch(bench): · 8 unmodified lines
99 valuenames = ['mode']
1010 """ list of lists to store per file """
1111 valuelists = ['truth', 'osil', 'esil', 'opit', 'epit', 'echr',
12− 'Msil', 'Mpit', 'Mchr']
12+ 'Msil', 'Mpit', 'Mchr',
13+ 'TotalPit', 'TotalPit', 'TotalChr' ]
1314 """ list of values to print per dir """
14− printnames = [ 'mode', 'truth', 'Msil', 'Mpit', 'Mchr']
15+ printnames = [ 'mode', 'MinPit', 'MaxPit', 'TotalSil', 'TotalPit', 'TotalChr']
1516
1617 """ per dir """
1718 formats = {'mode': "%12s" ,
1819 'truth': "%s",
1920 'osil': "%s", 'esil': "%s",
2021 'opit': "%s", 'epit': "%s", 'echr': "%s",
22+ 'TotalPit': "%s", 'TotalSil': "%s", 'TotalChr': "%s",
23+ 'MinPit': "%s", 'MaxPit': "%s",
2124 'Msil': "%s", 'Mpit': "%s", 'Mchr': "%s"}
2225
2326 def dir_eval(self):
@@ -28,7 +31,7 @@ class benchpitch(bench): · 4 unmodified lines
2831 def file_exec(self,input,output):
2932 filetask = self.task(input,params=self.params)
3033 computed_data = filetask.compute_all()
31− osil, esil, opit, epit, echr = filetask.eval(computed_data)
34+ osil, esil, opit, epit, echr = filetask.eval(computed_data,tol=0.5)
3235 self.v['truth'].append(int(filetask.truth))
3336 assert opit > 0
3437
@@ -51,7 +54,8 @@ class benchpitch(bench): · 16 unmodified lines
5154 d = []
5255 for mode in self.modes:
5356 self.params.pitchmode = mode
54− self.dir_eval_print()
57+ self.dir_exec()
58+ self.dir_eval()
5559 truth = [i for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
5660 allOsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
5761 allEsil = [0 for i in range(min(self.v['truth']),max(self.v['truth'])+1)]
@@ -68,9 +72,17 @@ class benchpitch(bench): · 10 unmodified lines
6872 allEpit[self.v['truth'][i]-min(self.v['truth'])] += self.v['epit'][i]
6973 allEchr[self.v['truth'][i]-min(self.v['truth'])] += self.v['echr'][i]
7074 for i in range(len(truth)):
75+ allOsil[i] = max(1,allOsil[i])
76+ allOpit[i] = max(1,allOpit[i])
7177 allMsil[i] = allEsil[i]/float(allOsil[i])*100.
7278 allMpit[i] = allEpit[i]/float(allOpit[i])*100.
7379 allMchr[i] = allEchr[i]/float(allOpit[i])*100.
80+ self.v['TotalSil'] = sum(allMsil)/len(truth)
81+ self.v['TotalPit'] = sum(allMpit)/len(truth)
82+ self.v['TotalChr'] = sum(allMchr)/len(truth)
83+ self.v['MinPit'] = min(truth)
84+ self.v['MaxPit'] = max(truth)
85+ self.pretty_print()
7486
7587 plot = []
7688 self.plotpitchtessiture(plot,
@@ -155,16 +167,16 @@ if __name__ == "__main__": · 78 unmodified lines
155167 else: print "error: a path is required"; sys.exit(1)
156168 if len(sys.argv) > 2:
157169 for each in sys.argv[3:-1]: print each
158− modes = ['schmitt', 'yin', 'mcomb', 'fcomb']
159− modes = ['schmitt', 'yin', 'fcomb']
170+ modes = ['schmitt', 'yin', 'yinfft', 'mcomb', 'fcomb']
160171
161172 params = taskparams()
162− params.bufsize = 2048
163− params.hopsize = params.bufsize/8
164− params.silence = -60.
173+ params.bufsize = 2048 #4096
174+ params.hopsize = 256
175+ params.silence = -70.
165176 params.pitchsmooth = 0
166177 params.pitchmax = 20000
167178 params.pitchmin = 20
179+ params.pitchyinfft = 0.95
168180 benchpitch = benchpitch(datapath,params=params)
169181 benchpitch.task = taskpitch
170182

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