def plot_map(fits_map_filename, output_filename, title, min_map, max_map): fig, ax = plib.set_plot_style((4.5, 4)) nside, E_gamma = get_header_info(fits_map_filename) map = get_map(fits_map_filename) b = np.linspace(-80., +80., 160 * 2) l = np.linspace(-150., +150., 300 * 2) map_2d = convert_map_2D(map, nside, E_gamma, b, l) image = ax.pcolor(l, b, map_2d, cmap='jet', vmin=min_map, vmax=max_map, shading='auto', edgecolors='face') make_cbar(fig, image) ax.invert_xaxis() ax.set_title(title, pad=5, fontsize=11) #ax.grid(True) ax.set_xlabel(r'l [deg]') ax.set_ylabel(r'b [deg]') plib.savefig(plt, output_filename)
def plot_flux_absorption_ratio(plot_title, plot_filename): fig, ax = plib.set_plot_style((4.5, 3.5)) icol = 3 E, flux_HI = read_flux_from_file('spectrum-PionDecayAbsorption-HI-1TeV-1PeV-16.txt', icol) E, flux_H2 = read_flux_from_file('spectrum-PionDecayAbsorption-H2-1TeV-1PeV-16.txt', icol) y_w = flux_HI + flux_H2 E, flux_HI = read_flux_from_file('spectrum-PionDecay-HI-1TeV-1PeV-16.txt', icol) E, flux_H2 = read_flux_from_file('spectrum-PionDecay-H2-1TeV-1PeV-16.txt', icol) y_no = flux_HI + flux_H2 r = (y_w - y_no) / y_no ax.plot(E, r - max(r)) ax.set_xscale('log') ax.set_xlabel(r'E [GeV]', fontsize=12) ax.set_xlim([1e3, 1e6]) # ax.set_yscale('log') ax.set_ylabel(r'Flux relative ratio', fontsize=12) ax.set_ylim([-1, 0]) ax.set_title(plot_title, fontsize=11) ax.legend(fontsize=7) plib.savefig(plt, plot_filename)
def plot_flux_absorption(plot_title, plot_filename): fig, ax = plib.set_plot_style((4.5, 3.5)) icol = 3 E, flux_HI = read_flux_from_file('spectrum-PionDecayAbsorption-HI-1TeV-1PeV-16.txt', icol) E, flux_H2 = read_flux_from_file('spectrum-PionDecayAbsorption-H2-1TeV-1PeV-16.txt', icol) ax.plot(E, E * E * (flux_HI + flux_H2), color='tab:blue', linestyle='-', label=r'Pion Decay') E, flux_HI = read_flux_from_file('spectrum-PionDecay-HI-1TeV-1PeV-16.txt', icol) E, flux_H2 = read_flux_from_file('spectrum-PionDecay-H2-1TeV-1PeV-16.txt', icol) ax.plot(E, E * E * (flux_HI + flux_H2), color='tab:blue', linestyle='--', label=r'Pion Decay (no absorption)') ax.set_xscale('log') ax.set_xlabel(r'E [GeV]', fontsize=12) ax.set_xlim([1e3, 1e6]) ax.set_yscale('log') ax.set_ylabel(r'E$^2$ Flux [GeV m$^{-2}$ s$^{-1}$ sr$^{-1}$]', fontsize=12) ax.set_ylim([1e-7, 1e-2]) ax.set_title(plot_title, fontsize=11) ax.legend(fontsize=7) plib.savefig(plt, plot_filename)
def plot_flux_HE(icol, plot_title, plot_filename): fig, ax = plib.set_plot_style((4.5, 3.5)) E, flux_HI = read_flux_from_file('spectrum-PionDecay-HI-1TeV-1PeV-64.txt', icol) E, flux_H2 = read_flux_from_file('spectrum-PionDecay-H2-1TeV-1PeV-64.txt', icol) ax.plot(E, E * E * (flux_HI + flux_H2), color='tab:green', linestyle='-', label=r'Pion Decay ($\gamma$)') E, flux_HI = read_flux_from_file('spectrum-PionDecayNu-HI-1TeV-1PeV-64.txt', icol) E, flux_H2 = read_flux_from_file('spectrum-PionDecayNu-H2-1TeV-1PeV-64.txt', icol) ax.plot(E, E * E * (flux_HI + flux_H2), color='tab:orange', linestyle='--', label=r'Pion Decay ($\nu$ all-flavours)') E, flux_DM = read_flux_from_file('spectrum-DarkMatter-1TeV-30TeV-256.txt', icol) ax.plot(E, E * E * 10. * flux_DM, color='tab:red', linestyle='-', label='Dark Matter (prompt)') E, flux_DM = read_flux_from_file('spectrum-DarkMatterSecondary-1TeV-30TeV-64.txt', icol) ax.plot(E, E * E * 10. * flux_DM, color='tab:red', linestyle='--', label='Dark Matter (secondary)') ax.set_xscale('log') ax.set_xlabel(r'E [GeV]', fontsize=12) ax.set_xlim([1e3, 1e6]) ax.set_yscale('log') ax.set_ylabel(r'E$^2$ Flux [GeV m$^{-2}$ s$^{-1}$ sr$^{-1}$]', fontsize=12) ax.set_ylim([1e-8, 1e-2]) ax.set_title(plot_title, fontsize=11) ax.legend(fontsize=7) plib.savefig(plt, plot_filename)
def plot_flux(icol, plot_title, plot_filename): fig, ax = plib.set_plot_style((4.5, 3.5)) E, flux_HI = read_flux_from_file('spectrum-PionDecay-HI-100MeV-1TeV-64.txt', icol) ax.plot(E, E * E * flux_HI, color='tab:green', linestyle='--', label='Pion Decay (HI)') E, flux_H2 = read_flux_from_file('spectrum-PionDecay-H2-100MeV-1TeV-64.txt', icol) ax.plot(E, E * E * flux_H2, color='tab:green', linestyle=':', label='Pion Decay (H2)') ax.plot(E, E * E * (flux_HI + flux_H2), color='tab:green', linestyle='-', label='Pion Decay (total)') E, flux_IC = read_flux_from_file('spectrum-InverseCompton-100MeV-1TeV-64.txt', icol) ax.plot(E, E * E * flux_IC, color='tab:red', linestyle='-', label='Inverse Compton') E, flux_Bremss_HI = read_flux_from_file('spectrum-Bremsstrahlung-HI-100MeV-1TeV-64.txt', icol) E, flux_Bremss_H2 = read_flux_from_file('spectrum-Bremsstrahlung-HI-100MeV-1TeV-64.txt', icol) ax.plot(E, E * E * (flux_Bremss_HI + flux_Bremss_H2), color='tab:orange', linestyle='-', label='Bremsstrahlung') flux = flux_Bremss_HI + flux_Bremss_H2 + flux_HI + flux_H2 + flux_IC ax.plot(E, E * E * flux, color='tab:blue', linestyle='-', label='Total') ax.set_xscale('log') ax.set_xlabel(r'E [GeV]', fontsize=12) ax.set_xlim([0.1, 1e3]) ax.set_yscale('log') ax.set_ylabel(r'E$^2$ Flux [GeV m$^{-2}$ s$^{-1}$ sr$^{-1}$]', fontsize=12) ax.set_ylim([1e-5, 1]) ax.set_title(plot_title, fontsize=11) ax.legend(fontsize=7) plib.savefig(plt, plot_filename)
def plot_radiospectra(icol, plot_title, plot_filename): fig, ax = plib.set_plot_style((4.5, 3.5)) freq, flux = read_spectrum_from_file('spectrum-Synchro-64.txt', icol) ax.plot(freq, freq * freq * flux, label='Synchrotron (B regular + B turbulent)', color='tab:blue') freq, flux = read_spectrum_from_file('spectrum-Synchro-noturb-64.txt', icol) ax.plot(freq, freq * freq * flux, linestyle=':', label='Synchrotron (B regular only)', color='tab:blue') freq, flux = read_spectrum_from_file('spectrum-Synchro-absorption-64.txt', icol) ax.plot(freq, freq * freq * flux, linestyle='--', label='Synchrotron (including absorption)', color='tab:orange') freq, flux = read_spectrum_from_file('spectrum-FreeFree-64.txt', icol) ax.plot(freq, freq * freq * flux, color='tab:red', label='Free-free') ax.set_xscale('log') ax.set_xlabel(r'$\nu$ [MHz]', fontsize=12) ax.set_xlim([1, 1e5]) ax.set_yscale('log') ax.set_ylabel(r'$\nu^2$ T$_{\rm b}$ [MHz$^2$ K]', fontsize=12) ax.set_ylim([1e2, 1e8]) ax.set_title(plot_title, fontsize=11) ax.legend(fontsize=9, loc='lower left') plib.savefig(plt, plot_filename)
nside = get_header_info('fits/map-Synchro-408MHz-128.fits.gz') map_nu1 = get_map('fits/map-Synchro-noturb-408MHz-128.fits.gz') map_nu2 = get_map('fits/map-Synchro-noturb-412MHz-128.fits.gz') nu1, nu2 = 408., 412. b = np.linspace(-80., +80., 160 * 2) l = np.linspace(-150., +150., 300 * 2) map_2d = compute_map_slope(map_nu1, map_nu2, nu1, nu2, b, l) image = ax.pcolor(l, b, map_2d, cmap='jet', vmin=min_map, vmax=max_map, shading='auto', edgecolors='face') make_cbar(image, units) ax.invert_xaxis() ax.set_title(title, pad=5, fontsize=11) #ax.grid(True) ax.set_xlabel(r'l [deg]') ax.set_ylabel(r'b [deg]') plib.savefig(plt, output_filename)