Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Week 4 Exercise

In this exercise, we will use galpy\texttt{galpy} to investigate the gravitational potential of dark matter profiles in dwarf galaxies using the Jeans equations formulation for collisionless systems. We will use mock data based on Walker et al. (2009). Dwarf galaxies are >90%>90\% dark matter, so we can assume the gravitational potential is only given by dark matter density profile.

import matplotlib.pyplot as plt
import time
import numpy as np
import galpy
from galpy.df import jeans

Select one of the dwarf galaxies data for line-of-sight (LOS) velocity dispersion profiles. The columns are (1) radial distance in the plane of the sky in pc, (2) LOS velocity dispersion measured at the given radial distance in km/s, (3) error in the velocity dispersion measured in km/s

These values might be useful since galpy standard units are given in velocity normalized by the circular velocity of the Milky Way v0=220 km/sv_{0}=220\ \mathrm{km/s}, and the approximate distance of the sun to the Milky Way’s center r0=8 kpcr_{0}=8\ \mathrm{kpc}.

v0=220 #km/s
r0=8e3 #pc
G_c=4.30091e-3 #pc (km/s)^2 Msun^-1

In Walker et al. (2009) two of the dark matter profiles that are studied are the Navarro–Frenk–White (NFW) profile https://docs.galpy.org/en/latest/reference/potentialnfw.html, and a core-shaped profile, which for practical use we will assume as the Burkert profile https://docs.galpy.org/en/latest/reference/potentialburkert.html. In order to have less free parameters in our problem we can assume the values of the scale radius to be aNFW=795 pca_{\mathrm{NFW}}=795\ \mathrm{pc} and aBurkert=150 pca_{\mathrm{Burkert}}=150\ \mathrm{pc} (remember to normalize for by r0r_{0})

We can define a potential we are working with in galpy as follows (NFW as example): NFW=galpy.potential.NFWPotential(amp=my_amp, a=my_a,vo=v0, ro=r0/1e3)\texttt{NFW=galpy.potential.NFWPotential(amp=my\_amp, a=my\_a,vo=v0, ro=r0/1e3)} (giving ro and vo will produce outputs in M pc3\mathrm{M_{\odot}\ pc^{-3}} for densities and km/s\mathrm{km/s} for velocity dispersions, inputs must be on galpy units though).

To explore the dark matter profile of dwarf galaxies, we will use the density profiles that define the potential with a characteristic density ρ0\rho_{0}. Such a density will be the input amp\texttt{amp} in our galpy\texttt{galpy} potentials (for the NFW profile as defined in galpy\texttt{galpy} you might want to write amp=ρ04πa3\mathrm{amp}=\rho_{0}4\pi a^{3}). Density inputs have units v02Gr02\frac{v_{0}^{2}}{G r_{0}^{2}}

Exercise:\textbf{Exercise}:

(1) After selecting one of the galaxies, define an NFW and Burkert potential in galpy\texttt{galpy} and plot the corresponding density profiles in a range of 10 to 2000 pc. Taking the previous example, you can use NFW.dens(r,0)\texttt{NFW.dens(r,0)} to evaluate the density of the given potential at different distances rr. Use at least 3 values of scale density in the range ρ0=102\rho_{0}=10^{-2}-10 M pc310\ \mathrm{M_{\odot}\ pc^{-3}} for each profile. What are the main differences between the two density distributions (you might use a log scale in your plots).

(2) Since we only have access to LOS velocities, we need the anisotropy β\beta to compute the velocity dispersions from the Jeans equations. Use at least 5 values of the anisotropy in the range β=10\beta=-10-1 and compute the radial velocity dispersions with galpy\texttt{galpy}. Use jeans.sigmar(NFW,r,beta=beta)\texttt{jeans.sigmar(NFW,r,beta=beta)} to compute σr\sigma_{r} at a given radial distance rr. Plot σr\sigma_{r} vs rr (do not compare with the data yet).

(3) σr\sigma_{r} is defined in an arbitrary radial position of the sky, β\beta contains information about the inclination of our system, and then it can be used to obtain projected σLOS\sigma_{\mathrm{LOS}} that we can compare with our data. Use jeans.sigmalos(NFW,r,dens=nu,surfdens=I,beta=beta,sigma_r=sig_r\texttt{jeans.sigmalos(NFW,r,dens=nu,surfdens=I,beta=beta,sigma\_r=sig\_r} to compute σLOS\sigma_{\mathrm{LOS}} at given distances. The densities of stars ν\nu (dens) and II (surfdens) should be functions of rr (use def function (r):...\texttt{def\ function (r):...}), you can use the analytical formulas given in section 3.1 of Walker et al. (2009), note that LL can be ignored and Table 1 lists the rhalfr_{\mathrm{half}} for each galaxy. Plot the σLOS\sigma_{\mathrm{LOS}} obtained with the different values of ρ0\rho_{0} and β\beta for the two dark matter profiles and compare with your data.

(4) Select your best model to compute the total mass of dark matter contained in a radius of 300 pc and rhalfr_{\mathrm{half}} of your selected galaxy and compare with Table 2 of Walker et al. (2009).

(5) Extra:\textbf{Extra:} In principle, you can estimate the best-fitting parameters for your model and get an estimate of the mass of your dark matter halo. It is usual that people define a likelihood based on lnL=iN(σLOS,i,obsσLOS,i,model)2/errorLOS,i,obs2\ln{L}=\sum^{N}_{i} (\sigma_{\mathrm{LOS,i,obs}}-\sigma_{\mathrm{LOS,i, model}})^{2}/{\mathrm{error}_{\mathrm{LOS,i, obs}}^{2}} and then apply an optimization technique to get the best-fitting parameters in this case for (ρ0\rho_{0} and β\beta).