예제 #1
0
    def __init__(self, pix, transf, sky_lib, lib_dir, nlev_t=0.0, nlev_p=0.0, phase=None):
        """ initialize the library.
             pix     = a maps.pix object with the sky pixelization.
             transf  = a transfer function (with a multiplication operation defined for maps.tebbft),
                       usually describing the effect of an instrumental beam.
             sky_lib = a library object with a get_sim_tqu() method which provides the sky map realizations.
             lib_dir = directory to store the hash for the library.
             nlev_t  = temperature noise level. either a scalar or an map-sized 2D array.
                       noise realizations in each temperature pixel are given by nlev_t * standard normal.
             nlev_p  = polarization noise level. either a scalar or an map-sized 2D array.
                       noise realizations in each polarization pixel are given by nlev_p * standard normal.
             (optional) phase = phas.library object used to control the random number stream.
        """
        self.pix     = pix
        self.transf  = transf
        self.sky_lib = sky_lib
        self.lib_dir = lib_dir
        self.phase   = phase

        self.nlev_t  = nlev_t
        self.nlev_p  = nlev_p

        if (self.phase == None):
            self.phase = phas.library( 3*pix.nx*pix.ny, lib_dir = self.lib_dir + "/phase" )

        if (ql.mpi.rank == 0):
            if not os.path.exists(lib_dir):
                os.makedirs(lib_dir)

            if not os.path.exists(lib_dir + "/sim_hash.pk"):
                pk.dump( self.hashdict(), open(lib_dir + "/sim_hash.pk", 'w') )
        ql.mpi.barrier()
        util.hash_check( pk.load( open(lib_dir + "/sim_hash.pk", 'r') ), self.hashdict() )
예제 #2
0
    def __init__(self, pix, cl_unl, lib_dir, phase=None):
        """ initialize the library.
             pix     = a maps.pix object with the sky pixelization.
             cl_unl  = a spec.camb_clfile object containing the unlensed CMB temperature+polarization power spectra.
             lib_dir = directory to store the hash for the library.
             (optional) phase = phas.library object used to control the random number stream.
        """
        self.pix = pix
        self.cl_unl = cl_unl
        self.lib_dir = lib_dir
        self.phase = phase

        if self.phase == None:
            lmax = cl_unl.lmax
            self.phase = phas.library(8 * pix.nx * (pix.ny / 2 + 1),
                                      lib_dir=self.lib_dir + "/phase")

        if ql.mpi.rank == 0:
            if not os.path.exists(lib_dir):
                os.makedirs(lib_dir)

            if not os.path.exists(lib_dir + "/sim_hash.pk"):
                pk.dump(self.hashdict(), open(lib_dir + "/sim_hash.pk", 'w'))
        ql.mpi.barrier()
        util.hash_check(pk.load(open(lib_dir + "/sim_hash.pk", 'r')),
                        self.hashdict())
예제 #3
0
    def __init__(self,
                 pix,
                 transf,
                 sky_lib,
                 lib_dir,
                 nlev_t=0.0,
                 nlev_p=0.0,
                 phase=None):
        """ initialize the library.
             pix     = a maps.pix object with the sky pixelization.
             transf  = a transfer function (with a multiplication operation defined for maps.tebbft),
                       usually describing the effect of an instrumental beam.
             sky_lib = a library object with a get_sim_tqu() method which provides the sky map realizations.
             lib_dir = directory to store the hash for the library.
             nlev_t  = temperature noise level. either a scalar or an map-sized 2D array.
                       noise realizations in each temperature pixel are given by nlev_t * standard normal.
             nlev_p  = polarization noise level. either a scalar or an map-sized 2D array.
                       noise realizations in each polarization pixel are given by nlev_p * standard normal.
             (optional) phase = phas.library object used to control the random number stream.
        """
        self.pix = pix
        self.transf = transf
        self.sky_lib = sky_lib
        self.lib_dir = lib_dir
        self.phase = phase

        self.nlev_t = nlev_t
        self.nlev_p = nlev_p

        if (self.phase == None):
            self.phase = phas.library(3 * pix.nx * pix.ny,
                                      lib_dir=self.lib_dir + "/phase")

        if (ql.mpi.rank == 0):
            if not os.path.exists(lib_dir):
                os.makedirs(lib_dir)

            if not os.path.exists(lib_dir + "/sim_hash.pk"):
                pk.dump(self.hashdict(), open(lib_dir + "/sim_hash.pk", 'w'))
        ql.mpi.barrier()
        util.hash_check(pk.load(open(lib_dir + "/sim_hash.pk", 'r')),
                        self.hashdict())
예제 #4
0
    def __init__(self, pix, cl_unl, lib_dir, phase=None):
        """ initialize the library.
             pix     = a maps.pix object with the sky pixelization.
             cl_unl  = a spec.camb_clfile object containing the unlensed CMB temperature+polarization power spectra.
             lib_dir = directory to store the hash for the library.
             (optional) phase = phas.library object used to control the random number stream.
        """
        self.pix     = pix
        self.cl_unl  = cl_unl
        self.lib_dir = lib_dir
        self.phase   = phase

        if self.phase == None:
            lmax = cl_unl.lmax
            self.phase = phas.library( 8*pix.nx*(pix.ny/2+1), lib_dir = self.lib_dir + "/phase" )

        if ql.mpi.rank == 0:
            if not os.path.exists(lib_dir):
                os.makedirs(lib_dir)

            if not os.path.exists(lib_dir + "/sim_hash.pk"):
                pk.dump( self.hashdict(), open(lib_dir + "/sim_hash.pk", 'w') )
        ql.mpi.barrier()
        util.hash_check( pk.load( open(lib_dir + "/sim_hash.pk", 'r') ), self.hashdict() )