def standard_mocks(i0, i1):
    ''' construct standard test mocks 
    '''
    for i_fid in range(i0, i1 + 1):
        print('Fiducial %i' % i_fid)
        # read in halo catalog
        halos = Halos.Quijote_fiducial_HR(i_fid, z=0.5)
        for i_hod in range(5):
            print('  HOD %i' % i_hod)
            fgal = os.path.join(
                dat_dir, 'tests',
                'hod.quijote_fid%i.z0p5.cmass_sgc.%i.bf' % (i_fid, i_hod))
            fhod = fgal.replace('.bf', '.npy')

            if not os.path.isfile(fhod) or not os.path.isdir(fgal):
                # sample HOD parameters
                theta_hod = sample_HOD()
                np.save(fhod, theta_hod)
                # populate with HOD
                hod = Galaxies.hodGalaxies(halos, theta_hod, seed=0)
                # apply forward model (footprint, veto mask fiber collisions)
                gals = FM.BOSS(hod,
                               sample='cmass-south',
                               seed=0,
                               veto=True,
                               fiber_collision=True,
                               silent=True)
                # save to file
                gals.save(fgal)
    return None
Esempio n. 2
0
def sample_HOD(): 
    ''' sample HOD value based on priors set by Parejko+(2013)
    '''
    hod_min = np.array([13.2, 0.4, 13.1, 14., 0.7])
    dhod = np.array([0.15, 0.1, 0.4, 0.3, 0.4])
    _hod = hod_min + dhod * np.random.uniform(size=(5))
    return {'logMmin': _hod[0], 'sigma_logM': _hod[1], 'logM0': _hod[2], 'logM1': _hod[3], 'alpha': _hod[4]}


dat_dir = '/tigress/chhahn/simbig/lowz/'
for i_lhc in range(i0, i1):
    print('LHC %i' % i_lhc)
    # read in halo catalog
    halos = Halos.Quijote_LHC_HR(i_lhc, z=0.5)
    for i_hod in range(5): 
        print('  HOD %i' % i_hod)
        fgal = os.path.join(dat_dir, 'hod.quijote_LH%i.z0p5.lowz_sgc.%i.bf' % (i_lhc, i_hod))
        fhod = fgal.replace('.bf', '.npy')

        if not os.path.isfile(fhod) or not os.path.isdir(fgal): 
            # sample HOD parameters
            theta_hod = sample_HOD()
            np.save(fhod, theta_hod)
            # populate with HOD
            hod = Galaxies.hodGalaxies(halos, theta_hod, seed=0)
            # apply forward model (footprint, veto mask fiber collisions)
            gals = FM.BOSS(hod, sample='lowz-south', seed=0, veto=True, fiber_collision=True, silent=True)
            # save to file 
            gals.save(fgal)
Esempio n. 3
0
            'mean_occupation_centrals_assembias_param1': _hod[5],
            'mean_occupation_satellites_assembias_param1': _hod[6]
        }
    else:
        raise NotImplementedError


dat_dir = '/tigress/chhahn/simbig/chirag/'
for i_lhc in range(i0, i1):
    print('LHC %i' % i_lhc)
    # read in halo catalog
    halos = Halos.Quijote_LHC_HR(i_lhc, z=zred)
    for i_hod in range(5):
        print('  HOD %i' % i_hod)
        fgal = os.path.join(
            dat_dir, 'hod.quijote_LH%i.z%s.%s.%i.bf' %
            (i_lhc, str(zred).replace('.', 'p'), m_hod, i_hod))
        fhod = fgal.replace('.bf', '.npy')

        if not os.path.isfile(fhod) or not os.path.isdir(fgal):
            # sample HOD parameters
            theta_hod = sample_HOD(m_hod)
            np.save(fhod, theta_hod)
            # populate box with HOD
            hod = Galaxies.hodGalaxies(halos,
                                       theta_hod,
                                       seed=0,
                                       hod_model=m_hod)
            # save box
            hod.save(fgal)