本文整理汇总了Python中sherpa.astro.ui.get_fit_results函数的典型用法代码示例。如果您正苦于以下问题:Python get_fit_results函数的具体用法?Python get_fit_results怎么用?Python get_fit_results使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_fit_results函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_radpro_psf
def test_radpro_psf(self):
self.run_thread('radpro_psf')
self.assertEqualWithinTol(ui.get_fit_results().statval, 200.949, 1e-4)
self.assertEqualWithinTol(self.locals['src'].r0.val, 83.0997, 1e-4)
self.assertEqualWithinTol(self.locals['src'].beta.val, 2.97737, 1e-4)
self.assertEqualWithinTol(self.locals['src'].ampl.val, 5.27604, 1e-4)
self.assertEqual(ui.get_fit_results().nfev,48)
self.assertEqual(ui.get_fit_results().numpoints,38)
self.assertEqual(ui.get_fit_results().dof,35)
示例2: test_kernel
def test_kernel(self):
self.run_thread('kernel')
self.assertEqualWithinTol(ui.get_fit_results().statval, 98.5793, 1e-4)
self.assertEqualWithinTol(self.locals['b1'].r0.val, 19.2278, 1e-4)
self.assertEqualWithinTol(self.locals['b1'].beta.val, 0.555464, 1e-4)
self.assertEqualWithinTol(self.locals['b1'].ampl.val, 1.93706, 1e-4)
self.assertEqual(ui.get_fit_results().nfev,21)
self.assertEqual(ui.get_fit_results().numpoints,75)
self.assertEqual(ui.get_fit_results().dof,72)
示例3: test_linepro
def test_linepro(self):
self.run_thread('linepro')
self.assertEqualWithinTol(ui.get_fit_results().statval, 203.34, 1e-4)
self.assertEqualWithinTol(self.locals['b1'].r0.val, 4.25557, 1e-4)
self.assertEqualWithinTol(self.locals['b1'].beta.val, 0.492232, 1e-4)
self.assertEqualWithinTol(self.locals['b1'].ampl.val, 11.8129, 1e-4)
self.assertEqual(ui.get_fit_results().nfev,17)
self.assertEqual(ui.get_fit_results().numpoints,75)
self.assertEqual(ui.get_fit_results().dof,72)
示例4: test_histo
def test_histo(self):
self.run_thread('histo')
self.assertEqualWithinTol(ui.get_fit_results().statval, 14.7264, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].fwhm.val, 0.0232473, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].pos.val, 1.26713, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].ampl.val, 40.4503, 1e-4)
#self.assertEqual(ui.get_fit_results().nfev,19)
self.assertEqual(ui.get_fit_results().numpoints,50)
self.assertEqual(ui.get_fit_results().dof,47)
示例5: test_xmm
def test_xmm(self):
self.run_thread('xmm')
self.assertEqualWithinTol(ui.get_fit_results().statval, 118.085, 1e-4)
self.assertEqualWithinTol(self.locals['intrin'].nh.val, 11.0769, 1e-2)
self.assertEqualWithinTol(self.locals['phard'].phoindex.val, 1.49055, 1e-2)
self.assertEqualWithinTol(self.locals['phard'].norm.val, 0.00140301, 1e-2)
self.assertEqual(ui.get_fit_results().nfev,95)
self.assertEqual(ui.get_fit_results().numpoints,162)
self.assertEqual(ui.get_fit_results().dof,159)
示例6: test_spectrum
def test_spectrum(self):
self.run_thread('spectrum')
self.assertEqualWithinTol(ui.get_fit_results().statval, 0.0496819, 1e-4)
self.assertEqualWithinTol(self.locals['abs2'].nh.val, 1.1015, 1e-4)
self.assertEqualWithinTol(self.locals['mek1'].kt.val, 0.841025, 1e-4)
self.assertEqualWithinTol(self.locals['mek1'].norm.val, 0.699761, 1e-4)
self.assertEqualWithinTol(self.locals['mek2'].kt.val, 2.35845, 1e-4)
self.assertEqualWithinTol(self.locals['mek2'].norm.val, 1.03724, 1e-4)
self.assertEqual(ui.get_fit_results().numpoints,446)
self.assertEqual(ui.get_fit_results().dof,441)
示例7: test_psf2d
def test_psf2d(self):
self.run_thread('psf')
self.assertEqualWithinTol(ui.get_fit_results().statval, 4066.78, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].fwhm.val, 2.80117, 1e-2)
self.assertEqualWithinTol(self.locals['g1'].ypos.val, 77.2271, 1e-2)
self.assertEqualWithinTol(self.locals['g1'].xpos.val, 88.661, 1e-2)
self.assertEqualWithinTol(self.locals['g1'].ampl.val, 166.649, 1e-2)
#self.assertEqual(ui.get_fit_results().nfev,342)
self.assertEqual(ui.get_fit_results().numpoints,4899)
self.assertEqual(ui.get_fit_results().dof,4895)
示例8: test_simultaneous
def test_simultaneous(self):
self.run_thread('simultaneous')
self.assertEqualWithinTol(ui.get_fit_results().statval, 7.4429, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().rstat, 0.531636, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().qval, 0.916288, 1e-4)
self.assertEqualWithinTol(self.locals['abs1'].nh.val, 0.898162, 1e-2)
self.assertEqualWithinTol(self.locals['pl1'].gamma.val, 1.645, 1e-4)
self.assertEqualWithinTol(self.locals['pl1'].ampl.val, 2.28323e-05, 1e-3)
self.assertEqualWithinTol(self.locals['pl2'].ampl.val, 2.44585e-05, 1e-3)
self.assertEqual(ui.get_fit_results().numpoints,18)
self.assertEqual(ui.get_fit_results().dof,14)
示例9: test_lev3fft
def test_lev3fft(self):
self.run_thread('lev3fft', scriptname='bar.py')
self.assertEqualWithinTol(self.locals['src'].fwhm.val, 0.04418584, 1e-4)
self.assertEqualWithinTol(self.locals['src'].xpos.val, 150.016, 1e-4)
self.assertEqualWithinTol(self.locals['src'].ypos.val, 2.66493839, 1e-4)
self.assertEqualWithinTol(self.locals['src'].ampl.val, 1.56090546, 1e-4)
self.assertEqualWithinTol(self.locals['bkg'].c0.val, -1.513700715, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().istatval, 19496.3, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().statval, 592.32647, 1e-4)
self.assertEqual(ui.get_fit_results().numpoints, 3307)
self.assertEqual(ui.get_fit_results().dof, 3302)
示例10: test_pileup
def test_pileup(self):
self.run_thread('pileup')
self.assertEqualWithinTol(ui.get_fit_results().statval, 53.6112, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().rstat, 1.44895, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().qval, 0.0379417, 1e-4)
self.assertEqualWithinTol(self.locals['jdp'].alpha.val, 0.522593, 1e-1)
self.assertEqualWithinTol(self.locals['jdp'].f.val, 0.913458, 1e-2)
self.assertEqualWithinTol(self.locals['abs1'].nh.val, 6.12101, 1e-2)
self.assertEqualWithinTol(self.locals['power'].gamma.val, 1.41887, 1e-2)
self.assertEqualWithinTol(self.locals['power'].ampl.val, 0.00199457, 1e-2)
self.assertEqual(ui.get_fit_results().numpoints,42)
self.assertEqual(ui.get_fit_results().dof,37)
示例11: test_sourceandbg
def test_sourceandbg(self):
self.run_thread('sourceandbg')
self.assertEqualWithinTol(ui.get_fit_results().statval, 947.5, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().rstat, 0.715094, 1e-4)
self.assertEqualWithinTol(ui.get_fit_results().qval, 1, 1e-4)
self.assertEqualWithinTol(self.locals['a1'].nh.val, 0.0342266, 1e-2)
self.assertEqualWithinTol(self.locals['b1'].kt.val, 20, 1e-2)
self.assertEqualWithinTol(self.locals['b1'].norm.val, 0.00953809, 1e-2)
self.assertEqualWithinTol(self.locals['b2'].kt.val, 0.563109, 1e-2)
self.assertEqualWithinTol(self.locals['b2'].norm.val, 1.16118e-05, 1e-2)
self.assertEqual(ui.get_fit_results().numpoints,1330)
self.assertEqual(ui.get_fit_results().dof,1325)
示例12: test_spatial
def test_spatial(self):
self.run_thread('spatial')
self.assertEqualWithinTol(ui.get_fit_results().statval, -59229.749441, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].fwhm.val, 61.5615, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].xpos.val, 4070.45, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].ypos.val, 4251.35, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].ampl.val, 22.1269, 1e-4)
self.assertEqualWithinTol(self.locals['g2'].fwhm.val, 6.20409, 1e-4)
self.assertEqualWithinTol(self.locals['g2'].xpos.val, 4070.78, 1e-4)
self.assertEqualWithinTol(self.locals['g2'].ypos.val, 4249.33, 1e-4)
self.assertEqualWithinTol(self.locals['g2'].ampl.val, 226.563, 1e-4)
#self.assertEqual(ui.get_fit_results().nfev,371)
self.assertEqual(ui.get_fit_results().numpoints,4881)
self.assertEqual(ui.get_fit_results().dof,4877)
示例13: test_fpsf2d
def test_fpsf2d(self):
self.run_thread('fpsf')
self.assertEqualWithinTol(ui.get_fit_results().statval, -4053.6635, 1e-4)
# self.assertEqualWithinTol(self.locals['b1'].xlow.val, -4.70832, 1e-4)
# self.assertEqualWithinTol(self.locals['b1'].xhi.val, 164.687, 1e-4)
# self.assertEqualWithinTol(self.locals['b1'].ylow.val, 0.83626, 1e-4)
# self.assertEqualWithinTol(self.locals['b1'].yhi.val, 142.603, 1e-4)
# self.assertEqualWithinTol(self.locals['b1'].ampl.val, 0.956766, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].fwhm.val, 6.420237, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].xpos.val, 88.940712, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].ypos.val, 76.577265, 1e-4)
self.assertEqualWithinTol(self.locals['g1'].ampl.val, 36344.48324, 1e-4)
#self.assertEqual(ui.get_fit_results().nfev,978)
self.assertEqual(ui.get_fit_results().numpoints,4899)
self.assertEqual(ui.get_fit_results().dof,4895)
示例14: test_eqwith_err1
def test_eqwith_err1(make_data_path, restore_xspec_settings):
def check1(e0, e1, e2):
assert e0 == approx(0.028335201547206704, rel=1.0e-3)
assert e1 == approx(-0.00744118799274448756, rel=1.0e-3)
assert e2 == approx(0.0706249544851336, rel=1.0e-3)
ui.set_xsabund('angr')
ui.set_xsxsect('bcmc')
ui.load_pha(make_data_path('3c273.pi'))
ui.notice(0.5, 7.0)
ui.set_stat("chi2datavar")
ui.set_method("simplex")
ui.set_model('powlaw1d.p1+gauss1d.g1')
g1.fwhm = 0.1
g1.pos = 2.0
ui.freeze(g1.pos, g1.fwhm)
ui.fit()
numpy.random.seed(2345)
e = ui.eqwidth(p1, p1 + g1, error=True, niter=100)
check1(e[0], e[1], e[2])
params = e[3]
numpy.random.seed(2345)
e = ui.eqwidth(p1, p1 + g1, error=True, params=params, niter=100)
check1(e[0], e[1], e[2])
parvals = ui.get_fit_results().parvals
assert parvals[0] == approx(1.9055272902160334, rel=1.0e-3)
assert parvals[1] == approx(0.00017387966749772638, rel=1.0e-3)
assert parvals[2] == approx(1.279415076070516e-05, rel=1.0e-3)
示例15: test_user_stat_unit
def test_user_stat_unit():
given_stat_error = [1.1, 2.2, 3.3]
given_sys_error = [10.1, 10.2, 10.3]
def calc_stat(data, _model, staterror, syserror=None, weight=None):
# Make sure values are being injected correctly
np.testing.assert_array_equal(given_stat_error, staterror)
np.testing.assert_array_equal(given_sys_error, syserror)
return 3.235, np.ones_like(data)
xdata = [1, 2, 3]
ydata = xdata
ui.load_arrays(1, xdata, ydata, None, given_sys_error, Data1D)
ui.set_model(1, 'polynom1d.p')
ui.load_user_stat('customstat', calc_stat, lambda x: given_stat_error)
ui.set_stat(eval('customstat'))
try:
ui.fit(1)
except StatErr:
pytest.fail("Call should not be throwing any exception (bug #341)")
# Test the result is what we made the user stat return
assert 3.235 == ui.get_fit_results().statval