def products(output): """Standardized output products for any XSPEC fit""" pdf(output + ".pdf", cmd="ldata delchi") wdata(output + ".qdp") xs_utils.dump_fit_log(output + ".log") xs_utils.dump_dict(xs_utils.fit_dict(), output + ".json")
# Fit and dump fit information/plot # --------------------------------- xs.Fit.renorm() xs.Fit.perform() if args.free_en: for cname, en in zip(instr.componentNames, lines): comp = instr.__getattribute__(cname) comp.LineE.frozen = False comp.Sigma.frozen = False xs.Fit.perform() xs.Plot.xAxis = "keV" xs.Plot.xLog = True xs.Plot.yLog = True xs.Plot.addCommand("co 2 on 2") xs.Plot.addCommand("rescale y 1e-4 1") xs.Plot.device = f_plot + "/cps" xs.Plot("ldata resid delchi") call(["ps2pdf", f_plot, f_plot + ".pdf"]) call(["rm", f_plot]) # Save current XSPEC state dump_dict(fit_dict(), f_fit) dump_fit_log(f_log)