#!/usr/bin/env python # coding: utf-8 # # Extragalactic catalogs: mass relations # # > Notebook owner: Yao-Yuan Mao [@yymao](https://github.com/LSSTDESC/DC2-analysis/issues/new?body=@yymao). Last run: Nov 30, 2018 # # In this notebook we demostrate how to plot the halo mass-stellar mass relation and also the BH mass-bulge mass relation for the protoDC2/cosmoDC2 galaxy catalog. # # ## Learning objectives # - Use `GCRCatalogs` to access the protoDC2 or cosmoDC2 catalogs. # - Be able to explore useful quantities using `GCRCatalogs`. # - Be able to use filters when accessing quantities. # In[ ]: import GCRCatalogs # In[ ]: import numpy as np import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') # In[ ]: gc = GCRCatalogs.load_catalog('cosmoDC2_v1.1.4_small') # In[ ]: # let's see what masses are availble sorted(c for c in gc.list_all_quantities(True) if 'mass' in c.lower()) # ## stellar mass - halo mass relation for low-z central galaxies # In[ ]: data = gc.get_quantities(['stellar_mass', 'halo_mass'], filters=['redshift < 0.2', 'is_central']) cs = plt.hexbin(np.log10(data['halo_mass']), np.log10(data['stellar_mass']), cmap='Blues', bins='log'); plt.colorbar(cs, label='log population'); plt.xlabel(r'$\log \, {\rm M}_h \, / \, {\rm M}_\odot$'); plt.ylabel(r'$\log \, {\rm M}_* \, / \, {\rm M}_\odot$'); plt.title(r'$z < 0.2$'); # let's see if the relation changes with redshift # In[ ]: data = gc.get_quantities(['stellar_mass', 'halo_mass'], filters=['redshift > 0.9', 'redshift < 1', 'is_central']) cs = plt.hexbin(np.log10(data['halo_mass']), np.log10(data['stellar_mass']), cmap='Blues', bins='log'); plt.colorbar(cs, label='log population'); plt.xlabel(r'$\log \, {\rm M}_h \, / \, {\rm M}_\odot$'); plt.ylabel(r'$\log \, {\rm M}_* \, / \, {\rm M}_\odot$'); plt.title(r'$0.9 < z < 1.0$'); # ## bulge mass - black hole mass relation for low-z central galaxies # In[ ]: data = gc.get_quantities(['stellar_mass_bulge', 'blackHoleMass'], filters=['redshift < 0.2', 'is_central']) cs = plt.hexbin(np.log10(data['stellar_mass_bulge']), np.log10(data['blackHoleMass']), cmap='Blues', bins='log'); plt.colorbar(cs, label='log population'); plt.xlabel(r'$\log \, {\rm M}_{\rm bulge} \, / \, {\rm M}_\odot$'); plt.ylabel(r'$\log \, {\rm M}_{\rm BH} \, / \, {\rm M}_\odot$');