profile = profiles.NFWProfile() # Adopt standard values used in HESS profiles.DMProfile.DISTANCE_GC = 8.5 * u.kpc profiles.DMProfile.LOCAL_DENSITY = 0.39 * u.Unit("GeV / cm3") profile.scale_to_local_density() position = SkyCoord(0.0, 0.0, frame="galactic", unit="deg") geom = WcsGeom.create(binsz=0.05, skydir=position, width=3.0, coordsys="GAL") # In[ ]: jfactory = JFactory(geom=geom, profile=profile, distance=profiles.DMProfile.DISTANCE_GC) jfact = jfactory.compute_jfactor() # In[ ]: jfact_map = WcsNDMap(geom=geom, data=jfact.value, unit=jfact.unit) fig, ax, im = jfact_map.plot(cmap="viridis", norm=LogNorm(), add_cbar=True) plt.title("J-Factor [{}]".format(jfact_map.unit)) # 1 deg circle usually used in H.E.S.S. analyses sky_reg = CircleSkyRegion(center=position, radius=1 * u.deg) pix_reg = sky_reg.to_pixel(wcs=geom.wcs) pix_reg.plot(ax=ax, facecolor="none", edgecolor="red", label="1 deg circle") plt.legend()
def jfact(geom): jfactory = JFactory(geom=geom, profile=profiles.NFWProfile(), distance=8 * u.kpc) return jfactory.compute_jfactor()