def __init__(self, domain): self.domain = domain self.reg = domain[0] self.z_min = float(domain[1]) self.z_max = float(domain[2]) # Load lightcones self.halo_lightcones = mock.LightCones() self.halo_lightcones.load_h5([ 'halo_lightcone/%s/lightcone_%05d.h5' % (domain[0], n + 1) for n in range(int(arg.nmocks)) ]) self.rand_lightcones = mock.LightCones() self.rand_lightcones.load_h5([ 'rand_lightcone/%s/lightcone_%05d.h5' % (domain[0], n + 1) for n in range(int(arg.nrands)) ]) # Catalogues will be generated from lightcones for given hod self.galaxy_catalogues = mock.Catalogues() self.random_catalogues = mock.Catalogues() self.corr = mock.CorrelationFunction(rp_min=0.5, rp_max=60.0, nbin=20, pi_max=60.0, pi_nbin=20) # VIPERS projected correlation function self.wp_obs = np.loadtxt( 'data/vipers/try1/corr_projected_%s_%s_%s.txt' % domain, delimiter=' ')
def __init__(self, domain): self.domain = domain self.reg = domain[0] self.z_min = float(domain[1]) self.z_max = float(domain[2]) self.sky = sky[self.reg] print0('Create Data for ', domain) # Load lightcones self.halo_lightcones = mock.LightCones() self.halo_lightcones.load_h5([ '%s/halo_lightcone/%s/lightcone_%05d.h5' % (arg.dir, domain[0], n + 1) for n in range(int(arg.nmocks)) if n % mock.comm.n_nodes == mock.comm.rank ]) print0("len halo lightcone %d" % len(self.halo_lightcones)) self.rand_lightcones = mock.LightCones() self.rand_lightcones.load_h5([ '%s/rand_lightcone/%s/lightcone_%05d.h5' % (arg.dir, domain[0], n + 1) for n in range(int(arg.nrands)) if n % mock.comm.n_nodes == mock.comm.rank ]) print0("len rand lightcone %d" % len(self.rand_lightcones)) # Catalogues will be generated from lightcones for given hod self.galaxy_catalogues = mock.Catalogues() self.random_catalogues = mock.Catalogues() self.corr = mock.CorrelationFunction(rp_min=0.1, rp_max=60.0, nbin=24, pi_max=60.0, pi_nbin=20, ra_min=0.001388889, dec_min=0.0375) # VIPERS projected correlation function self.wp_obs = mock.array.loadtxt( '%s/data/vipers/run4/0.1/corr_projected_%s_%s_%s.txt' % ((arg.dir, ) + domain))[:, 1] if mock.comm.rank == 0: self.covinv = np.load('%s/data/vipers/run4/0.1/covinv_%s_%s_%s.npy'\ % ((arg.dir,) + domain)) print0('Inverse covariance matrix', self.covinv.shape) else: self.covinv = None
# sky print('Sky ra=(%.5f, %.5f), dec=(%.5f, %.5f)' % tuple(reg['ra'] + reg['dec'])) sky = mock.Sky(reg['ra'], reg['dec'], [z_min, z_max]) # box remapping print('Remap u=' + reg['remap'].__repr__()) remap = mock.Remap(reg['remap'], param['boxsize']) # slice slice = mock.Slice(remap, sky) nslice = len(slice) # lightcones lightcones = mock.LightCones() # snapshots snapshots = mock.Snapshots() fof_dir = param['fof'] part_dir = param['particle'] halomass_dir = param['halomass'] # output directory if not os.path.exists(out_dir): os.mkdir(out_dir) if not os.path.exists(out_dir + '/w1'): os.mkdir(out_dir + '/w1') if not os.path.exists(out_dir + '/w4'):
# sky sky = {} for reg in param['reg']: sky[reg['name']] = mock.Sky(reg['ra'], reg['dec'], [z_min, z_max]) # # Set HOD parameters # hod = mock.Hod() hod_param = [11.632682100874081, -0.5706390738948128, 4.904043697780981, -1.0126352684312565, 0.45, 0.9, 1.05, 0.0, 0.9, 0.0, 4.0, 2.0] hod.set_coef(hod_param) lightcones = mock.LightCones() cats = mock.Catalogues() n = int(arg.n) def write_catalogue(filename, a): with open(filename, 'w') as f: for i in range(a.shape[0]): f.write('%d %e %e %e %e %e %e %e %e %e %e\n' % ( i, a[i, 0], a[i, 1], a[i, 2], a[i, 4], a[i, 3], a[i, 5], a[i, 6], a[i, 7], a[i, 10], a[i, 11]))
def setUp(self): mock.set_loglevel(3) self.lightcones = mock.LightCones()