Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
restrepo
GitHub Repository: restrepo/ComputationalMethods
Path: blob/master/activities/halos-catalog.ipynb
934 views
Kernel: Unknown Kernel

Task 2

This homework is an activity intended to practice the basic concepts of python and some of the functions offered by NumPy and Matplotlib.

Due to: Nov 08

The large-scale Universe

For this task, we are going to use a catalog of dark matter halos of a cosmological simulation of the large-scale Universe (The Bolshoi simulation). The catalog can be loaded from this link. The first, second and third columns are referred to the X, Y and Z coordinates of the halo in units of Megaparsec respectively (comoving coordinates). The last column is referred to the dark mass of the halo.

1. The Press–Schechter formalism: the number of objects of a mass range within a simulation of a portion of the Universe can be approximately predicted by the Press–Schechter formalism. The number of object with a mass between MM and M+dMM+dM is:

N(M)dM=1π(1+n3)ρˉM2(MM)(3+n)/6exp[(MM)(3+n)/3]VdMN(M)dM = \frac{1}{\sqrt{\pi}}\left( 1+\frac{n}{3} \right)\frac{\bar\rho}{M^2}\left( \frac{M}{M^*} \right)^{(3+n)/6}\exp\left[ -\left( \frac{M}{M^*} \right)^{(3+n)/3} \right] V dM

where ρˉ\bar \rho is the mean matter density of the Universe, nn is the index of the power spectrum, VV the volume of the simulation and MM^* is a critical mass parameter.

Create a Python script that does the next:

  • Load the catalog of dark matter halos.

  • Using Matplotlib, generate and plot a histogram of log10(mass) for the halos, i.e., how many halos are per logarithmic mass range.

  • Plot in the same window the theoretical prediction of the Press-Schechter formalism using the next parameters:

N(M)=1.018×1014 M0.889×exp(9.7×1032 M0.222)N(M) = 1.018\times 10^{14}\ M^{-0.889}\times \exp\left( -9.7\times 10^{-32}\ M^{0.222} \right)

Questions

  • Is it satisfied the Press-Schechter approximation for this simulation?

  • What is the resolution of the halos of the simulation? (This is, what is mass value of the smaller halo?)

Advice: use double logarithmic plots (loglog).

2. Distribution of massive halos: the more massive halos are generally located within high density regions of the large-scale distribution, like clusters and filaments. This is a consequence of the hierarchical structure formation, where small structures formed first and larger structures are made of the smaller ones.

Create a Python script that does the next:

  • Load the catalog of dark matter halos.

  • Select the more massive halos, namely M>1×1013 MM>1\times 10^{13}\ M_{\odot}.

  • Plot in a 3D scatter both, the complete catalogue of halos and the more massive halos (with different colours).

Questions

  • Is it verified the large-scale distributions of massive halos?

  • Where are they more likely to be?

How to plot a 3D scatter

For making a 3D scatter, it is necessary to import the package Axes 3D in order to activate the 3D plotting.

%pylab inline import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D #Activating 3D plotting fig = plt.figure( figsize = (8,8) ) ax = fig.add_subplot(111, projection='3d') X = [1,2,3,2,1,3,2,1] Y = [3,2,1,3,2,1,3,2] Z = [1,3,2,1,2,3,1,2] ax.scatter( X, Y, Z )
Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline]. For more information, type 'help(pylab)'.
<mpl_toolkits.mplot3d.art3d.Patch3DCollection at 0x3269310>

For this part, you should obtain something similar to this:

from IPython.core.display import Image Image(filename='./figures/halos_bolshoi.png')
Image in a Jupyter notebook

For both activities, you must deliver the codes as well as a short text file with the answer of the questions and possible comments you consider pertinent.

Bibliography

  • Press, William H., and Paul Schechter. "Formation of galaxies and clusters of galaxies by self-similar gravitational condensation." The Astrophysical Journal 187 (1974): 425-438.

  • Introduction to Computational and Programming Using Python, Guttag, J. V. The MIT Press. 2013.