Changeset 212da72 for tests


Ignore:
Timestamp:
Dec 3, 2007, 10:57:52 AM (16 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
45f1f06
Parents:
dddf1f5 (diff), 6913434 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge from main branch

Location:
tests
Files:
13 added
3 edited
17 moved

Legend:

Unmodified
Added
Removed
  • tests/demo/plot_mfcc_filterbank.py

    rdddf1f5 r212da72  
    55import sys
    66
    7 from aubio.aubiowrapper import *
     7from localaubio import *
    88
    99win_size = 2048
     
    1414filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate,
    1515        0., samplerate)
    16 
    1716
    1817mfcc_filters = []
  • tests/python/examples/aubioonset.py

    rdddf1f5 r212da72  
    11from template import *
    22
    3 class aubioonset_test_case(program_test_case):
     3class aubioonset_unit(program_test_case):
    44 
    55  import os.path
     
    2424    self.getOutput()
    2525    # only one onset in woodblock.aiff
    26     assert len(str(self.output)) != 0, "no output produced with command:\n" \
    27       + self.command
    28     assert len(self.output.split('\n')) == 1
     26    self.assertNotEqual(0, len(str(self.output)), \
     27      "no output produced with command:\n" + self.command)
     28    self.assertEqual(1, len(self.output.split('\n')) )
    2929    # onset should be at 0.00000
    30     assert float(self.output.strip()) == 0.
     30    self.assertEqual(0, float(self.output.strip()))
    3131
    32 for name in ["energy", "specdiff", "hfc", "complex", "phase", "kl", "mkl"]:
    33   exec("class aubioonset_test_case_"+name+"(aubioonset_test_case):\n\
     32list_of_onset_modes = ["energy", "specdiff", "hfc", "complex", "phase", \
     33                      "kl", "mkl", "specflux"]
     34
     35for name in list_of_onset_modes:
     36  exec("class aubioonset_"+name+"_unit(aubioonset_unit):\n\
    3437  options = \" -O "+name+" \"")
    3538
  • tests/python/run_all_tests

    rdddf1f5 r212da72  
    11#! /usr/bin/python
    2 
    3 # add ${src}/python and ${src}/python/aubio/.libs to python path
    4 # so the script is runnable from a compiled source tree.
    5 import sys, os
    6 
    7 cur_dir = os.path.dirname(sys.argv[0])
    8 sys.path.append(os.path.join(cur_dir,'..','..','python'))
    9 sys.path.append(os.path.join(cur_dir,'..','..','python','aubio','.libs'))
    102
    113import unittest
     
    157  return [i.split('.')[0].replace('/','.') for i in glob(path)]
    168
    17 modules_to_test  = list_of_test_files('*.py')
     9modules_to_test  = []
     10modules_to_test += list_of_test_files('src/*.py')
     11modules_to_test += list_of_test_files('src/*/*.py')
    1812modules_to_test += list_of_test_files('examples/aubio*.py')
     13modules_to_test += list_of_test_files('*.py')
    1914
    2015if __name__ == '__main__':
  • tests/python/src/cvec.py

    rdddf1f5 r212da72  
    1 import unittest
    2 
    3 from aubio.aubiowrapper import *
     1from template import aubio_unit_template
     2from localaubio import *
    43
    54buf_size = 2048
    65channels = 3
    76
    8 class cvec_test_case(unittest.TestCase):
     7class cvec_unit(aubio_unit_template):
    98
    109  def setUp(self):
  • tests/python/src/fvec.py

    rdddf1f5 r212da72  
    1 import unittest
    2 
    3 from aubio.aubiowrapper import *
     1from template import aubio_unit_template
     2from localaubio import *
    43
    54buf_size = 2048
    65channels = 3
    76
    8 class fvec_test_case(unittest.TestCase):
     7class fvec_unit(aubio_unit_template):
    98
    109  def setUp(self):
  • tests/python/src/spectral/filterbank.py

    rdddf1f5 r212da72  
    9292  def testmfcc_channels(self):
    9393      """ check the values of each filters in the mfcc filterbank """
     94      import os.path
    9495      self.filterbank = new_aubio_filterbank_mfcc(n_filters, win_size, samplerate,
    9596        0., samplerate)
    9697      filterbank_mfcc = [ [float(f) for f in line.strip().split()]
    97         for line in open('filterbank_mfcc.txt').readlines()]
     98        for line in open(os.path.join('src','spectral','filterbank_mfcc.txt')).readlines()]
    9899      for channel in range(n_filters):
    99100        vec = aubio_filterbank_getchannel(self.filterbank,channel)
  • tests/python/template.py

    rdddf1f5 r212da72  
    1 
    21import unittest
    32
     
    54 
    65  def assertCloseEnough(self, first, second, places=5, msg=None):
    7         """Fail if the two objects are unequal as determined by their
    8            *relative* difference rounded to the given number of decimal places
    9            (default 7) and comparing to zero.
    10         """
    11         if round(first, places) == 0:
    12           if round(second-first, places) != 0:
    13               raise self.failureException, \
    14                     (msg or '%r != %r within %r places' % (first, second, places))
    15         else:
    16           if round((second-first)/first, places) != 0:
    17               raise self.failureException, \
    18                     (msg or '%r != %r within %r places' % (first, second, places))
     6    """Fail if the two objects are unequal as determined by their
     7       *relative* difference rounded to the given number of decimal places
     8       (default 7) and comparing to zero.
     9    """
     10    if round(first, places) == 0:
     11      if round(second-first, places) != 0:
     12        raise self.failureException, \
     13              (msg or '%r != %r within %r places' % (first, second, places))
     14    else:
     15      if round((second-first)/first, places) != 0:
     16        raise self.failureException, \
     17              (msg or '%r != %r within %r places' % (first, second, places))
Note: See TracChangeset for help on using the changeset viewer.