"""Plot radial surface density distributions of Galactic sources.""" import matplotlib.pyplot as plt import numpy as np from gammapy.astro.population import radial_distributions from gammapy.utils.distributions import normalize # TODO: use Quantity max_radius = 20 # kpc r = np.linspace(0, max_radius, 100) for key in radial_distributions: model = radial_distributions[key]() if model.evolved: linestyle = '-' else: linestyle = '--' label = model.__class__.__name__ plt.plot(r, normalize(model, 0, max_radius)(r), linestyle=linestyle, label=label) plt.xlim(0, max_radius) plt.ylim(0, 0.28) plt.xlabel('Galactocentric Distance [kpc]') plt.ylabel('Normalized Surface Density [kpc^-2]') plt.legend(prop={'size': 10}) plt.show()
"""Plot velocity distributions of Galactic sources.""" import numpy as np import matplotlib.pyplot as plt from gammapy.astro.population import velocity_distributions from gammapy.utils.distributions import normalize # TODO: use Quantity v_min, v_max = 10, 3000 # km / s v = np.linspace(v_min, v_max, 200) for key in velocity_distributions: model = velocity_distributions[key]() label = model.__class__.__name__ plt.plot(v, normalize(model, v_min, v_max)(v), linestyle='-', label=label) plt.xlim(v_min, v_max) plt.ylim(0, 0.004) plt.xlabel('Velocity [km/s]') plt.ylabel('Probability Density [(km / s)^-1]') plt.semilogx() plt.legend(prop={'size': 10}) plt.show()
"""Plot radial surface density distributions of Galactic sources.""" import matplotlib.pyplot as plt import numpy as np import astropy.units as u from gammapy.astro.population import radial_distributions from gammapy.utils.distributions import normalize radius = np.linspace(0, 20, 100) * u.kpc for key in radial_distributions: model = radial_distributions[key]() if model.evolved: linestyle = "-" else: linestyle = "--" label = model.__class__.__name__ x = radius.value y = normalize(model, 0, radius[-1].value)(radius.value) plt.plot(x, y, linestyle=linestyle, label=label) plt.xlim(0, radius[-1].value) plt.ylim(0, 0.26) plt.xlabel("Galactocentric Distance [kpc]") plt.ylabel("Normalized Surface Density [kpc^-2]") plt.legend(prop={"size": 10}) plt.show()
"""Plot velocity distributions of Galactic sources.""" import numpy as np import matplotlib.pyplot as plt import astropy.units as u from gammapy.astro.population import velocity_distributions from gammapy.utils.distributions import normalize velocity = np.linspace(10, 3000, 200) * u.km / u.s for key in velocity_distributions: model = velocity_distributions[key]() label = model.__class__.__name__ x = velocity.value y = normalize(model, velocity[0].value, velocity[-1].value)(velocity.value) plt.plot(x, y, linestyle='-', label=label) plt.xlim(velocity[0].value, velocity[-1].value) plt.ylim(0, 0.005) plt.xlabel('Velocity [km/s]') plt.ylabel('Probability Density [(km / s)^-1]') plt.semilogx() plt.legend(prop={'size': 10}) plt.show()
"""Plot velocity distributions of Galactic sources.""" import numpy as np import matplotlib.pyplot as plt from gammapy.astro.population import velocity_distributions from gammapy.utils.distributions import normalize v_min, v_max = 10, 3000 # km / s v = np.linspace(v_min, v_max, 200) colors = ['b', 'k', 'g'] for color, key in zip(colors, velocity_distributions): model = velocity_distributions[key]() label = model.__class__.__name__ plt.plot(v, normalize(model, v_min, v_max)(v), color=color, linestyle='-', label=label) plt.xlim(v_min, v_max) plt.ylim(0, 0.004) plt.xlabel('Velocity [km/s]') plt.ylabel('Probability Density [(km / s)^-1]') plt.semilogx() plt.legend(prop={'size': 10}) plt.show()
"""Plot radial surface density distributions of Galactic sources.""" import matplotlib.pyplot as plt import numpy as np from gammapy.astro.population import radial_distributions from gammapy.utils.distributions import normalize max_radius = 20 # kpc r = np.linspace(0, max_radius, 100) for key in radial_distributions: model = radial_distributions[key]() if model.evolved: linestyle = '-' else: linestyle = '--' label = model.__class__.__name__ plt.plot(r, normalize(model, 0, max_radius)(r), linestyle=linestyle, label=label) plt.xlim(0, max_radius) plt.ylim(0, 0.28) plt.xlabel('Galactocentric Distance [kpc]') plt.ylabel('Normalized Surface Density [kpc^-2]') plt.legend(prop={'size': 10}) plt.show()