Esempio n. 1
0
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.])
Esempio n. 2
0
def test_pd_make_p_from_options():
    options = gsim.Options()
    pset = gfit_pd.make_p_from_options(options)
    b0, pd, amp, width, center = gfit_pd.unpackp(pset, options.n)
    assert_equal(pd.shape, [options.n,3])
    assert_equal(b0, options.b0)
    assert_array_almost_equal(pd, options.pd)
    assert_equal(amp, options.amp)
    assert_equal(width, options.width)
    assert_equal(center, options.center)
Esempio n. 3
0
def test_fit_pd_sim_compatibility():
    options = gsim.Options()
    bnd = gsim.get_start_srt(options)

    # test if gfit_amp.gsmx with pset gives same result
    # as gsim.make_template with amp and pd
    bin = np.linspace(0, options.tt, options.nbin + 1)
    theta = gmix.expand_theta(gmix.calc_theta_target(bnd.parent.tasks,
                                                     options.pd), bnd)
    res0 = gsim.make_template(bin, options.amp, options.width,
                              options.center, theta)
    pset = gfit_pd.make_p_from_options(bnd, options)
    b0, pd, amp, width, center = gfit_pd.unpackp(pset, options.n)
    res1 = gfit_pd.gsmx(bin, bnd.parent.tasks, pd, amp, width, center)
    res1b = np.tile(res1[:,None,:], (1, bnd.PSTHs.shape[1], 1))
    assert_array_almost_equal(res0, res1b)