move tests/python/demo to tests/, add localaubio.py module helpers
authorPaul Brossier <piem@piem.org>
Sat, 1 Dec 2007 16:56:57 +0000 (17:56 +0100)
committerPaul Brossier <piem@piem.org>
Sat, 1 Dec 2007 16:56:57 +0000 (17:56 +0100)
17 files changed:
tests/demo/bench/onset/Makefile.am [moved from tests/python/bench/onset/Makefile.am with 100% similarity]
tests/demo/bench/onset/bench-delay [moved from tests/python/bench/onset/bench-delay with 100% similarity]
tests/demo/bench/onset/bench-onset [moved from tests/python/bench/onset/bench-onset with 100% similarity]
tests/demo/bench/onset/bench-window [moved from tests/python/bench/onset/bench-window with 100% similarity]
tests/demo/bench/pitch/Makefile.am [moved from tests/python/bench/pitch/Makefile.am with 100% similarity]
tests/demo/bench/pitch/bench-pitch-isolated [moved from tests/python/bench/pitch/bench-pitch-isolated with 100% similarity]
tests/demo/bench/pitch/bench-pitch-plot-isolated [moved from tests/python/bench/pitch/bench-pitch-plot-isolated with 100% similarity]
tests/demo/bench/tempo/demo-tempo [moved from tests/python/bench/tempo/demo-tempo with 100% similarity]
tests/demo/bench/tempo/demo-tempo-acf [moved from tests/python/bench/tempo/demo-tempo-acf with 100% similarity]
tests/demo/localaubio.py [new file with mode: 0644]
tests/demo/plot_mfcc_filterbank.py [moved from tests/python/demo/plot_mfcc_filterbank.py with 95% similarity]
tests/python/localaubio.py [new file with mode: 0644]
tests/python/run_all_tests
tests/python/src/cvec.py
tests/python/src/fvec.py
tests/python/src/onset/peakpick.py
tests/python/template.py

diff --git a/tests/demo/localaubio.py b/tests/demo/localaubio.py
new file mode 100644 (file)
index 0000000..a0d8c20
--- /dev/null
@@ -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
similarity index 95%
rename from tests/python/demo/plot_mfcc_filterbank.py
rename to tests/demo/plot_mfcc_filterbank.py
index fb527f02addcb0491d829fe1326b2372b4962d26..cb1be90744f3dff2eb8ec4be85f2f77e54516c69 100755 (executable)
@@ -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 (file)
index 0000000..ef156a5
--- /dev/null
@@ -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."
index f077a17166e6ce6b8532c95818489bc46978b37b..f16122439ace16f7b5a1c13d60c50cfc8648c185 100755 (executable)
@@ -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
index f1043004d1be2b23f7f77dde096798657482f224..774eb78d7979d2fdbbd454ebca49087f7e9cb709 100644 (file)
@@ -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)
index 98ad1cdc90b6a1934e7e33c57d665e94c0097e7f..afbc23e320c125afa9e9e54f2e89e43132d90c29 100644 (file)
@@ -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)
index 51a7abf2340abb7a97413bb1d8c5cb8f36ac8b3a..fdf1d4176780b80ff9dfd9db42ef0bcd20195de7 100644 (file)
@@ -1,6 +1,5 @@
 from template import aubio_unit_template
-
-from aubio.aubiowrapper import *
+from localaubio import *
 
 buf_size = 7 
 channels = 1
index c5a3c29a27475ebc779f5020752812cfc0b5778d..05d1374ea03fbf58ef9a6660a6a43c6a212add2b 100644 (file)
@@ -1,4 +1,3 @@
-
 import unittest
 
 class aubio_unit_template(unittest.TestCase):