source: python.old/tests_demo_bench/onset/bench-delay @ a341685

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

moved old python stuff out of tests/

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