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
def assemblybias_mocks(i0, i1): ''' construct assembly bias test mocks ''' theta_fid = Galaxies.thetahod_literature('reid2014_cmass') abiases = np.array([ -1., -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ]) for i_fid in range(i0, i1 + 1): print('Fiducial %i' % i_fid) halos = Halos.Quijote_fiducial_HR_Rockstar(i_fid, z=0.5) _Z07AB = Galaxies.AssembiasZheng07Model() Z07AB = _Z07AB.to_halotools(halos.cosmo, halos.attrs['redshift'], halos.attrs['mdef'], sec_haloprop_key='halo_nfw_conc') for i_ab, abias in enumerate(abiases): # HOD parameters with assembly bias _theta_ab = theta_fid.copy() _theta_ab['mean_occupation_centrals_assembias_param1'] = abias _theta_ab['mean_occupation_satellites_assembias_param1'] = abias # populate with HOD hod_ab = halos.populate(Z07AB, seed=0, **_theta_ab) gals_ab = FM.BOSS(hod_ab, sample='cmass-south', seed=0, veto=True, fiber_collision=True, silent=True) fgal = os.path.join( dat_dir, 'tests', 'hod.quijote_fid_hr%i.z0p5.cmass_sgc.abias%i.bf' % (i_fid, i_ab)) gals_ab.save(fgal) return None
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)