<jupyter_start><jupyter_text>A few calculations for FRB 171020 [v3]<jupyter_code># imports
import numpy as np

from astropy import units as u
from astropy.cosmology import Planck15
from astropy import constants

from ne2001 import density
from ne2001.density import NEobject

from pyigm.cgm.models import ModifiedNFW, MB04, YF17<jupyter_output><empty_output><jupyter_text>Coords<jupyter_code>FRB_l = 36.4
FRB_b = -53.6<jupyter_output><empty_output><jupyter_text>$\rm DM_{\rm disk}$  ne2001<jupyter_code>ne = density.ElectronDensity()#**PARAMS)
DM_disk = ne.DM(FRB_l, FRB_b, 100.)
DM_disk<jupyter_output><empty_output><jupyter_text>$\rm DM_{\rm halo}$  Halo properties<jupyter_code>Mhalo = np.log10(1.5e12)
f_hot = 0.75  # Allows for disk + ISM
c = 7.7<jupyter_output><empty_output><jupyter_text>Simple Model<jupyter_code># MB
mb04 = MB04(log_Mhalo=Mhalo, f_hot=f_hot, c=c)
DM_halo = mb04.Ne_Rperp(8*u.kpc)  # This is approximate.  Should do proper l,b but may make little difference
DM_halo/2  # Only get 1/2 for our Galaxy<jupyter_output>rhoV normalized to 0.00017228356281820233 1 / cm3 to give M_b=240000000000.00006 solMass<jupyter_text>Better model<jupyter_code>params = dict(F=1., e_density=1.)
model_ne = NEobject(mb04.ne, **params)
DM_halo2 = model_ne.DM(FRB_l, FRB_b, mb04.r200.to('kpc').value)
DM_halo2<jupyter_output><empty_output><jupyter_text>Inner 10kpc<jupyter_code>DM_halo2_10 = model_ne.DM(FRB_l, FRB_b, 10.)
DM_halo2_10<jupyter_output><empty_output><jupyter_text>$\rm DM_{\rm host}$ -- This is Halo gas only<jupyter_code>Mhost = np.log10(1e10)
f_hot_host = 0.5  # Allows for 50% blow-out
c = 7.7
mb04_host = MB04(log_Mhalo=Mhost, f_hot=f_hot_host, c=c)
DM_host = mb04_host.Ne_Rperp(1*u.kpc)
DM_host/2  # Only get 1/2<jupyter_output>rhoV normalized to 7.048521943833164e-05 1 / cm3 to give M_b=1600000000.0 solMass<jupyter_text>D$_{\rm IGM}$  Mean density<jupyter_code>rhob = Planck15.Ob0 * Planck15.critical_density0
rhob
n_b = rhob / 1.3 / constants.m_p
n_b.decompose().cgs<jupyter_output><empty_output><jupyter_text>Scale down by baryons in stars, compact objects<jupyter_code>neff_b = n_b * 0.7 # Approximate<jupyter_output><empty_output><jupyter_text>Do it<jupyter_code>DM_IGM = 50 * u.pc / u.cm**3
D_IGM = DM_IGM / neff_b
D_IGM.to('Mpc')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1205240174672489, 'fraction_numerical': 0.07903930131004366, 'mean_word_length': 6.662207357859532, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '117779', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1005, 'n_words': 181, 'path': 'docs/nb/FRB171020.ipynb', 'repo_name': 'KshitijAggarwal/FRB', 'size': '2290'}