In [6]:
import numpy as np
# --- centralMS ---
from centralms import util as UT
from centralms import catalog as Cat
from centralms import observables as Obvs
In [7]:
import matplotlib as mpl
import matplotlib.pyplot as pl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['axes.linewidth'] = 1.5
mpl.rcParams['axes.xmargin'] = 1
mpl.rcParams['xtick.labelsize'] = 'x-large'
mpl.rcParams['xtick.major.size'] = 5
mpl.rcParams['xtick.major.width'] = 1.5
mpl.rcParams['ytick.labelsize'] = 'x-large'
mpl.rcParams['ytick.major.size'] = 5
mpl.rcParams['ytick.major.width'] = 1.5
mpl.rcParams['legend.frameon'] = False
%matplotlib inline
In [8]:
marr, phi, phi_err = Obvs.dataSMF(source='li-white')
In [9]:
fcen = (1. - np.array([Obvs.f_sat(mm, 0.0) for mm in marr]))
In [10]:
sub = Cat.Subhalos(sigma_smhm=0.2, smf_source='li-march', nsnap0=15)
shcat = sub.Read()
In [11]:
smf_sim = Obvs.getMF(shcat['m.sham'])
In [12]:
censub = Cat.CentralSubhalos(sigma_smhm=0.2, smf_source='li-march', nsnap0=15)
cshcat = censub.Read()
In [13]:
smf_censim = Obvs.getMF(cshcat['m.sham'])
In [14]:
fig = plt.figure()
sub = fig.add_subplot(111)
sub.plot(smf_sim[0], smf_sim[1], c='k', lw=1)
sub.errorbar(marr, phi, phi_err, fmt='.k', label='All Galaxies')
sub.plot(smf_censim[0], smf_censim[1], c='C0', lw=2, ls='--')
sub.errorbar(marr, fcen * phi, phi_err, fmt='.C0', label='Centrals')
sub.legend(loc='lower left', handletextpad=0., fontsize=25)
sub.set_xlabel('$\log\,M_*$', fontsize=25)
sub.set_xlim([8.5, 12.])
sub.set_ylabel('$\Phi(M_*)$', fontsize=25)
sub.set_yscale('log')
sub.set_ylim([1e-6, 1e-1])
Out[14]:
In [18]:
from centralms import abcee as ABC
from centralms import evolver as Evol
In [16]:
subcat_sim = ABC.model('randomSFH10gyr.sfsflex', [0.4, 0.5], nsnap0=15, downsampled='20')
In [17]:
fig = plt.figure()
sub = fig.add_subplot(111)
sub.plot(smf_sim[0], smf_sim[1], c='k', lw=1)
sub.errorbar(marr, phi, phi_err, fmt='.k', label='All Galaxies')
smf_censim = Obvs.getMF(subcat_sim['m.sham'], weights=subcat_sim['weights'])
sub.plot(smf_censim[0], smf_censim[1], c='C0', lw=2, ls='--')
sub.errorbar(marr, fcen * phi, phi_err, fmt='.C0', label='Centrals')
sub.legend(loc='lower left', handletextpad=0., fontsize=25)
sub.set_xlabel('$\log\,M_*$', fontsize=25)
sub.set_xlim([8.5, 12.])
sub.set_ylabel('$\Phi(M_*)$', fontsize=25)
sub.set_yscale('log')
sub.set_ylim([1e-6, 1e-1])
Out[17]:
In [38]:
fig = plt.figure()
sub = fig.add_subplot(111)
sub.plot(marr, phi, c='k', label='All Galaxies')
sub.plot(marr, fcen * phi, c='C0', label='Centrals')
isSF= subcat_sim['galtype'] == 'sf'
smf_censim = Obvs.getMF(subcat_sim['m.sham'][isSF], weights=subcat_sim['weights'][isSF])
sub.plot(smf_censim[0], smf_censim[1], c='C1', lw=2, ls='-')
fsfs = np.clip(Evol.Fsfms(marr), 0., 1.)
fcenphi_err = phi_err * np.sqrt(1./(1.-np.array([Obvs.f_sat(mm, 0.05) for mm in marr])))
fsfs_errscale = np.ones(len(phi_err))
fsfs_errscale[fsfs < 1.] = np.sqrt(1./(1.-fsfs[fsfs < 1.]))
fsfsphi_err = fcenphi_err * fsfs_errscale
sub.errorbar(marr, fsfs * fcen * phi, fsfsphi_err, fmt='.C1', label='SF Centrals')
sub.legend(loc='lower left', handletextpad=0.2, fontsize=20)
sub.set_xlabel('$\log\,M_*$', fontsize=25)
sub.set_xlim([8.5, 12.])
sub.set_ylabel('$\Phi(M_*)$', fontsize=25)
sub.set_yscale('log')
sub.set_ylim([1e-6, 1e-1])
Out[38]:
In [ ]: