Пример #1
0
    def calc_model_eff(self):

        from fermipy.spectrum import PowerLaw
        fn = PowerLaw([1E-13, -2.0])        
        skydir = SkyCoord(0.0,0.0,unit='deg')
        exp = irfs.calc_wtd_exp(skydir, self._ltc, 'P8R2_SOURCE_V6', ['FRONT','BACK'], 
                                self._energy_bins[10:13], self._ctheta_bins, fn)
        return exp
Пример #2
0
from fermipy.spectrum import PowerLaw
import numpy as np
from astropy.table import Table, Column

np.random.seed(1)

s = PowerLaw([1E-12, -2.2], scale=1E3)
sref = PowerLaw([1E-12, -2.0], scale=1E3)

ebins = np.linspace(2.0, 5.0, 3 * 8 + 1)

emin = ebins[:-1]
emax = ebins[1:]
ectr = 0.5 * (emin + emax)

flux = s.flux(10**emin, 10**emax)
dnde = s.dnde(10**ectr)

ref_flux = sref.flux(10**emin, 10**emax)
ref_eflux = sref.eflux(10**emin, 10**emax)
ref_dnde = sref.dnde(10**ectr)

exp = 1.1E12
npred = exp * flux
ref_npred = exp * ref_flux

nmeas = np.random.poisson(npred).astype(float)

meas_flux = nmeas / npred * flux
meas_flux_err = nmeas**0.5 / npred * flux
meas_flux_ul = 1.644853 * meas_flux_err + meas_flux