Example #1
0
    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)
Example #2
0
err = np.array([cov_matrix[i, i] for i in range(len(cov_matrix))])
bin_cen = (bin_edges[1:] + bin_edges[:-1]) / 2.

#cens_occ_model = Zheng07Cens(prim_haloprop_key = 'halo_vmax')
cens_occ_model = Zheng07Cens()
cens_prof_model = TrivialPhaseSpace()

#sats_occ_model =  Zheng07Sats(prim_haloprop_key = 'halo_vmax', modulate_with_cenocc=True)
sats_occ_model = Zheng07Sats(modulate_with_cenocc=True)
sats_prof_model = NFWPhaseSpace()

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.
pi_max = 60.
Lbox = 400.
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)

alpha, logM0, logM1 = [1.16, 13.28 - 1.7, 13.28]
model_instance.param_dict['alpha'] = alpha
model_instance.param_dict['logM0'] = logM0