In [1]:
# imports
from importlib import reload
import numpy as np
from astropy import units
from frb import halos as frb_halos
from bokeh import plotting
from bokeh import models
In [2]:
reload(frb_halos)
mb15 = frb_halos.MB15()
In [3]:
Rperp = 8. * units.kpc # e.g. Sun
rmax = 1. # Units of rvir
dz = 0.1 # kpc
In [4]:
# Generate a sightline to rvir
zmax = np.sqrt((rmax*mb15.r200) ** 2 - Rperp ** 2).to('kpc')
zval = np.arange(-zmax.value, zmax.value+dz, dz) # kpc
# Set xyz
xyz = np.zeros((3,zval.size))
xyz[0, :] = Rperp.to('kpc').value
xyz[2, :] = zval
In [5]:
radius = np.sqrt(frb_halos.rad3d2(xyz))
In [6]:
nH = mb15.nH(xyz)
In [7]:
# Plot
plotting.output_notebook()
p = plotting.figure(title='Density profile', x_axis_label='radius [kpc]',
y_axis_label='nH [1/cm^3]', y_axis_type="log", x_axis_type="log",
x_range=(10., 250.))
p.line(radius, nH, legend='MB15', line_width=2)
p.legend.location = "bottom_left"
#set_fontsize(p, 16)
plotting.show(p)
In [ ]: