Exemplo n.º 1
0
def test_armafft():
    #test other methods
    nfreq = 20
    w = np.linspace(0, np.pi, nfreq, endpoint=False)
    for ar in arlist:
        for ma in malist:
            arma = ArmaFft(ar, ma, 20)
            ac1 = arma.invpowerspd(1024)[:10]
            ac2 = arma.acovf(10)[:10]
            assert_almost_equal(ac1,
                                ac2,
                                decimal=7,
                                err_msg='acovf not equal for %s, %s' %
                                (ar, ma))
Exemplo n.º 2
0
def test_spectrum():
    nfreq = 20
    w = np.linspace(0, np.pi, nfreq, endpoint=False)
    for ar in arlist:
        for ma in malist:
            arma = ArmaFft(ar, ma, 20)
            spdr, wr = arma.spdroots(w)
            spdp, wp = arma.spdpoly(w, 200)
            spdd, wd = arma.spddirect(nfreq * 2)
            assert_equal(w, wr)
            assert_equal(w, wp)
            assert_almost_equal(w, wd[:nfreq], decimal=14)
            assert_almost_equal(spdr,
                                spdp,
                                decimal=7,
                                err_msg='spdr spdp not equal for %s, %s' %
                                (ar, ma))
            assert_almost_equal(spdr,
                                spdd[:nfreq],
                                decimal=7,
                                err_msg='spdr spdd not equal for %s, %s' %
                                (ar, ma))