def gtlike_analysis(roi, hypothesis, upper_limit=False, cutoff=False): print 'Performing Gtlike crosscheck for %s' % hypothesis gtlike=Gtlike(roi) like=gtlike.like like.fit(covar=True) r=sourcedict(like, name) if upper_limit: r['upper_limit'] = powerlaw_upper_limit(like, name, emin=emin, emax=emax, cl=.95) if cutoff: r['test_cutoff']=test_cutoff(like,name) for kind, kwargs in [['4bpd',dict(bin_edges=np.logspace(2,5,13))], ['1bpd',dict(bin_edges=np.logspace(2,5,4))]]: print 'Making %s SED' % kind sed = SED(like, name, **kwargs) sed.plot('sed_gtlike_%s_%s_%s.png' % (kind,hypothesis,name)) sed.verbosity=True sed.save('sed_gtlike_%s_%s_%s.dat' % (kind,hypothesis,name)) return r
def gtlike_analysis(roi, hypothesis, upper_limit=False, cutoff=False): print "Performing Gtlike crosscheck for %s" % hypothesis gtlike = Gtlike(roi) like = gtlike.like like.fit(covar=True) r = sourcedict(like, name) if upper_limit: r["upper_limit"] = powerlaw_upper_limit(like, name, emin=emin, emax=emax, cl=0.95) if cutoff: r["test_cutoff"] = test_cutoff(like, name) for kind, kwargs in [ ["4bpd", dict(bin_edges=np.logspace(2, 5, 13))], ["1bpd", dict(bin_edges=np.logspace(2, 5, 4))], ]: print "Making %s SED" % kind sed = SED(like, name, **kwargs) sed.plot("sed_gtlike_%s_%s_%s.png" % (kind, hypothesis, name)) sed.verbosity = True sed.save("sed_gtlike_%s_%s_%s.dat" % (kind, hypothesis, name)) return r
try: roi.fit_extension(name) roi.localize(name, update=True) except Exception, ex: print 'ERROR localizing: ', ex fit() p = sourcedict(roi, name) if extension_ul: print 'UNABLE To Calculate Extension Upper limit' if upper_limit: p['upper_limit'] = powerlaw_upper_limit(roi, name, emin=emin, emax=emax, cl=.95) if cutoff: p['test_cutoff']=test_cutoff(roi,name) roi.plot_sed(which=name,filename='sed_pointlike_%s_%s.pdf' % (hypothesis,name), use_ergs=True) roi.save('roi_%s_%s.dat' % (hypothesis,name)) #plot(roi, hypothesis) return p def gtlike_analysis(roi, hypothesis, upper_limit=False, cutoff=False): print 'Performing Gtlike crosscheck for %s' % hypothesis gtlike=Gtlike(roi) like=gtlike.like like.fit(covar=True)
except Exception, ex: print "ERROR localizing: ", ex fit() p = sourcedict(roi, name) if extension_upper_limit: print "Calculating extension upper limit" p["extension_upper_limit"] = roi.extension_upper_limit( which=name, confidence=0.95, spatial_model=Gaussian(), npoints=10 ) if upper_limit: p["upper_limit"] = powerlaw_upper_limit(roi, name, emin=emin, emax=emax, cl=0.95) if cutoff: p["test_cutoff"] = test_cutoff(roi, name) roi.plot_sed(which=name, filename="sed_pointlike_%s_%s.pdf" % (hypothesis, name), use_ergs=True) roi.save("roi_%s_%s.dat" % (hypothesis, name)) if do_plots: plots(roi, hypothesis) return p def gtlike_analysis(roi, hypothesis, upper_limit=False, cutoff=False): print "Performing Gtlike crosscheck for %s" % hypothesis gtlike = Gtlike(roi) like = gtlike.like