snorer.get_tvan¶
snorer.get_tvan(Tx,mx,Rs)¶
Get the BDM vanishing time. The time-zero is set as the arrival of SN\(\nu\) at Earth. See Eqs. (22) and (23) in BDM Physics.
Tx
: array_like
BDM kinetic energy \(T_\chi\), MeV
mx
: array_like
DM mass \(m_\chi\), MeV
Rs
: array_like
Distance to supernova, \(R_s\), kpc
out
: scalar/ndarray
BDM vanishing time \(t_{\rm van}\), seconds
In this example, we show \(t_{\rm van}\) on \((m_\chi,T_\chi)\) plane.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import snorer as sn
Rs = 9.6 # SN distance, kpc
Tx_vals = np.logspace(-6,2,100) # Tx values
mx_vals = np.logspace(-6,3,100) # mx values
# Setup meshgrid for (mx,Tx) plane
MX,TX = np.meshgrid(mx_vals,Tx_vals,indexing='ij')
# Evaluating tvan and convert it to years
TVAN = sn.get_tvan(TX,MX,Rs)/sn.constant.year2Seconds
# Plot
fig, ax = plt.subplots()
# log-scaler color
norm = mcolors.LogNorm(vmin=TVAN.min(), vmax=TVAN.max())
# Contour plot
contour = ax.contourf(MX, TX, TVAN, levels=20, cmap="viridis", norm=norm)
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlabel(r'$m_\chi$ [MeV]')
ax.set_ylabel(r'$T_\chi$ [MeV]')
# Color bar
cbar = fig.colorbar(contour, ax=ax)
cbar.set_label(r"$t_{\rm van}$ [yrs]")
plt.show()
Practically speaking, the underlying algorithm of snorer.get_tvan
is not vectorized. It relies on numpy.nditer
to support vectorized inputs/outputs.
The kernel of snorer.get_tvan
is the internal function snorer._get_tof
which has the same Parameters and Returns as snorer.get_tvan
but only accepts scalar inputs/outputs. It could become clumsy when the points to be calcuated are massive.