def __init__(self, **kwargs): Zheng07Cens.__init__(self, **kwargs) PreservingNgalHeavisideAssembias.__init__( self, lower_assembias_bound=self._lower_occupation_bound, upper_assembias_bound=self._upper_occupation_bound, method_name_to_decorate='mean_occupation', **kwargs)
def __init__(self, **kwargs): Zheng07Cens.__init__(self, threshold = -21) HeavisideAssembias.__init__(self, method_name_to_decorate = 'mean_occupation', lower_assembias_bound = 0., upper_assembias_bound = 1, **kwargs)
def __init__(self, config): super().__init__(config) self.cur_wp = np.zeros(11) if self['sim'] == "bolplanck": halocat = CachedHaloCatalog(simname='bolplanck') elif self['sim'] == "old": halocat = CachedHaloCatalog( fname='/home/lom31/Halo/hlist_1.00231.list.halotools_v0p1.hdf5', update_cached_fname=True) halocat.redshift = 0. elif self['sim'] == "smdpl": halocat = CachedHaloCatalog( fname= '/home/lom31/.astropy/cache/halotools/halo_catalogs/SMDPL/rockstar/2019-07-03-18-38-02-9731.dat.my_cosmosim_halos.hdf5', update_cached_fname=True) #halocat = CachedHaloCatalog(fname='/home/lom31/.astropy/cache/halotools/halo_catalogs/smdpl/rockstar/2019-07-03-18-38-02-9731.dat.my_cosmosim_halos.hdf5',update_cached_fname = True) halocat.redshift = 0. elif self['sim'] == "mdr1": halocat = CachedHaloCatalog( fname= '/home/lom31/.astropy/cache/halotools/halo_catalogs/multidark/rockstar/hlist_0.68215.list.halotools_v0p4.hdf5', update_cached_fname=True) if self['param'] == 'mvir': cens_occ_model = Zheng07Cens(threshold=-19) cens_prof_model = TrivialPhaseSpace() sats_occ_model = Zheng07Sats(modulate_with_cenocc=True, threshold=-19) sats_prof_model = NFWPhaseSpace() elif self['param'] == 'vmax': cens_occ_model = Zheng07Cens(prim_haloprop_key='halo_vmax', threshold=-19) cens_prof_model = TrivialPhaseSpace() sats_occ_model = Zheng07Sats(prim_haloprop_key='halo_vmax', threshold=-19, modulate_with_cenocc=True) sats_prof_model = NFWPhaseSpace() global model_instance model_instance = HodModelFactory(centrals_occupation=cens_occ_model, centrals_profile=cens_prof_model, satellites_occupation=sats_occ_model, satellites_profile=sats_prof_model) try: model_instance.mock.populate() except: model_instance.populate_mock(halocat)
def to_halotools(cosmo, redshift, mdef, concentration_key=None, **kwargs): """ Return the Zheng 07 HOD model. See :func:`halotools.empirical_models.zheng07_model_dictionary`. Parameters ---------- cosmo : the nbodykit or astropy Cosmology object to use in the model redshift : float the desired redshift of the model mdef : str, optional string specifying mass definition, used for computing default halo radii and concentration; should be 'vir' or 'XXXc' or 'XXXm' where 'XXX' is an int specifying the overdensity concentration_key : str the name of the column that will specify concentration; if not provided, the analytic formula from `Dutton and Maccio 2014 <https://arxiv.org/abs/1402.7073>`_ is used. **kwargs : additional keywords passed to the model components; see the Halotools documentation for further details Returns ------- :class:`~halotools.empirical_models.HodModelFactory` the halotools object implementing the HOD model """ from halotools.empirical_models import Zheng07Sats, Zheng07Cens, NFWPhaseSpace, TrivialPhaseSpace from halotools.empirical_models import HodModelFactory kwargs.setdefault('modulate_with_cenocc', True) # need astropy Cosmology if isinstance(cosmo, Cosmology): cosmo = cosmo.to_astropy() # determine concentration key if concentration_key is None: conc_mass_model = 'dutton_maccio14' else: conc_mass_model = 'direct_from_halo_catalog' # determine mass column mass_key = 'halo_m' + mdef # occupation functions cenocc = Zheng07Cens(prim_haloprop_key=mass_key, **kwargs) satocc = Zheng07Sats(prim_haloprop_key=mass_key, cenocc_model=cenocc, **kwargs) satocc._suppress_repeated_param_warning = True # profile functions kwargs.update({'cosmology': cosmo, 'redshift': redshift, 'mdef': mdef}) censprof = TrivialPhaseSpace(**kwargs) satsprof = NFWPhaseSpace(conc_mass_model=conc_mass_model, **kwargs) # make the model model = {} model['centrals_occupation'] = cenocc model['centrals_profile'] = censprof model['satellites_occupation'] = satocc model['satellites_profile'] = satsprof return HodModelFactory(**model)
], [ -3.56879870e+00, -2.27808131e+00, -1.34387366e+00, 2.79344609e-01, -8.16055506e-01, 2.51356140e-01, 5.03253824e-01, 5.08217249e-01, 3.29184438e-01, 1.34667684e-01, 3.97669949e-01, 4.19781524e-01, 1.70968431e-01, 2.40612750e-01, 4.47443368e-01, 6.34967423e-01, 7.59893604e-01, 9.83776744e-01, 1.37576149e+00, 1.55288996e+00, 1.88033657e+00, 2.33929965e+00, 2.93594021e+00, 3.46849456e+00, 4.26576964e+00, 5.18755609e+00, 6.10833984e+00, 7.04389976e+00, 7.09565921e+00 ]]) err = np.sqrt(np.array([cov[i, i] for i in range(len(cov))])) bin_cen = (bin_edges[1:] + bin_edges[:-1]) / 2. cens_occ_model = Zheng07Cens(prim_haloprop_key='halo_vmax') cens_prof_model = TrivialPhaseSpace() sats_occ_model = Zheng07Sats(prim_haloprop_key='halo_vmax') sats_prof_model = NFWPhaseSpace() model_instance = HodModelFactory(centrals_occupation=cens_occ_model, centrals_profile=cens_prof_model, satellites_occupation=sats_occ_model, satellites_profile=sats_prof_model) halocat = CachedHaloCatalog(simname='bolplanck', redshift=0.0) model_instance.populate_mock(halocat) #log liklihood def lnlike(theta): #, wp_val, wperr, model_instance):