def test_amp_make_p_from_options(): options = gsim.Options() dc = dcol.DataCollection(options.files) pset = gfit_amp.make_p_from_options(dc.tasks, options) ntask = dc.tasks.shape[0] assert_equal(pset.shape, (options.n * (ntask + 2) + 1,)) b0, amp, width, center = gfit_amp.unpackp(pset, options.n) assert_equal(b0, options.b0) assert_equal(width, options.width) assert_equal(center, options.center)
def test_fit_amp_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_amp.make_p_from_options(bnd.parent.tasks, options) b0, amp, width, center = gfit_amp.unpackp(pset, options.n) res1 = gfit_amp.gsmx(bin, amp, width, center) res1b = np.tile(res1[:,None,:], (1, bnd.PSTHs.shape[1], 1)) assert_array_almost_equal(res0, res1b)