In [7]:
import os
import time
import numpy as np
from halotools.sim_manager import CachedHaloCatalog
from halotools.empirical_models import PrebuiltHodModelFactory
from halotools.mock_observables import tpcf
from halotools.empirical_models.factories.mock_helpers import three_dim_pos_bundle
import matplotlib.pyplot as plt
from ChangTools.plotting import prettyplot
from ChangTools.plotting import prettycolors
%matplotlib inline
from ccppabc.code import util
In [19]:
# initialize hod model
model = PrebuiltHodModelFactory('zheng07', threshold=-21)
halocat = CachedHaloCatalog(simname='multidark', redshift=0, halo_finder='rockstar')
model.populate_mock(halocat, enforce_PBC=False)
In [20]:
N_sat = len(np.where(model.mock.galaxy_table['gal_type'] == 'satellites')[0])
N_gal = len(model.mock.galaxy_table['gal_type'])
In [21]:
print 'f_sat = ', np.float(N_sat)/np.float(N_gal)
Note that changing the PBC condition enforce_PBC option does not change the $f_{sat}$ value.
In [8]:
sub_model = PrebuiltHodModelFactory('zheng07', threshold=-21)
sub_model.new_haloprop_func_dict = {'sim_subvol': util.mk_id_column}
sub_halocat = CachedHaloCatalog(simname = 'multidark', redshift = 0, halo_finder = 'rockstar')
In [12]:
for rint in range(10):
simsubvol = lambda x: util.mask_func(x, rint)
sub_model.populate_mock(sub_halocat, masking_function=simsubvol, enforce_PBC=False)
sub_N_sat = len(np.where(sub_model.mock.galaxy_table['gal_type'] == 'satellites')[0])
sub_N_gal = len(sub_model.mock.galaxy_table['gal_type'])
print 'f_sat = ', np.float(sub_N_sat)/np.float(sub_N_gal)