示例#1
0
 def setUp(self):
     mock.set_loglevel(3)
     mock.cosmology_set(0.31)
     self.hod = mock.Hod()
     self.n = len(self.hod)
     self.c = [12.0, 0.5, 0.1, 0.05, 0.95, 0.12, 13.0, 1.0, 1.5, 0.15]
     for i, c in enumerate(self.c):
         self.hod[i] = c
示例#2
0
    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)
示例#3
0
    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)
示例#4
0
 def setUp(self):
     mock.set_loglevel(3)
     self.ps = mock.PowerSpectrum('../data/planck1_matterpower.dat')
示例#5
0
 def setUp(self):
     self.z_max = 1.5
     mock.set_loglevel(3)
     mock.cosmology_set(0.31)
     self.distance = mock.Distance(self.z_max)
#parser.add_argument('--ssr-quad', default='vipers_quad_ssr.txt',
#                    help='ssr quad file')

arg = parser.parse_args()

#
# Read parameter file
#
# print('Parameter file: %s' % arg.param)

with open(arg.param, 'r') as f:
    param = json.load(f)

omega_m = param['omega_m']
omega_l = 1.0 - omega_m
mock.set_loglevel(7)
mock.cosmology.set(omega_m)
mock.distance.init(1.21)
sys.stderr.write('Setting cosmology: omega_m= %.4f\n' % omega_m)

zmin = float(arg.zmin)
zmax = float(arg.zmax)
#rmin = mock.cosmology.compute_comoving_distance(1.0/(1.0 + arg.zmin))
#rmax = mock.cosmology.compute_comoving_distance(1.0/(1.0 + arg.zmax)))
#sys.stderr.write('rmin, max= %.4f %.4f\n' % (rmin, rmax))


def read_ssr_quad(filename):
    """read ssr file vipers_quad_ssr.txt and set to ssr_quad dictionary"""
    ssr_quad = {}
#
# Read parameter file
#
print('# Parameter file: %s' % arg.param)

with open(arg.param, 'r') as f:
    param = json.load(f)

omega_m = param['omega_m']
print('# Setting cosmology: omega_m= %.4f' % omega_m)
print('# redshift-range %f %f' % (arg.zmin, arg.zmax))

#
# Initilise
#
mock.set_loglevel(0)
mock.cosmology.set(omega_m)
mock.distance.init(1.2)

def read_catalogues(filebase, irange):
     cats = mock.Catalogues()
     for i in range(int(irange[0]), int(irange[1]) + 1):
         filename = '%s%05d.txt' % (filebase, i)
         a = np.loadtxt(filename, delimiter=' ', usecols=[1,2,3,6,7])
         cats.append(a, z_min=arg.zmin, z_max= arg.zmax)
     return cats

galaxies = read_catalogues('../mocks/%s/mock_%s_' % (arg.reg, arg.reg), igalaxies)
randoms  = read_catalogues('../rands/%s/rand_%s_' % (arg.reg, arg.reg), irandoms)

示例#8
0
with open(arg.param, 'r') as f:
    param = json.load(f)

# find region name w1 or w4
for reg in param['reg']:
    if reg['name'] == arg.reg:
        break

if reg['name'] != arg.reg:
    raise Exception('region %s not found in parameter file %s' %
                    (arg.reg, arg.param))

print('Region: %s' % reg['name'])

mock.set_loglevel(0)

# omega_m
omega_m = param['omega_m']
print('Setting cosmology: omega_m= %.4f' % omega_m)
mock.cosmology.set(omega_m)

# power spectrum
mock.power.init(param['power_spectrum'])
mock.sigma.init(M_min=9.0e9)

# Random
if arg.random:
    random = True
    out_dir = 'rand_lightcone'
    print('random')
#parser.add_argument('--ssr-quad', default='vipers_quad_ssr.txt',
#                    help='ssr quad file')

arg = parser.parse_args()

#
# Read parameter file
#
# print('Parameter file: %s' % arg.param)

with open(arg.param, 'r') as f:
    param = json.load(f)

omega_m = param['omega_m']
omega_l = 1.0 - omega_m
mock.set_loglevel(7)
mock.cosmology.set(omega_m)
mock.distance.init(1.21)
sys.stderr.write('Setting cosmology: omega_m= %.4f\n' % omega_m)

zmin = float(arg.zmin)
zmax = float(arg.zmax)
#rmin = mock.cosmology.compute_comoving_distance(1.0/(1.0 + arg.zmin))
#rmax = mock.cosmology.compute_comoving_distance(1.0/(1.0 + arg.zmax)))
#sys.stderr.write('rmin, max= %.4f %.4f\n' % (rmin, rmax))

def read_ssr_quad(filename):
    """read ssr file vipers_quad_ssr.txt and set to ssr_quad dictionary"""
    ssr_quad = {}
    
    for line in open(filename, 'r'):
示例#10
0
 def setUp(self):
     mock.set_loglevel(3)
     mock.cosmology_set(0.31)
示例#11
0
 def setUp(self):
     mock.set_loglevel(3)
     mock.cosmology_set(0.31)
     self.ps = mock.PowerSpectrum('../data/planck1_matterpower.dat')
     self.s = mock.Sigma(self.ps)
     self.mf = mock.MassFunction(self.s)
示例#12
0
 def setUp(self):
     mock.set_loglevel(3)
     mock.cosmology_set(0.31)
     self.ps = mock.PowerSpectrum('../data/planck1_matterpower.dat')
     self.s = mock.Sigma(self.ps)
     self.mf = mock.MassFunction(self.s)
示例#13
0
 def setUp(self):
     mock.set_loglevel(3)
     self.ps= mock.PowerSpectrum('../data/planck1_matterpower.dat')
示例#14
0
 def setUp(self):
     mock.set_loglevel(3)
     self.lightcones = mock.LightCones()
示例#15
0
 def setUp(self):
     mock.set_loglevel(3)
     self.lightcones = mock.LightCones()