Exemplo n.º 1
0
    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=' ')
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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)

#
# Read catalogues
#
randoms = mock.Catalogues()
filename = '../rands/%s/rand_%s_%05d.txt' % (arg.reg, arg.reg, int(arg.i))
a = np.loadtxt(filename, delimiter=' ', usecols=[1, 2, 3, 6, 7])
randoms.append(a, z_min=arg.zmin, z_max=arg.zmax)

#
# Compute RR paris
#
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)
Exemplo n.º 5
0
# 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]))

reg = arg.reg