Changeset dfada33


Ignore:
Timestamp:
May 2, 2016, 12:02:06 PM (8 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:
8147e03
Parents:
ad5eae8
Message:

python/tests/test_phasevoc.py: simplify, add wrong sized input tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_phasevoc.py

    rad5eae8 rdfada33  
    33from numpy.testing import TestCase, assert_equal, assert_array_less
    44from aubio import fvec, cvec, pvoc, float_type
    5 from numpy import array, shape
    6 from numpy.random import random
    75from nose2.tools import params
    86import numpy as np
     
    5048            assert_equal ( s.phas, 0.)
    5149            assert_equal ( r, 0.)
    52 
    53     def test_resynth_8_steps_sine(self):
    54         """ check the resynthesis of is correct with 87.5% overlap """
    55         hop_s = 1024
    56         ratio = 8
    57         freq = 445; samplerate = 22050
    58         sigin = create_sine(hop_s, freq, samplerate)
    59         self.reconstruction( sigin, hop_s, ratio)
    60 
    61     def test_resynth_8_steps(self):
    62         """ check the resynthesis of is correct with 87.5% overlap """
    63         hop_s = 1024
    64         ratio = 8
    65         sigin = create_noise(hop_s)
    66         self.reconstruction(sigin, hop_s, ratio)
    67 
    68     def test_resynth_4_steps_sine(self):
    69         """ check the resynthesis of is correct with 87.5% overlap """
    70         hop_s = 1024
    71         ratio = 4
    72         freq = 445; samplerate = 22050
    73         sigin = create_sine(hop_s, freq, samplerate)
    74         self.reconstruction(sigin, hop_s, ratio)
    75 
    76     def test_resynth_4_steps(self):
    77         """ check the resynthesis of is correct with 75% overlap """
    78         hop_s = 1024
    79         ratio = 4
    80         sigin = create_noise(hop_s)
    81         self.reconstruction(sigin, hop_s, ratio)
    82 
    83     def test_resynth_2_steps_sine(self):
    84         """ check the resynthesis of is correct with 50% overlap """
    85         hop_s = 1024
    86         ratio = 2
    87         freq = 445; samplerate = 22050
    88         sigin = create_sine(hop_s, freq, samplerate)
    89         self.reconstruction(sigin, hop_s, ratio)
    90 
    91     def test_resynth_2_steps(self):
    92         """ check the resynthesis of is correct with 50% overlap """
    93         hop_s = 1024
    94         ratio = 2
    95         sigin = create_noise(hop_s)
    96         self.reconstruction(sigin, hop_s, ratio)
    9750
    9851    @params(
     
    154107        assert_array_less(sq_error, max_sq_error)
    155108
     109    def test_large_input_timegrain(self):
     110        win_s = 1024
     111        f = pvoc(win_s)
     112        t = fvec(win_s + 1)
     113        with self.assertRaises(ValueError):
     114            f(t)
     115
     116    def test_small_input_timegrain(self):
     117        win_s = 1024
     118        f = pvoc(win_s)
     119        t = fvec(1)
     120        with self.assertRaises(ValueError):
     121            f(t)
     122
     123    def test_large_input_fftgrain(self):
     124        win_s = 1024
     125        f = pvoc(win_s)
     126        s = cvec(win_s + 5)
     127        with self.assertRaises(ValueError):
     128            f.rdo(s)
     129
     130    def test_small_input_fftgrain(self):
     131        win_s = 1024
     132        f = pvoc(win_s)
     133        s = cvec(16)
     134        with self.assertRaises(ValueError):
     135            f.rdo(s)
     136
    156137if __name__ == '__main__':
    157138    from nose2 import main
Note: See TracChangeset for help on using the changeset viewer.