#
# The pytest.param calls seem to get recorded as 2 xfails; I think
# this is for the error and because of warning messages, but it is not
# clear.
#
@requires_data
@requires_fits
@pytest.mark.parametrize("stat",
                         [None,
                          stats.Chi2(),
                          stats.Chi2ConstVar(),
                          stats.Chi2DataVar(),
                          stats.Chi2Gehrels(),
                          stats.Chi2ModVar(),
                          stats.Chi2XspecVar(),
                          stats.LeastSq(),
                          stats.Cash(),
                          stats.CStat(),
                          stats.WStat()])
def test_astro_data_plot_with_stat_simple(make_data_path, stat):

    from sherpa.astro import io

    infile = make_data_path('3c273.pi')
    pha = io.read_pha(infile)

    # tweak the data set so that we aren't using the default
    # options (it shouldn't matter for this test but just
    # in case).
    #
    # Note that background subtraction would normally be an issue
Esempio n. 2
0
g2.pos = g1.pos + 0.5
g1.fwhm = 0.1
g2.fwhm = 0.1

print(mdl)

ystart = mdl(x)

mplot = plot.ModelPlot()
mplot.prepare(d, mdl)

print(">>> dplot.plot()")
print(">>> mplot.plot(overplot=True)")
print(">>> save to _static/models/combine/model_combine_start.png")

f = fit.Fit(d, mdl, stats.LeastSq())
res = f.fit()
print(res.succeeded)

fplot = plot.FitPlot()
mplot.prepare(d, mdl)
fplot.prepare(dplot, mplot)
print(">>> fplot.plot()")
print(">>> plt.plot(x, ystart, label='Start')")
print(">>> plt.legend(loc=2)")
print(">>> save as docs/_static/models/combine/model_combine.png")

print(mdl)

for p in mdl.pars:
    if p.link is None: