def get_discovery_sigsub(ana,ra,sindec,ext,gamma,batch_size=500): src = utils.Sources(ra=0, dec=np.arcsin(sindec),extension=np.radians(ext)) #flux = hyp.PowerLawFlux(gamma) tr = get_tr(src, ana, sigsub=True)#, flux=flux) bg = cy.dists.Chi2TSD(tr.get_many_fits(500)) sens = tr.find_n_sig(bg.isf_nsigma(5,fit=True),0.5,batch_size=batch_size,max_batch_size=1000,tol=0.03) sens['flux'] = tr.to_E2dNdE(sens['n_sig'], E0=100, unit=1e3) return sens['flux']
def get_tr_skymap(src=None, cut_n_sigma=3, _fit_null=True, inj=True): if src is None: src = utils.Sources(ra=0, dec=0, extension=extension) src['extension'] = extension * np.ones_like(src.dec) return get_tr(src, ana=ana, cut_n_sigma=cut_n_sigma, sigsub=sigsub, _fit_null=_fit_null, inj=inj)
def get_selector (dec): return inj.DecBandSelector (utils.Sources (dec=dec, extension=extension))