Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(24)  |  Call(18)  |  Derive(0)  |  Import(6)

src/c/o/cogent-1.5.3/tests/test_maths/test_period.py   cogent(Download)
from numpy import arange, convolve, random, sin, pi, exp, array, zeros, float64
from cogent.util.unit_test import TestCase, main
 
from cogent.maths.period import ipdft, dft, auto_corr, hybrid, goertzel
 
    def test_ipdft(self):
        """correctly compute integer discrete fourier transform"""
        s = [0, 1, 0, -1, 0, 1, 0, -1]
        X, periods = ipdft(s, llim=1, ulim=len(s))
        exp_X = abs(array([0, 0, -1.5+0.866j, -4j, 2.927-0.951j, 1.5+0.866j,
                          0.302+0.627j, 0]))
        X = abs(X)
        self.assertFloatEqual(X, exp_X, eps=1e-3)
 
        ipdft_x, ipdft_periods = ipdft(self.sig, llim=2, ulim=50)
    def test_goertzel(self):
        """goertzel and ipdft should be the same"""
        ipdft_pwr, ipdft_prd = ipdft(self.sig, llim=10, ulim=10)
        self.assertFloatEqual(goertzel(self.sig, 10), ipdft_pwr)
 
    def test_hybrid_returns_all(self):
        """correctly returns hybrid, ipdft and autocorr statistics"""
        ipdft_pwr, ipdft_prd = ipdft(self.sig, llim=2, ulim=50)
        auto_x, auto_periods = auto_corr(self.sig, llim=2, ulim=50)
        hybrid_x, hybrid_periods = hybrid(self.sig, llim=None, ulim=50)

src/p/y/pycogent-HEAD/tests/test_maths/test_period.py   pycogent(Download)
from numpy import arange, convolve, random, sin, pi, exp, array, zeros, float64
from cogent.util.unit_test import TestCase, main
 
from cogent.maths.period import ipdft, dft, auto_corr, hybrid, goertzel
 
    def test_ipdft(self):
        """correctly compute integer discrete fourier transform"""
        s = [0, 1, 0, -1, 0, 1, 0, -1]
        X, periods = ipdft(s, llim=1, ulim=len(s))
        exp_X = abs(array([0, 0, -1.5+0.866j, -4j, 2.927-0.951j, 1.5+0.866j,
                          0.302+0.627j, 0]))
        X = abs(X)
        self.assertFloatEqual(X, exp_X, eps=1e-3)
 
        ipdft_x, ipdft_periods = ipdft(self.sig, llim=2, ulim=50)
    def test_goertzel(self):
        """goertzel and ipdft should be the same"""
        ipdft_pwr, ipdft_prd = ipdft(self.sig, llim=10, ulim=10)
        self.assertFloatEqual(goertzel(self.sig, 10), ipdft_pwr)
 
    def test_hybrid_returns_all(self):
        """correctly returns hybrid, ipdft and autocorr statistics"""
        ipdft_pwr, ipdft_prd = ipdft(self.sig, llim=2, ulim=50)
        auto_x, auto_periods = auto_corr(self.sig, llim=2, ulim=50)
        hybrid_x, hybrid_periods = hybrid(self.sig, llim=None, ulim=50)

src/c/o/cogent-1.5.3/tests/test_maths/test_stats/test_period.py   cogent(Download)
    def test_g_statitic(self):
        """calc g-stat correctly"""
        X, periods = ipdft(self.sig, llim=2, ulim=39)
        g_obs, p_val = g_statistic(X)
        self.assertFloatEqual(p_val, 0.9997, eps=1e-3)

src/p/y/pycogent-HEAD/tests/test_maths/test_stats/test_period.py   pycogent(Download)
    def test_g_statitic(self):
        """calc g-stat correctly"""
        X, periods = ipdft(self.sig, llim=2, ulim=39)
        g_obs, p_val = g_statistic(X)
        self.assertFloatEqual(p_val, 0.9997, eps=1e-3)

src/p/y/pycogent-HEAD/tests/test_maths/test_stats/test_period.py   pycogent(Download)
        circular_indices, _seq_to_symbols, seq_to_symbols, blockwise_bootstrap, \
        SeqToSymbols
from cogent.maths.period import ipdft, hybrid, auto_corr, Hybrid, Ipdft, \
        AutoCorrelation
 

src/c/o/cogent-1.5.3/tests/test_maths/test_stats/test_period.py   cogent(Download)
        circular_indices, _seq_to_symbols, seq_to_symbols, blockwise_bootstrap, \
        SeqToSymbols
from cogent.maths.period import ipdft, hybrid, auto_corr, Hybrid, Ipdft, \
        AutoCorrelation