コード例 #1
0
ファイル: test_gaussmix.py プロジェクト: amcmorl/motorlab
def test_make_p0_pd_appropriate():
    options = gsim.Options()
    #bnd = gsim.get_start_srt(options)
    p0 = gfit_pd.make_p0(options)

    # correct length
    assert_equal(p0.size, 11)

    # check baseline is in range 0:20 Hz, which seems reasonable
    assert_((p0[0] >= 0) & (p0[0] <= 20.)) 

    # check thetas are in range 0:pi, phis in 0:2pi
    thetas = p0[np.array([1,3])]
    assert_(np.all(thetas >= 0.))
    assert_(np.all(thetas < np.pi))
    phi = p0[np.array([2,4])]
    assert_(np.all(phi >= 0.))
    assert_(np.all(phi < (2 * np.pi)))
    
    # check amplitudes are in range 10:150 Hz
    assert_(np.all(p0[5:7] >= 0) & np.all(p0[5:7] <= 150.))
    assert_(np.all(p0[5:7] >= 0) & np.all(p0[5:7] <= 150.))

    # check widths are in range 0:0.5 s
    assert_(np.all(p0[-4:-2] >= 0) & np.all(p0[-4:-2] <= .5))
    assert_(np.all(p0[-4:-2] >= 0) & np.all(p0[-4:-2] <= .5))
    
    # check centers are in range 0:1 s
    assert_(np.all(p0[-2:] >= 0) & np.all(p0[-2:] <= 1))
    assert_(np.all(p0[-2:] >= 0) & np.all(p0[-2:] <= 1))
コード例 #2
0
ファイル: test_gaussmix.py プロジェクト: amcmorl/motorlab
def test_pd_unpackp():
    options = gsim.Options()
    p0 = gfit_pd.make_p0(options)
    b0, pd, amp, width, center = gfit_pd.unpackp(p0, options.n)
    assert_equal(b0, 5)
    assert_array_almost_equal(pd, np.array([[0., 0., 1.], [0., 0., 1.]]))
    assert_equal(amp, [75, 75])
    assert_equal(width, curves.fwhm2k(.3))
    assert_equal(center, [options.tt/3., options.tt * 2 / 3.])