In [2]:
#%matplotlib notebook
In [3]:
# imports
from importlib import reload
import numpy as np
from matplotlib import pyplot as plt
from astropy import units
from astropy import constants
from frb import em
from frb import halos
In [4]:
obs_Ha = 1e-17 * units.erg / units.cm**2 / units.s / units.arcsec**2
In [5]:
Ha = 6564. * units.Angstrom
E_Ha_photon = constants.c * constants.h / Ha
E_Ha_photon.to('erg')
Out[5]:
In [6]:
(obs_Ha*units.ph/E_Ha_photon).decompose().to('rayleigh') * 68
Out[6]:
In [7]:
(7.96e8 * E_Ha_photon / units.s / units.m**2 / units.sr).to('erg/s/cm**2/sr')
Out[7]:
In [8]:
reload(em)
em_121102 = em.em_from_halpha(6.8e-16*units.erg/units.cm**2/units.s/units.arcsec**2, 0.1927)
em_121102
Out[8]:
In [9]:
Ha_total = 28.1 * 1e-17 * units.erg/units.s/units.cm**2
In [10]:
Ha_180924 = 0.05 * Ha_total / units.arcsec**2
Ha_180924
Out[10]:
In [11]:
EM_180924 = em.em_from_halpha(Ha_180924, 0.3214)
EM_180924
Out[11]:
In [12]:
reload(em)
DM_s = em.dm_from_em(em_121102, 1*units.kpc)
DM_s
Out[12]:
In [13]:
DM_s_180924 = em.dm_from_em(EM_180924, 0.1*units.kpc)
DM_s_180924/(1+0.32)
Out[13]:
In [14]:
mw = halos.MilkyWay()
In [15]:
xyz = np.zeros((3,100))
Z = np.linspace(10,300,100)
xyz[2,:] = Z
In [16]:
nesq = mw.ne(xyz)**2
In [17]:
#
plt.clf()
ax = plt.gca()
ax.plot(Z, nesq)
# Labels
ax.set_xlabel('Z Distance (kpc)')
ax.set_ylabel(r'$n_e^2 \; (\rm cm^{-3})$')
plt.show()
In [18]:
plt.clf()
ax = plt.gca()
ax.plot(Z, nesq* Z**2)
# Contrast with ISM (ignoring Temperature which reduces the halo further)
#ax.plot([0., 300], [0.1**2 * 10.**2]*2, 'b--')
# Labels
ax.set_xlabel('Z Distance (kpc)')
ax.set_ylabel(r'$n_e^2 \, Z^2 \; (\rm cm^{-1})$')
#
plt.show()
In [ ]: