snorer.nxSpike¶
snorer.nxSpike(r,mx,profile='MW',sigv=None,tBH=1e+10,alpha='3/2')¶
Dark matter number density of Milky Way of Large Magellanic Cloud at distance \(r\) to the galactic center. Spike feature is included.
r
: array_like
Distance to galactic center, kpc
mx
: array_like
Dark matter mass, MeV
profile
: str
'MW'
or'LMC'
, stands for MW halo or LMC halo
sigv
: scalar
DM annihilation cross section, in the unit of \(10^{-26}\) cm3 s−1.None
indicates no annihilation
tBH
: float
Supermassive black hole age, years
alpha
: str
Slope of the spike,'3/2'
or'7/3'
out
: scalar/ndarray
Dark matter number density at r with spike in the center, cm−3
Let's plot \(n_\chi\) for different \(\langle \sigma v\rangle\).
import numpy as np
import matplotlib.pyplot as plt
import snorer as sn
# DM mass, keV
mx = 0.01
# radius, kpc
r_vals = np.logspace(-5,2,100)
# profiles
sigv_vals = [None,0.01,0.1,3]
for sigv in sigv_vals:
# calculate nx
nx_vals = nxSpike(r_vals,mx,sigv=sigv,profile='LMC')
if sigv is None: sigv = 0 # legend label
plt.plot(r_vals,nx_vals,label=r'$\langle\sigma v\rangle=$' + str(sigv))
plt.xscale('log')
plt.yscale('log')
plt.xlabel(r'$r$ [kpc]')
plt.ylabel(r'$n_\chi(r)$ [cm$^{-3}$]')
plt.title(fr'LMC with spike and $m_\chi = {mx:.2f}$ MeV')
plt.legend()
plt.show()
To realize \(n_\chi\) with spike feature we initialized a snorer.HaloSpike
instance inside the function snorer.nxSpike
and utilize the callable feature. However, such callable function does not support vectorization. To mimic vectorized inputs/outputs, we employ numpy.nditer
. It could become clumsy if the points to be calculated are massive.