from sherpa.astro.ui import * from pychips import * from pychips.hlui import * from pycrates import *
load_pha("src.pha") load_rmf("src.rsp") load_bkg("bkg.pha") show_all() src_exp = get_exposure(id=1) src_sum = calc_data_sum(id=1) src_sum_err = (1.00 + numpy.sqrt(src_sum + 0.75)) src_crs = calc_data_sum(id=1) / get_exposure(id=1) src_crs_err = src_sum_err / src_exp bkg_exp = get_exposure(bkg_id=1) bkg_sum = calc_data_sum(bkg_id=1) bkg_sum_err = (1.00 + numpy.sqrt(bkg_sum + 0.75)) bkg_crs = calc_data_sum(bkg_id=1) / get_exposure(bkg_id=1) bkg_crs_err = bkg_sum_err / bkg_exp bkg_rat = get_bkg_scale() net_sum = src_sum - (bkg_sum*bkg_rat) net_sum_err = numpy.sqrt((src_sum_err**2.00)+((bkg_sum_err**2.00)*bkg_rat)) net_crs = net_sum / src_exp net_crs_err = net_sum_err / src_exp plot_data() ignore_bad(id=1) ignore_bad(bkg_id=1) ignore(None, 0.30) ignore(10.0, None) set_xlog() set_ylog() set_method("neldermead") set_method_opt("verbose", 1) set_stat("chi2gehrels") subtract() set_stat("cash") unsubtract()
list_models("xspec") set_source(xsphabs.a01 * xspowerlaw.s01) set_bkg_model(xspowerlaw.b01) guess(s01) guess(b01) fit()
conf() calc_photon_flux(1.0, 10.0) calc_energy_flux(1.0, 10.0)