def test_parameter_linked():
    p = Parameter('foo', 'x1', 1.2)
    q = Parameter('bar', 'x2', 2.2)
    p.val = 2 + q
    r = p._repr_html_()

    assert r is not None

    assert '<summary>Parameter</summary>' in r
    assert '<table class="model">' in r
    assert '<th class="model-odd">foo</th><td>x1</td><td>linked</td><td>4.2</td><td colspan="2">&#8656; 2 + bar.x2</td><td></td></tr>' in r
Exemplo n.º 2
0
        set_stat('chi2gehrels')
        pl = get_fit_plot(id)
        myplot = dict(counts=int(get_data(id).counts.sum()),
                      background_counts=int(get_bkg(id).counts.sum()),
                      data=pl.dataplot.y.tolist(),
                      dataerr=pl.dataplot.yerr.tolist(),
                      x=pl.dataplot.x.tolist(),
                      xerr=pl.dataplot.xerr.tolist(),
                      instances=[])
        for row in a.get_equal_weighted_posterior():
            for p, v in zip(parameters, row):
                p.val = v
            pl = get_fit_plot(id)
            myplot['instances'].append(pl.modelplot.y.tolist())

        srcnh.val = 20
        pl = get_fit_plot(id)
        myplot['unabsorbed'] = pl.modelplot.y.tolist()

        galabso.nH = 0
        pl = get_fit_plot(id)
        myplot['nogal'] = pl.modelplot.y.tolist()

        set_full_model(id, get_bkg_model(id) * get_bkg_scale(id))
        pl = get_fit_plot(id)
        myplot['background'] = pl.modelplot.y.tolist()
        set_stat('cstat')
        json.dump(myplot, open('%sfit.json' % outputfiles_basename, 'w'))
    if not os.path.exists('%sfit2.json' % outputfiles_basename) and id2:
        print('collecting fit2 plot data')
        set_analysis(id2, 'ener', 'counts')
Exemplo n.º 3
0
		print('collecting fit plot data')
		set_analysis(id, 'ener', 'counts')
		group_counts(id, 40)
		set_stat('chi2gehrels')
		pl = get_fit_plot(id)
		myplot = dict(counts=int(get_data(id).counts.sum()), background_counts=int(get_bkg(id).counts.sum()),
			data=pl.dataplot.y.tolist(), dataerr=pl.dataplot.yerr.tolist(), 
			x=pl.dataplot.x.tolist(), xerr=pl.dataplot.xerr.tolist(),
			instances=[])
		for row in a.get_equal_weighted_posterior():
			for p, v in zip(parameters, row):
				p.val = v
			pl = get_fit_plot(id)
			myplot['instances'].append(pl.modelplot.y.tolist())

		srcnh.val = 20
		pl = get_fit_plot(id)
		myplot['unabsorbed'] = pl.modelplot.y.tolist()

		galabso.nH = 0
		pl = get_fit_plot(id)
		myplot['nogal'] = pl.modelplot.y.tolist()

		set_full_model(id, get_bkg_model(id) * get_bkg_scale(id))
		pl = get_fit_plot(id)
		myplot['background'] = pl.modelplot.y.tolist()
		set_stat('cstat')
		json.dump(myplot, open('%sfit.json' % outputfiles_basename, 'w'))
	if not os.path.exists('%sfit2.json' % outputfiles_basename) and id2:
		print('collecting fit2 plot data')
		set_analysis(id2, 'ener', 'counts')