def calc_wstat_xspec(): data, model, staterr, off_vec, alpha = get_test_data() from xspec_stats import xspec_wstat as wstat from xspec_stats import xspec_wstat_f, xspec_wstat_d # alpha = t_s / t_b t_b = 1. / alpha t_s = 1 d = xspec_wstat_d(t_s, t_b, model, data, off_vec) f = xspec_wstat_f(data, off_vec, t_s, t_b, model, d) bkg = f * t_b stat = wstat(t_s, t_b, model, data, off_vec) print("XSPEC mu_bkg (f * t_b): {}".format(bkg)) print("XSPEC stat: {}".format(stat))
def calc_wstat_xspec(mu_sig, n_on, n_off, alpha): from xspec_stats import xspec_wstat as wstat from xspec_stats import xspec_wstat_f, xspec_wstat_d td = test_data() # alpha = t_s / t_b t_b = 1. / alpha t_s = 1 d = xspec_wstat_d(t_s, t_b, mu_sig, n_on, n_off) f = xspec_wstat_f(n_on, n_off, t_s, t_b, mu_sig, d) bkg = f * t_b stat = wstat(t_s, t_b, mu_sig, n_on, n_off) print("XSPEC mu_bkg (f * t_b): {}".format(bkg)) print("XSPEC stat: {}".format(stat))