Exemple #1
0
    "CylinderExtra": exotic_cylinder.CylinderExtra,
    "GradientCylinder": exotic_cylinder.GradientCylinder,
}

if teltype not in teltype_dict:
    raise Exception("Unsupported telescope type.")

telescope = teltype_dict[teltype].from_config(yconf["telescope"])

if "reionisation" in yconf["config"]:
    if yconf["config"]["reionisation"]:
        skymodel._reionisation = True

## Beam transfer generation
if "nosvd" in yconf["config"] and yconf["config"]["nosvd"]:
    bt = beamtransfer.BeamTransferNoSVD(outdir + "/bt/", telescope=telescope)
else:
    bt = beamtransfer.BeamTransfer(outdir + "/bt/", telescope=telescope)

## Set the singular value cut for the beamtransfers
if "svcut" in yconf["config"]:
    bt.svcut = float(yconf["config"]["svcut"])

if yconf["config"]["beamtransfers"]:
    bt.generate()

## KLTransform configuration
kltype_dict = {
    "KLTransform": kltransform.KLTransform,
    "DoubleKL": doublekl.DoubleKL
}
Exemple #2
0
    def load_config(self, configfile):

        with open(configfile) as f:
            yconf = yaml.safe_load(f)

        ## Global configuration
        ## Create output directory and copy over params file.
        if "config" not in yconf:
            raise Exception(
                "Configuration file must have an 'config' section.")

        self.directory = yconf["config"]["output_directory"]
        self.directory = os.path.expanduser(self.directory)
        self.directory = os.path.expandvars(self.directory)

        if not os.path.isabs(self.directory):
            self.directory = os.path.normpath(
                os.path.join(os.path.abspath(os.path.dirname(configfile)),
                             self.directory))

        if mpiutil.rank0:
            print("Product directory:", self.directory)

        ## Telescope configuration
        if "telescope" not in yconf:
            raise Exception(
                "Configuration file must have an 'telescope' section.")

        teltype = yconf["telescope"]["type"]

        telclass = _resolve_class(teltype, teltype_dict, "telescope")

        self.telescope = telclass.from_config(yconf["telescope"])

        if "reionisation" in yconf["config"]:
            if yconf["config"]["reionisation"]:
                skymodel._reionisation = True

        ## Beam transfer generation
        if "nosvd" in yconf["config"] and yconf["config"]["nosvd"]:
            self.beamtransfer = beamtransfer.BeamTransferNoSVD(
                self.directory + "/bt/", telescope=self.telescope)
        else:
            self.beamtransfer = beamtransfer.BeamTransfer(
                self.directory + "/bt/", telescope=self.telescope)

        ## Use the full SVD if requested
        if "fullsvd" in yconf["config"] and yconf["config"]["fullsvd"]:
            self.beamtransfer = beamtransfer.BeamTransferFullSVD(
                self.directory + "/bt/", telescope=self.telescope)
        else:
            self.beamtransfer = beamtransfer.BeamTransfer(
                self.directory + "/bt/", telescope=self.telescope)

        ## Set the singular value cut for the beamtransfers
        if "svcut" in yconf["config"]:
            self.beamtransfer.svcut = float(yconf["config"]["svcut"])

        ## Set the singular value cut for the *polarisation* beamtransfers
        if "polsvcut" in yconf["config"]:
            self.beamtransfer.polsvcut = float(yconf["config"]["polsvcut"])

        if yconf["config"]["beamtransfers"]:
            self.gen_beams = True

        if "skip_svd" in yconf["config"] and yconf["config"]["skip_svd"]:
            self.skip_svd = True

        self.kltransforms = {}

        if "kltransform" in yconf:

            for klentry in yconf["kltransform"]:
                kltype = klentry["type"]
                klname = klentry["name"]

                klclass = _resolve_class(kltype, kltype_dict, "KL filter")

                kl = klclass.from_config(klentry,
                                         self.beamtransfer,
                                         subdir=klname)
                self.kltransforms[klname] = kl

        if yconf["config"]["kltransform"]:
            self.gen_kl = True

        self.psestimators = {}

        if yconf["config"]["psfisher"]:
            self.gen_ps = True

            if "psfisher" not in yconf:
                raise Exception(
                    "Require a psfisher section if config: psfisher is Yes.")

        if "psfisher" in yconf:
            for psentry in yconf["psfisher"]:
                pstype = psentry["type"]
                klname = psentry["klname"]
                psname = psentry["name"] if "name" in psentry else "ps"

                psclass = _resolve_class(pstype, pstype_dict, "PS estimator")

                if klname not in self.kltransforms:
                    warnings.warn(
                        "Desired KL object (name: %s) does not exist." %
                        klname)
                    self.psestimators[psname] = None
                else:
                    self.psestimators[psname] = psclass.from_config(
                        psentry, self.kltransforms[klname], subdir=psname)
