Пример #1
0
def plot_containment_radii(fraction):
    """Plotting script for 68% and 95% containment radii."""

    psf_gc = FermiGalacticCenter.psf()
    gtpsf_table_gc = get_psf_table(psf_gc,  10000, 300000, 15)

    psf_vela = FermiVelaRegion.psf()
    gtpsf_table_vela = get_psf_table(psf_vela, 10000, 300000, 15)
    
    if fraction == 68:
        true_table_rep = load_lat_psf_performance('P7REP_SOURCE_V15_68')
        true_table = load_lat_psf_performance('P7SOURCEV6_68')
        rad = 'CONT_68'
    elif fraction == 95:
        true_table_rep = load_lat_psf_performance('P7REP_SOURCE_V15_95')
        true_table = load_lat_psf_performance('P7SOURCEV6_95')
        rad = 'CONT_95'
    
    plt.plot(gtpsf_table_gc['ENERGY'], gtpsf_table_gc[rad],
             color='red',label='Fermi Tools PSF @ Galactic Center')
    plt.plot(gtpsf_table_vela['ENERGY'], gtpsf_table_vela[rad],
             color='blue', label='Fermi Tools PSF @ Vela Region')
    plt.plot(true_table_rep['energy'], true_table_rep['containment_angle'],
             color='green', linestyle='--', label='P7REP_SOURCE_V15')
    plt.plot(true_table['energy'], true_table['containment_angle'],
             color='black', linestyle='--', label='P7SOURCEV6')

    plt.xlim([10000, 300000])

    plt.legend()
    plt.semilogx()
    plt.xlabel('Energy/MeV')
    plt.ylabel('PSF Containment Radius/deg')

    return plt
Пример #2
0
                    y_stddev=0.6)

# Get coordinates from background reference
coord = flux_bkg.coordinates()
glon = coord.l.deg
glat = coord.b.deg

# Compute model flux image
flux = vela_x(glon, glat) + vela_junior(glon, glat) + flux_bkg.data

# In[4]:

from astropy.coordinates import Angle

# Get PSF
fermi_psf = FermiVelaRegion.psf()

# Assume constant exposure. The value is choosen that we only get a few counts per bin.
exposure = Quantity(0.1E8, 'cm2 s sr')

# Convolve with psf
pix_size = Angle(0.125, 'deg')
psf = fermi_psf.table_psf_in_energy_band(energy_range).kernel(pix_size)
flux_psf_convolved = convolve(flux, psf.value, boundary='wrap')

counts = (flux_psf_convolved) * exposure.value
counts = np.random.poisson(counts)

# In[5]:

# TODO: images below should be flipped left-right!!!