Merian Part 4: Explore your own sample#

The goal of this notebook is to help you start with your own sample and explore the galaxy properties using the tools and knowledge you learned from this course.

Prerequisites

  • Finished the Photometric Redshift notebook and Merian Part 1, 2, 3 notebooks

Prerequisites

  • Need to install reproject, photutils, cmasher, sep, statmorph

Hide code cell source
%load_ext autoreload
%autoreload 2
import os, sys
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy.io import fits
from IPython.display import clear_output

# We can beautify our plots by changing the matpltlib setting a little
plt.rcParams['font.size'] = 18
plt.rcParams['image.origin'] = 'lower'
plt.rcParams['figure.figsize'] = (8, 6)
plt.rcParams['figure.dpi'] = 90
plt.rcParams['axes.linewidth'] = 2
Hide code cell source
required_packages = ['statmorph', 'photutils', 'sep', 'cmasher', 'reproject']  # Define the required packages for this notebook

import sys
import subprocess

try:
    import google.colab
    IN_COLAB = True
except ImportError:
    IN_COLAB = False

if IN_COLAB:
    # Download utils.py
    !wget -q -O /content/utils.py https://raw.githubusercontent.com/AstroJacobLi/ObsAstGreene/refs/heads/main/book/docs/utils.py
    # Function to check and install missing packages
    def install_packages(packages):
        for package in packages:
            try:
                __import__(package)
            except ImportError:
                print(f"Installing {package}...")
                subprocess.check_call([sys.executable, '-m', 'pip', 'install', package])
    # Install any missing packages
    install_packages(required_packages)
else:
    # If not in Colab, adjust the path for local development
    sys.path.append('/Users/jiaxuanl/Dropbox/Courses/ObsAstGreene/book/docs/')

# Get the directory right
if IN_COLAB:
  from google.colab import drive
  drive.mount('/content/drive/')
  os.chdir('/content/drive/Shareddrives/AST207/data')
else:
    os.chdir('../../_static/ObsAstroData/')

1. Define your own Merian sample#

Let’s load the in-band galaxy catalog and show the galaxy properties in this sample. Recall that you’ve already obtained the sizes of all galaxies in this catalog by doing Sersic fitting (Merian notebook 2)!

cat_inband = Table.read('./merian/cosmos_Merian_DR1_specz_inband.fits')
print('Total number of galaxies:', len(cat_inband))
Total number of galaxies: 152

Dsepite the fact that the catalog provides an estimate for the stellar mass, let’s calculate it in another way. For a given galaxy, we know its magnitudes in both g and i bands, and thus we can calculate its luminosity in g-band:

\[ L_g / L_\odot = 10^{-0.4 \times (M_g - M_{g, \odot})}, \]

where \(M_{g,\odot}=5.05\) is the absolute magnitude of the Sun in \(g\)-band.

To convert the luminosity to stellar mass, we need a so-called “mass-to-light ratio”, which is a function of \(g-i\) color (from Into et al. 2013):

\[ \log M_\star / L_g = 1.297 (g-i) - 0.855 \]

Exercise 1

  1. Based on the above information, write a Python function to calculate the log(stellar mass) of a given galaxy. The function should look like:

    from astropy.cosmology import Planck18
    import astropy.units as u
    def calc_logMstar(mag_g, mag_i, spec_z):
        distance = Planck18.luminosity_distance(spec_z).to(u.Mpc).value # distance in Mpc
        M_g = mag_g - (5 * np.log10(distance) + 25) # absolute magnitude in g-band
        g_i_color = mag_g - mag_i
    
        ## Complete this function from here!
    
        return logMstar
    
  2. Use this function to calculate the stellar mass of all galaxies in cat_inband, and write the calculated stellar masses to the catalog like cat_inband['logMstar'] = calc_logMstar(cat_inband['mag_g'], cat_inband['mag_i'], cat_inband['z_desi']). Then compare your stellar mass with cat_inband['mass_1p0']. Do they agree? Don’t worry if your stellar mass is a bit higher than mass_1p0!

  3. Plot the properties of galaxies in this sample. You are encouraged to plot mass–SFR and mass–size relations. Note that when plotting these relations, please use log10(stellar mass), log10(SFR), and log10(size). Note that the size should be in physical units (e.g., kpc) instead of arcsec.

Exercise 2

Select your own sample!! For example, you can select the most massive things, the most star-forming things, the largest things, etc.

2. A closer look at your sample#

Note that the following questions are very open-ended, and they don’t need to be answered exactly in the way we ask for. You should treat this notebook as “doing research”.

Exercise 3

  1. Show the distribution of your subsample on the mass-SFR plane or on the mass-size plane. Please also show the whole sample in the background.

  2. Discuss why your subsample would look like this, and come up with a hypothesis.

  3. Fit a model to the properties of your subsample and compare your fit with the full sample. Do you see any differences? Why?

  4. You can also generate a bunch of H-alpha maps for galaxies in your subsample. State what you find.