Description
In this assignment you will write Python code to compute the mass breakdown of the
Local Group (SnapNumber 0) using its most massive members: the Milky Way (MW), M31
and M33.
1 Get the Data Files
You will need 3 files for this assignment: MW 000.txt, M31 000.txt, M33 000.txt . These
files are located in the astr400b/ directory on nimoy.
You can either download these files directly onto your computer using sftp.
sftp username@nimoy.as.arizona.edu
navigate to the astr400b directory and use ”get” to transfer the files.
Or if you are working in your home directory on nimoy, create a symbolic link to these
files using the absolute path.
ln -s /home/astr400b/M31 000.txt ./M31 000.txt
or
ln -s /home/astr400b/M31 000.txt ./Homeworks/Homework3/M31 000.txt
If you run into issues like “no such file or directory”, it probably means the symbolic link
you created didn’t point to the right targets (instead it points to a non-existing file).
2 Return Mass
1.
2. Create a program called GalaxyMass. In that program, write a function called ComponentMass that will return the total mass of any desired galaxy component.
3. The function should take as input: a filename, the particle type. Recall that the
particle types are: Halo type (1), Disk type (2), Bulge type (3). You will need to call
the ReadFile program you wrote in Homework 2.
4. The Mass should be returned in units of 1012 M rounded to three decimal places
(np.around)
1
3 Mass Break Down of the Local Group
• Use GalaxyMass to compute the total mass of each component of each galaxy (MW,
M31, M33) and store the results in a Table. Note that M33 does not possess a
bulge.
• Columns of the table should be: Galaxy Name, Halo Mass (units), Disk Mass (units),
Bulge Mass (units), Total (units), fbar. The rows should be for each galaxy.
• Input mass in units of 1012 M in the table.
• Compute the total mass of each galaxy (all components combined) and add it to
the Table.
• Compute the total mass of the Local Group in this simulation and add it to the Table.
• Compute the baryon fraction fbar = total stellar mass / total mass (dark+stellar) for
each galaxy and the whole Local Group.
• Save your Table as a PDF. BONUS POINTS if you create your table using LaTeX.
If you don’t know how to use LaTeX come to office hours or TA hours. Overleaf is a
really useful online tex editors.
4 Questions
Save your answers to the above questions as a PDF.
1. How does the total mass of the MW and M31 compare in this simulation? What galaxy
component dominates this total mass?
2. How does the stellar mass of the MW and M31 compare? Which galaxy do you expect
to be more luminous?
3. How does the total dark matter mass of MW and M31 compare in this simulation
(ratio)? Is this surprising, given their difference in stellar mass?
4. What is the ratio of stellar mass to total mass for each galaxy (i.e. the Baryon fraction)?
In the Universe, Ωb/Ωm ∼16% of all mass is locked up in baryons (gas & stars) vs.
dark matter.
How does this ratio compare to the baryon fraction you computed for
each galaxy? Given that the total gas mass in the disks of these galaxies is negligible
compared to the stellar mass, any ideas for why the universal baryon fraction might
differ from that in these galaxies?
2
5 Homework Submission
• You must DOCUMENT your code . Explain each step.
• Create a directory called Homework3 in your GitHub Repository. Store your code and
PDF with Table and answers to question 4 in this directory (along with the LaTeX file
if you did this).
3