Exemple #3
0
    def load_config(self, configfile):

        with open(configfile) as f:
            yconf = yaml.safe_load(f)

        ## Global configuration
        ## Create output directory and copy over params file.
        if 'config' not in yconf:
            raise Exception(
                'Configuration file must have an \'config\' section.')

        self.directory = yconf['config']['output_directory']
        self.directory = os.path.expanduser(self.directory)
        self.directory = os.path.expandvars(self.directory)

        if not os.path.isabs(self.directory):
            self.directory = os.path.normpath(
                os.path.join(os.path.abspath(os.path.dirname(configfile)),
                             self.directory))

        if mpiutil.rank0:
            print "Product directory:", self.directory

        ## Telescope configuration
        if 'telescope' not in yconf:
            raise Exception(
                'Configuration file must have an \'telescope\' section.')

        teltype = yconf['telescope']['type']

        telclass = _resolve_class(teltype, teltype_dict, 'telescope')

        self.telescope = telclass.from_config(yconf['telescope'])

        if 'reionisation' in yconf['config']:
            if yconf['config']['reionisation']:
                skymodel._reionisation = True

        ## Beam transfer generation
        if 'nosvd' in yconf['config'] and yconf['config']['nosvd']:
            self.beamtransfer = beamtransfer.BeamTransferNoSVD(
                self.directory + '/bt/', telescope=self.telescope)
        else:
            self.beamtransfer = beamtransfer.BeamTransfer(
                self.directory + '/bt/', telescope=self.telescope)

        ## Use the full SVD if requested
        if 'fullsvd' in yconf['config'] and yconf['config']['fullsvd']:
            self.beamtransfer = beamtransfer.BeamTransferFullSVD(
                self.directory + '/bt/', telescope=self.telescope)
        else:
            self.beamtransfer = beamtransfer.BeamTransfer(
                self.directory + '/bt/', telescope=self.telescope)

        ## Set the singular value cut for the beamtransfers
        if 'svcut' in yconf['config']:
            self.beamtransfer.svcut = float(yconf['config']['svcut'])

        ## Set the singular value cut for the *polarisation* beamtransfers
        if 'polsvcut' in yconf['config']:
            self.beamtransfer.polsvcut = float(yconf['config']['polsvcut'])

        if yconf['config']['beamtransfers']:
            self.gen_beams = True

        if 'skip_svd' in yconf['config'] and yconf['config']['skip_svd']:
            self.skip_svd = True

        self.kltransforms = {}

        if 'kltransform' in yconf:

            for klentry in yconf['kltransform']:
                kltype = klentry['type']
                klname = klentry['name']

                klclass = _resolve_class(kltype, kltype_dict, 'KL filter')

                kl = klclass.from_config(klentry,
                                         self.beamtransfer,
                                         subdir=klname)
                self.kltransforms[klname] = kl

        if yconf['config']['kltransform']:
            self.gen_kl = True

        self.psestimators = {}

        if yconf['config']['psfisher']:
            self.gen_ps = True

            if 'psfisher' not in yconf:
                raise Exception(
                    'Require a psfisher section if config: psfisher is Yes.')

        if 'psfisher' in yconf:
            for psentry in yconf['psfisher']:
                pstype = psentry['type']
                klname = psentry['klname']
                psname = psentry['name'] if 'name' in psentry else 'ps'

                psclass = _resolve_class(pstype, pstype_dict, 'PS estimator')

                if klname not in self.kltransforms:
                    warnings.warn(
                        'Desired KL object (name: %s) does not exist.' %
                        klname)
                    self.psestimators[psname] = None
                else:
                    self.psestimators[psname] = psclass.from_config(
                        psentry, self.kltransforms[klname], subdir=psname)
Exemple #4
0
                }

if teltype not in teltype_dict:
    raise Exception("Unsupported telescope type.")

telescope = teltype_dict[teltype].from_config(yconf['telescope'])


if 'reionisation' in yconf['config']:
    if yconf['config']['reionisation']:
        skymodel._reionisation = True


## Beam transfer generation
if 'nosvd' in yconf['config'] and yconf['config']['nosvd']:
    bt = beamtransfer.BeamTransferNoSVD(outdir + '/bt/', telescope=telescope)    
else:
    bt = beamtransfer.BeamTransfer(outdir + '/bt/', telescope=telescope)

## Set the singular value cut for the beamtransfers
if 'svcut' in yconf['config']:
    bt.svcut = float(yconf['config']['svcut'])

#if yconf['config']['beamtransfers']:
#    bt.generate()




## KLTransform configuration
kltype_dict =   {   'KLTransform'   : kltransform.KLTransform,