From 974dddc7e5fc66721c791c6dac2582395f1f39ea Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 1 Dec 2007 17:56:57 +0100 Subject: [PATCH] move tests/python/demo to tests/, add localaubio.py module helpers --- tests/{python => demo}/bench/onset/Makefile.am | 0 tests/{python => demo}/bench/onset/bench-delay | 0 tests/{python => demo}/bench/onset/bench-onset | 0 .../{python => demo}/bench/onset/bench-window | 0 tests/{python => demo}/bench/pitch/Makefile.am | 0 .../bench/pitch/bench-pitch-isolated | 0 .../bench/pitch/bench-pitch-plot-isolated | 0 tests/{python => demo}/bench/tempo/demo-tempo | 0 .../bench/tempo/demo-tempo-acf | 0 tests/demo/localaubio.py | 13 +++++++++++++ .../{python => }/demo/plot_mfcc_filterbank.py | 3 +-- tests/python/localaubio.py | 18 ++++++++++++++++++ tests/python/run_all_tests | 8 -------- tests/python/src/cvec.py | 7 +++---- tests/python/src/fvec.py | 7 +++---- tests/python/src/onset/peakpick.py | 3 +-- tests/python/template.py | 1 - 17 files changed, 39 insertions(+), 21 deletions(-) rename tests/{python => demo}/bench/onset/Makefile.am (100%) rename tests/{python => demo}/bench/onset/bench-delay (100%) rename tests/{python => demo}/bench/onset/bench-onset (100%) rename tests/{python => demo}/bench/onset/bench-window (100%) rename tests/{python => demo}/bench/pitch/Makefile.am (100%) rename tests/{python => demo}/bench/pitch/bench-pitch-isolated (100%) rename tests/{python => demo}/bench/pitch/bench-pitch-plot-isolated (100%) rename tests/{python => demo}/bench/tempo/demo-tempo (100%) rename tests/{python => demo}/bench/tempo/demo-tempo-acf (100%) create mode 100644 tests/demo/localaubio.py rename tests/{python => }/demo/plot_mfcc_filterbank.py (95%) create mode 100644 tests/python/localaubio.py diff --git a/tests/python/bench/onset/Makefile.am b/tests/demo/bench/onset/Makefile.am similarity index 100% rename from tests/python/bench/onset/Makefile.am rename to tests/demo/bench/onset/Makefile.am diff --git a/tests/python/bench/onset/bench-delay b/tests/demo/bench/onset/bench-delay similarity index 100% rename from tests/python/bench/onset/bench-delay rename to tests/demo/bench/onset/bench-delay diff --git a/tests/python/bench/onset/bench-onset b/tests/demo/bench/onset/bench-onset similarity index 100% rename from tests/python/bench/onset/bench-onset rename to tests/demo/bench/onset/bench-onset diff --git a/tests/python/bench/onset/bench-window b/tests/demo/bench/onset/bench-window similarity index 100% rename from tests/python/bench/onset/bench-window rename to tests/demo/bench/onset/bench-window diff --git a/tests/python/bench/pitch/Makefile.am b/tests/demo/bench/pitch/Makefile.am similarity index 100% rename from tests/python/bench/pitch/Makefile.am rename to tests/demo/bench/pitch/Makefile.am diff --git a/tests/python/bench/pitch/bench-pitch-isolated b/tests/demo/bench/pitch/bench-pitch-isolated similarity index 100% rename from tests/python/bench/pitch/bench-pitch-isolated rename to tests/demo/bench/pitch/bench-pitch-isolated diff --git a/tests/python/bench/pitch/bench-pitch-plot-isolated b/tests/demo/bench/pitch/bench-pitch-plot-isolated similarity index 100% rename from tests/python/bench/pitch/bench-pitch-plot-isolated rename to tests/demo/bench/pitch/bench-pitch-plot-isolated diff --git a/tests/python/bench/tempo/demo-tempo b/tests/demo/bench/tempo/demo-tempo similarity index 100% rename from tests/python/bench/tempo/demo-tempo rename to tests/demo/bench/tempo/demo-tempo diff --git a/tests/python/bench/tempo/demo-tempo-acf b/tests/demo/bench/tempo/demo-tempo-acf similarity index 100% rename from tests/python/bench/tempo/demo-tempo-acf rename to tests/demo/bench/tempo/demo-tempo-acf diff --git a/tests/demo/localaubio.py b/tests/demo/localaubio.py new file mode 100644 index 00000000..a0d8c20f --- /dev/null +++ b/tests/demo/localaubio.py @@ -0,0 +1,13 @@ + +try: + from aubio.aubiowrapper import * +except ImportError: + try: + import os + import sys + cur_dir = os.path.dirname(sys.argv[0]) + sys.path.append(os.path.join(cur_dir,'..','..','python')) + sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs')) + from aubio.aubiowrapper import * + except ImportError: + raise diff --git a/tests/python/demo/plot_mfcc_filterbank.py b/tests/demo/plot_mfcc_filterbank.py similarity index 95% rename from tests/python/demo/plot_mfcc_filterbank.py rename to tests/demo/plot_mfcc_filterbank.py index fb527f02..cb1be907 100755 --- a/tests/python/demo/plot_mfcc_filterbank.py +++ b/tests/demo/plot_mfcc_filterbank.py @@ -4,7 +4,7 @@ import pylab import numpy import sys -from aubio.aubiowrapper import * +from localaubio import * win_size = 2048 channels = 1 @@ -14,7 +14,6 @@ samplerate = 44100 filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate, 0., samplerate) - mfcc_filters = [] for channel in range(n_filters): vec = aubio_filterbank_getchannel(filterbank,channel) diff --git a/tests/python/localaubio.py b/tests/python/localaubio.py new file mode 100644 index 00000000..ef156a53 --- /dev/null +++ b/tests/python/localaubio.py @@ -0,0 +1,18 @@ + +# add ${src}/python and ${src}/python/aubio/.libs to python path +# so the script is runnable from a compiled source tree. + +try: + from aubio.aubiowrapper import * +except ImportError: + try: + import os + import sys + cur_dir = os.path.dirname(sys.argv[0]) + sys.path.append(os.path.join(cur_dir,'..','..','python')) + sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs')) + from aubio.aubiowrapper import * + except ImportError: + raise +else: + raise ImportError, "Note: the aubio module could be imported without adding the source directory to your path." diff --git a/tests/python/run_all_tests b/tests/python/run_all_tests index f077a171..f1612243 100755 --- a/tests/python/run_all_tests +++ b/tests/python/run_all_tests @@ -1,13 +1,5 @@ #! /usr/bin/python -# add ${src}/python and ${src}/python/aubio/.libs to python path -# so the script is runnable from a compiled source tree. -import sys, os - -cur_dir = os.path.dirname(sys.argv[0]) -sys.path.append(os.path.join(cur_dir,'..','..','python')) -sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs')) - import unittest from glob import glob diff --git a/tests/python/src/cvec.py b/tests/python/src/cvec.py index f1043004..774eb78d 100644 --- a/tests/python/src/cvec.py +++ b/tests/python/src/cvec.py @@ -1,11 +1,10 @@ -import unittest - -from aubio.aubiowrapper import * +from template import aubio_unit_template +from localaubio import * buf_size = 2048 channels = 3 -class cvec_test_case(unittest.TestCase): +class cvec_unit(aubio_unit_template): def setUp(self): self.vector = new_cvec(buf_size, channels) diff --git a/tests/python/src/fvec.py b/tests/python/src/fvec.py index 98ad1cdc..afbc23e3 100644 --- a/tests/python/src/fvec.py +++ b/tests/python/src/fvec.py @@ -1,11 +1,10 @@ -import unittest - -from aubio.aubiowrapper import * +from template import aubio_unit_template +from localaubio import * buf_size = 2048 channels = 3 -class fvec_test_case(unittest.TestCase): +class fvec_unit(aubio_unit_template): def setUp(self): self.vector = new_fvec(buf_size, channels) diff --git a/tests/python/src/onset/peakpick.py b/tests/python/src/onset/peakpick.py index 51a7abf2..fdf1d417 100644 --- a/tests/python/src/onset/peakpick.py +++ b/tests/python/src/onset/peakpick.py @@ -1,6 +1,5 @@ from template import aubio_unit_template - -from aubio.aubiowrapper import * +from localaubio import * buf_size = 7 channels = 1 diff --git a/tests/python/template.py b/tests/python/template.py index c5a3c29a..05d1374e 100644 --- a/tests/python/template.py +++ b/tests/python/template.py @@ -1,4 +1,3 @@ - import unittest class aubio_unit_template(unittest.TestCase): -- 2.26.2