def define_flux_crab_above_energy(emin=1 * u.TeV, emax=10 * u.TeV): crab = CrabSpectrum('meyer').model crabMAGIC = LogParabola(amplitude=3.23e-11 * u.Unit('cm-2 s-1 TeV-1'), reference=1 * u.TeV, alpha=2.47, beta=0.24) crab_flux_above_1TeV = crabMAGIC.integral(emin=emin, emax=emax) crab_flux_above_1TeV_model = crab.integral(emin=emin, emax=emax) return crab_flux_above_1TeV, crab_flux_above_1TeV_model
def define_flux_crab_above_energy(): emin, emax = [1, 10] * u.TeV # crab = CrabSpectrum('meyer').model crabMAGIC = LogParabola(amplitude=3.23e-11 * u.Unit('cm-2 s-1 TeV-1'), reference=1 * u.TeV, alpha=2.47, beta=-0.24) crab_flux_above_1TeV = crabMAGIC.integral(emin=emin, emax=emax) print(crab_flux_above_1TeV) crab_flux_above_1TeV = crab_flux_above_1TeV.to('cm-2 s-1') return crab_flux_above_1TeV
def flux_amplitude_from_energy_flux(alpha, beta, energy_flux): spec = LogParabola( amplitude=1 * u.Unit('cm-2 s-1 TeV-1'), reference=1 * u.TeV, alpha=alpha, beta=-beta, ) # Assumption before for `energy_flux` was energy band 1 to 10 TeV emin_int = 1 * u.TeV emax_int = 10 * u.TeV pivot_energy = 1 * u.TeV energy_flux_standard_candle = spec.energy_flux(emin=emin_int, emax=emax_int) flux_at_1TeV = energy_flux / energy_flux_standard_candle * u.Unit('cm-2 s-1 TeV-1') # print('std: ', energy_flux_standard_candle, 'energy_flux: ', energy_flux, flux_at_1TeV) flux_at_1TeV = flux_at_1TeV.to('cm-2 s-1 MeV-1') spec2 = LogParabola(amplitude=flux_at_1TeV, reference=pivot_energy, alpha=alpha, beta=beta) energy_flux_above_1TeV = spec2.energy_flux(emin=emin_int, emax=10 * u.TeV) # print('c',energy_flux_above_1TeV.to('TeV cm-2 s-1'),energy_flux_above_1TeV.to('TeV cm-2 s-1')/(flux_at_1TeV.to('cm-2 s-1 TeV-1')/)) ) flux_above_1TeV = spec2.integral(emin=emin_int, emax=10 * u.TeV) flux_above_1TeV = flux_above_1TeV.to('cm-2 s-1') # evaluating Crab flux at and above 1 TeV by using MAGIC Crab spectrum from JHEA 2015 crab_flux_above_1TeV, crab_flux_above_1TeV_model = define_flux_crab_above_energy(emin=1 * u.TeV, emax=10 * u.TeV) crabMAGIC = LogParabola(amplitude=3.23e-11 * u.Unit('cm-2 s-1 TeV-1'), reference=1 * u.TeV, alpha=2.47, beta=0.24) # plt.figure() # min, max = [50*u.GeV,50*u.TeV] # crabMAGIC.plot(min,max) # crab = CrabSpectrum('meyer').model crab_flux_above_1TeV = crab_flux_above_1TeV.to('cm-2 s-1') crab_flux_above_1TeV_model = crab_flux_above_1TeV_model.to('cm-2 s-1') crab_flux_at_1TeV = crabMAGIC(pivot_energy).to('MeV-1 cm-2 s-1') # computing flux at and above 1 TeV in crab units flux_at_1TeV_cu = (flux_at_1TeV / crab_flux_at_1TeV)*100 flux_above_1TeV_cu = (flux_above_1TeV / crab_flux_above_1TeV)*100 # print(crab_flux_above_1TeV, flux_above_1TeV, flux_above_1TeV / crab_flux_above_1TeV, flux_above_1TeV_cu ) flux_above_1TeV_cu_model = (flux_above_1TeV / crab_flux_above_1TeV_model).to('%') return flux_at_1TeV, flux_at_1TeV_cu, flux_above_1TeV, flux_above_1TeV_cu