示例#1
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)
示例#2
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)