exposure_data = Quantity(exposure_hdu.data, '')
exposure_spec_cube = SpectralCube(data=exposure_data, wcs=exposure_wcs, energy=energy_exp)
exposure_spec_cube = exposure_spec_cube.reproject_to(flux_spec_cube)

counts_data = flux_spec_cube.data * exposure_spec_cube.data
counts = fits.ImageHDU(data=counts_data[0], header=flux_hdu.header)



binsz=input('Bin size: ')
label1='Total Flux'
filename1 = flux_file
smooth = 0.1
hdu = fits.open(filename1)[1]
lons, lats = coordinates(hdu)
lat_profile = image_profile(profile_axis='lat', image=hdu, lats=[-10, 10], lons=[-100, 100], binsz=binsz, errors=True, standard_error=0.1, counts=counts)
plt.figure(figsize=(5,4))
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
flux = np.float64(lat_profile['BIN_VALUE'])
lats = lat_profile['GLAT_MIN']
profile1 = np.histogram(lats, bins=np.sort(lats), weights=np.float64(flux))
xstep=binsz
y_smooth_1 = gaussian_filter(profile1[0], smooth / xstep)
lats_x = lat_profile['GLAT_MIN'][1:] - 0.5 * binsz
plt.plot(lats_x, y_smooth_1, label='{0}'.format(label1))
plt.hlines(0, -5, 5)
plt.xlabel(r'Galactic Latitude/$deg$', fontsize=10)
plt.ylabel(r'Flux/ph cm$^{-2}$ s$^{-1}$', fontsize=10)
plt.xlim([-5, 5])
plt.tick_params(axis='x', labelsize=10)
Exemplo n.º 2
0
                                  energy=energy_exp)
exposure_spec_cube = exposure_spec_cube.reproject_to(flux_spec_cube)

counts_data = flux_spec_cube.data * exposure_spec_cube.data
counts = fits.ImageHDU(data=counts_data[0], header=flux_hdu.header)

binsz = input('Bin size: ')
label1 = 'Total Flux'
filename1 = flux_file
smooth = 0.1
hdu = fits.open(filename1)[1]
lons, lats = coordinates(hdu)
lat_profile = image_profile(profile_axis='lat',
                            image=hdu,
                            lats=[-10, 10],
                            lons=[-100, 100],
                            binsz=binsz,
                            errors=True,
                            standard_error=0.1,
                            counts=counts)
plt.figure(figsize=(5, 4))
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
flux = np.float64(lat_profile['BIN_VALUE'])
lats = lat_profile['GLAT_MIN']
profile1 = np.histogram(lats, bins=np.sort(lats), weights=np.float64(flux))
xstep = binsz
y_smooth_1 = gaussian_filter(profile1[0], smooth / xstep)
lats_x = lat_profile['GLAT_MIN'][1:] - 0.5 * binsz
plt.plot(lats_x, y_smooth_1, label='{0}'.format(label1))
plt.hlines(0, -5, 5)
plt.xlabel(r'Galactic Latitude/$deg$', fontsize=10)
Exemplo n.º 3
0
                                  wcs=exposure_wcs,
                                  energy=energy_exp)
exposure_spec_cube = exposure_spec_cube.reproject_to(counts_spec_cube)

flux_data = counts_spec_cube.data / exposure_spec_cube.data
flux = fits.ImageHDU(data=flux_data[0], header=counts_hdu.header)

binsz = input('Bin size: ')

label1 = 'Total Flux'
smooth = 0.2
lons, lats = coordinates(flux)
lon_profile_total = image_profile(profile_axis='lon',
                                  image=flux,
                                  lats=[-5, 5],
                                  lons=[-101, 101],
                                  binsz=binsz,
                                  errors=True,
                                  counts=counts_hdu)

label2 = 'Separated Background'
background = fits.open(background_file)[1]
lon_profile_background = image_profile(profile_axis='lon',
                                       image=background,
                                       lats=[-5, 5],
                                       lons=[-101, 101],
                                       binsz=binsz,
                                       errors=True,
                                       counts=counts_hdu)

label3 = 'Fermi Diffuse Model'
energy_exp = Quantity([10000, 500000], 'MeV')
exposure_data = Quantity(exposure_hdu.data, '')
exposure_spec_cube = SpectralCube(data=exposure_data, wcs=exposure_wcs, energy=energy_exp)
exposure_spec_cube = exposure_spec_cube.reproject_to(counts_spec_cube)

flux_data = counts_spec_cube.data / exposure_spec_cube.data
flux = fits.ImageHDU(data=flux_data[0], header=counts_hdu.header)



binsz=input('Bin size: ')

label1='Total Flux'
smooth = 0.2
lons, lats = coordinates(flux)
lat_profile_total = image_profile(profile_axis='lat', image=flux, lats=[-10, 10], lons=[-100, 100], binsz=binsz, errors=True, counts=counts_hdu)

label2='Separated Background'
background = fits.open(background_file)[1]
lat_profile_background = image_profile(profile_axis='lat', image=background, lats=[-10, 10], lons=[-100, 100], binsz=binsz, errors=True, counts=counts_hdu)

label3='Fermi Diffuse Model'
diffuse = fits.open('diffuse_correct.fits')[1]
lat_profile_diffuse = image_profile(profile_axis='lat', image=diffuse, lats=[-10, 10], lons=[-100, 100], binsz=binsz, errors=False)
plt.clf()
plt.figure(figsize=(7, 6))
plt.rc('text', usetex=True)
plt.rc('font', family='serif')
flux = np.float64(lat_profile_total['BIN_VALUE'])
background = np.float64(lat_profile_background['BIN_VALUE'])
diffuse_pro = np.float64(lat_profile_diffuse['BIN_VALUE'])
exposure_wcs = WCS(exposure_hdu.header)
energy_exp = Quantity([10000, 500000], "MeV")
exposure_data = Quantity(exposure_hdu.data, "")
exposure_spec_cube = SpectralCube(data=exposure_data, wcs=exposure_wcs, energy=energy_exp)
exposure_spec_cube = exposure_spec_cube.reproject_to(counts_spec_cube)

flux_data = counts_spec_cube.data / exposure_spec_cube.data
flux = fits.ImageHDU(data=flux_data[0], header=counts_hdu.header)

binsz = input("Bin size: ")

label1 = "Total Flux"
smooth = 0.2
lons, lats = coordinates(flux)
lon_profile_total = image_profile(
    profile_axis="lon", image=flux, lats=[-5, 5], lons=[-101, 101], binsz=binsz, errors=True, counts=counts_hdu
)

label2 = "Separated Background"
background = fits.open(background_file)[1]
lon_profile_background = image_profile(
    profile_axis="lon", image=background, lats=[-5, 5], lons=[-101, 101], binsz=binsz, errors=True, counts=counts_hdu
)

label3 = "Fermi Diffuse Model"
diffuse = fits.open("diffuse_correct.fits")[1]
lon_profile_diffuse = image_profile(
    profile_axis="lon", image=diffuse, lats=[-5, 5], lons=[-101, 101], binsz=binsz, errors=False
)