source: python/test/bench/onset/bench-delay @ 83c6734

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 83c6734 was 83c6734, checked in by Paul Brossier <piem@altern.org>, 19 years ago

added bench-window, bench-delay, benchonset
added bench-window, bench-delay, benchonset

  • Property mode set to 100755
File size: 1.8 KB
Line 
1#! /usr/bin/python
2
3from aubio.bench.node import *
4from aubio.tasks import *
5
6from benchonset import mmean, stdev, benchonset
7
8class mybenchonset(benchonset):
9
10        def run_bench(self,modes=['dual'],thresholds=[0.5]):
11                from os.path import dirname,basename
12                self.modes = modes
13                self.thresholds = thresholds
14                self.pretty_titles()
15                for mode in self.modes:
16                        d = []
17                        outplot = "_-_".join(("delay",mode,
18                                basename(self.datadir) ))
19
20                        self.params.onsetmode = mode
21                        self.params.threshold = thresholds[0]
22
23                        self.params.localmin = False
24                        self.params.delay = 0.
25
26                        self.dir_exec()
27                        self.dir_eval()
28                        self.pretty_print()
29                        self.plotdiffs(d,plottitle="Causal")
30
31                        self.params.localmin = True
32                        self.params.delay = 0.
33                        self.dir_exec()
34                        self.dir_eval()
35                        self.pretty_print()
36                        self.plotdiffs(d,plottitle="Local min")
37
38                        self.params.localmin = False
39                        self.params.delay = 6.
40                        self.dir_exec()
41                        self.dir_eval()
42                        self.pretty_print()
43                        self.plotdiffs(d,plottitle="Fixed delay")
44
45                        self.plotplotdiffs(d)
46                        self.plotplotdiffs(d,outplot=outplot,extension="png")
47                        self.plotplotdiffs(d,outplot=outplot,extension="ps")
48                        self.plotplotdiffs(d,outplot=outplot,extension="svg")
49
50
51if __name__ == "__main__":
52        import sys
53        if len(sys.argv) > 1: datapath = sys.argv[1]
54        else: print "ERR: a path is required"; sys.exit(1)
55        modes = ['complex', 'energy', 'phase', 'specdiff', 'kl', 'mkl', 'dual']
56        #modes = [ 'complex' ]
57        thresholds = [ 0.5]
58        #thresholds = [1.5]
59
60        #datapath = "%s%s" % (DATADIR,'/onset/DB/*/')
61        respath = '/var/tmp/DB-testings'
62
63        benchonset = mybenchonset(datapath,respath,checkres=True,checkanno=True)
64        benchonset.params = taskparams()
65        benchonset.task = taskonset
66        benchonset.valuesdict = {}
67
68        try:
69                #benchonset.auto_learn2(modes=modes)
70                benchonset.run_bench(modes=modes,thresholds=thresholds)
71        except KeyboardInterrupt:
72                sys.exit(1)
Note: See TracBrowser for help on using the repository browser.