def setUp(self): mock.set_loglevel(3) mock.cosmology_set(0.31) u = [2, 2, 1, 1, 0, 0, 0, 1, 0] boxsize = 600.0 self.remap = mock.Remap(u, boxsize) # sky ra_range = [30.1, 38.9] dec_range = [-6.0, -4.1] z_range = [0.38889, 1.21239] self.sky = mock.Sky(ra_range, dec_range, z_range) # slice self.slice = mock.Slice(self.remap, self.sky)
# redshift range z_mins = [] z_maxs = [] for snp in param['snapshots']: z_mins.append(redshift_from_a(snp['a'][2])) z_maxs.append(redshift_from_a(snp['a'][1])) z_min = min(z_mins) z_max = max(z_maxs) print('Lightcone redshift range: z= (%.5f, %.5f)' % (z_min, z_max)) # 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()
mock.power.init(arg.dir + '/' + param['power_spectrum']) # # redshift range # z_min = 0.39 z_max = 1.21 print('redshift range %f %f' % (z_min, z_max)) # nz # nbar_obs= mock.array.loadtxt(arg.dir + '/' + param['nz']) # 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)
return arr redshift_bins = read_redshift_bins(param['redshift_bins']) print0(redshift_bins) z_min_all = min(z_mins) z_max_all = max(z_maxs) # nz nbar_obs = mock.array.loadtxt(arg.dir + '/' + param['nz']) # sky sky = {} for reg in param['reg']: sky[reg['name']] = mock.Sky(reg['ra'], reg['dec'], [z_min_all, z_max_all]) flog = None iter = 0 if mock.comm.rank == 0: if not os.path.exists(outdir): os.mkdir(outdir) if arg.test: for i in range(1000): filename = '%s/nz_%05d.txt' % (outdir, i) if not os.path.isfile(filename): break iter = i flog = open('%s/fit_hod.log' % outdir, 'a', 1) else: