Dark Matter Halos in the context of FRBs [v1.2]


In [6]:
# import
from importlib import reload
import numpy as np

from astropy import units
from astropy.cosmology import Planck15 as cosmo
from astropy.coordinates import SkyCoord

from frb import halos

Modified NFW

Init


In [2]:
mnfw = halos.ModifiedNFW(alpha=2, y0=2)

In [3]:
# Mass in the halo
mnfw.M_b.to('M_sun') * mnfw.f_hot


Out[3]:
$1.9018718 \times 10^{11} \; \mathrm{M_{\odot}}$

In [4]:
mnfw.r200


Out[4]:
$240.54004 \; \mathrm{kpc}$

Check the Mass


In [5]:
Mb_check = mnfw.mass_r(mnfw.r200)
Mb_check


/home/xavier/Projects/FRB/frb/halos.py:561: RuntimeWarning: divide by zero encountered in reciprocal
  rho = self.rho0_b * self.f_hot / y**(1-self.alpha) / (self.y0+y)**(2+self.alpha)
Out[5]:
$1.9030119 \times 10^{11} \; \mathrm{M_{\odot}}$

DM from Rperp


In [6]:
Ne = mnfw.Ne_Rperp(100*units.kpc)
Ne


Out[6]:
$63.075835 \; \mathrm{\frac{pc}{cm^{3}}}$

Milky Way model


In [7]:
Galaxy = halos.MilkyWay()

In [8]:
Galaxy.M_halo.to('M_sun')


Out[8]:
$1.5135612 \times 10^{12} \; \mathrm{M_{\odot}}$

In [9]:
Galaxy.r200


Out[9]:
$236.87581 \; \mathrm{kpc}$

Halo DM (from Sun)

This requires NE2001

In [10]:
from ne2001.density import NEobject

In [11]:
# Zero out inner 10kpc of the halo where we assume the ISM domiantes
Galaxy.zero_inner_ne = 10. # kpc

In [12]:
# NE2001 parameters
params = dict(F=1., e_density=1.)

In [13]:
model_ne = NEobject(Galaxy.ne, **params)

Pick a sightline


In [14]:
l,b = 0., 90.  # deg in Galactic coordinates

In [15]:
DM = model_ne.DM(l,b, Galaxy.r200.value)
DM


Out[15]:
$65.12174 \; \mathrm{\frac{pc}{cm^{3}}}$

M31


In [16]:
#reload(halos)
m31 = halos.M31()

DM through M31 from the Sun


In [17]:
coord = SkyCoord('J004244.3+413009', unit=(units.hourangle, units.deg))

In [18]:
DM = m31.DM_from_Galactic(coord)
DM


Out[18]:
$133.63955 \; \mathrm{\frac{pc}{cm^{3}}}$

ICM


In [19]:
reload(halos)
icm = halos.ICM()

In [20]:
icm.M_b.to('M_sun') * icm.f_hot


Out[20]:
$5.6 \times 10^{13} \; \mathrm{M_{\odot}}$

Test


In [21]:
icm.r200


Out[21]:
$1637.4852 \; \mathrm{kpc}$

In [22]:
icm.mass_r(icm.r200)


Out[22]:
$5.6 \times 10^{13} \; \mathrm{M_{\odot}}$

DM


In [23]:
icm.Ne_Rperp(1*units.Mpc)


Out[23]:
$187.08701 \; \mathrm{\frac{pc}{cm^{3}}}$

Halo Mass Function

Number density


In [5]:
hmfe = halos.init_hmf()


WARNING: UnitsWarning: 'km/s/Mpc' contains multiple slashes, which is discouraged by the FITS standard [astropy.units.format.generic]

In [11]:
ncom = hmfe.n_in_bins((10.**12.3 * cosmo.h, 10**16 * cosmo.h), 0.367) * cosmo.h**3
ncom


Out[11]:
0.0010268348163757137

Random intersection


In [4]:
reload(halos)
halos.halo_incidence(10.**12.3, 0.47, Mhigh=10**15, radius=28*units.kpc)


Out[4]:
0.007196858055742338

In [12]:
50. / (1+0.47)


Out[12]:
34.013605442176875

In [ ]: