Changeset ee092a8


Ignore:
Timestamp:
Apr 29, 2016, 9:07:05 PM (9 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:
ede5d38
Parents:
c2a39af
Message:

python/tests/test_fft.py: add some memory tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_fft.py

    rc2a39af ree092a8  
    107107        show ()
    108108
     109    def test_local_fftgrain(self):
     110        """ check aubio.fft() result can be accessed after deletion """
     111        def compute_grain(impulse):
     112            win_s = 1024
     113            timegrain = fvec(win_s)
     114            timegrain[0] = impulse
     115            f = fft(win_s)
     116            fftgrain = f ( timegrain )
     117            return fftgrain
     118        impulse = pi
     119        fftgrain = compute_grain(impulse)
     120        assert_equal ( fftgrain.phas[0], 0)
     121        assert_almost_equal ( fftgrain.phas[1], 0)
     122        assert_almost_equal ( fftgrain.norm[0], impulse, decimal = 6 )
     123
     124    def test_local_reconstruct(self):
     125        """ check aubio.fft.rdo() result can be accessed after deletion """
     126        def compute_grain(impulse):
     127            win_s = 1024
     128            timegrain = fvec(win_s)
     129            timegrain[0] = impulse
     130            f = fft(win_s)
     131            fftgrain = f ( timegrain )
     132            r = f.rdo(fftgrain)
     133            return r
     134        impulse = pi
     135        r = compute_grain(impulse)
     136        assert_almost_equal ( r[0], impulse, decimal = 6)
     137        assert_almost_equal ( r[1:], 0)
     138
    109139if __name__ == '__main__':
    110140    from unittest import main
Note: See TracChangeset for help on using the changeset viewer.