def assemblybias_mocks(i0, i1):
    ''' Pl(k) of assembly bias test mocks 
    '''
    for i_fid in range(i0, i1 + 1):
        print('Fiducial %i' % i_fid)
        for i_ab in range(20):
            print('  HOD %i' % i_hod)
            fplk = os.path.join(
                dat_dir, 'tests', 'plk',
                'plk.hod.quijote_fid_hr%i.z0p5.cmass_sgc.abias%i.bf' %
                (i_fid, i_ab))
            if not os.path.isfile(fplk):
                # read galaxy catalog
                fgal = os.path.join(
                    dat_dir, 'tests',
                    'hod.quijote_fid_hr%i.z0p5.cmass_sgc.abias%i.bf' %
                    (i_fid, i_ab))
                gals = UT.read_bf_hod(fgal)

                # construct corresponding randoms
                rand = FM.BOSS_randoms(gals, veto=True, sample='cmass-south')

                # measure power spectrum
                k, p0k, p2k, p4k = CosmoObs.Plk_survey(gals,
                                                       rand,
                                                       Ngrid=360,
                                                       dk=0.005,
                                                       P0=1e4,
                                                       silent=True)

                # save power spectrum to file
                hdr = 'k, p0k, p2k, p4k'
                np.savetxt(fplk,
                           np.array([k, p0k, p2k, p4k]).T,
                           fmt='%.5e %.5e %.5e %.5e',
                           delimiter='\t',
                           header=hdr)

    return None
Ejemplo n.º 2
0
dat_dir = '/tigress/chhahn/simbig/cmass/'

for i_lhc in range(i0, i1):
    print('LHC %i' % i_lhc)
    for i_hod in range(5):
        print('  HOD %i' % i_hod)
        fplk = os.path.join(
            dat_dir,
            'plk.hod.quijote_LH%i.z0p5.cmass_sgc.%i.dat' % (i_lhc, i_hod))
        if not os.path.isfile(fplk):
            # read galaxy catalog
            fgal = os.path.join(
                dat_dir,
                'hod.quijote_LH%i.z0p5.cmass_sgc.%i.bf' % (i_lhc, i_hod))
            gals = UT.read_bf_hod(fgal)

            # construct corresponding randoms
            rand = FM.BOSS_randoms(gals, veto=True, sample='cmass-south')

            # measure power spectrum
            k, p0k, p2k, p4k = CosmoObs.Plk_survey(gals,
                                                   rand,
                                                   Ngrid=360,
                                                   dk=0.005,
                                                   P0=1e4,
                                                   silent=True)

            # save power spectrum to file
            hdr = 'k, p0k, p2k, p4k'
            np.savetxt(fplk,