Esempio n. 1
0
def test_galprop_ring_manager():
    basedir = os.path.join(PACKAGE_ROOT, 'diffuse', 'tests', 'data')
    kwargs = dict(basedir=basedir,
                  library=os.path.join(basedir, 'models', 'library.yaml'),
                  comp=os.path.join(basedir, 'binning.yaml'))
    gmm = make_ring_dicts(**kwargs)

    # spot check results
    assert(len(gmm.galkeys()) == 1)
    assert(gmm.galkeys()[0] == 'ref')
    assert(len(gmm.ring_dict('ref')) == 21)

    assert(gmm.ring_dict('ref')['merged_CO_5_ref'].ring == 5)
    assert(gmm.ring_dict('ref')['merged_CO_5_ref'].source_name == 'merged_CO')
    assert(len(gmm.ring_dict('ref')['merged_CO_5_ref'].files) == 4)

    assert(gmm.ring_dict('ref')['merged_IC_1_ref'].ring == 1)
    assert(gmm.ring_dict('ref')['merged_IC_1_ref'].source_name == 'merged_IC')
    assert(len(gmm.ring_dict('ref')['merged_IC_1_ref'].files) == 12)
Esempio n. 2
0
def test_galprop_ring_manager():
    basedir = os.path.join(PACKAGE_ROOT, 'diffuse', 'tests', 'data')
    kwargs = dict(basedir=basedir,
                  diffuse=os.path.join(basedir, 'diffuse_components.yaml'),
                  comp=os.path.join(basedir, 'binning.yaml'))
    gmm = make_ring_dicts(**kwargs)

    # spot check results
    assert(len(gmm.galkeys()) == 1)
    assert(gmm.galkeys()[0] == 'ref')
    assert(len(gmm.ring_dict('ref')) == 21)

    assert(gmm.ring_dict('ref')['merged_CO_5_ref'].ring == 5)
    assert(gmm.ring_dict('ref')['merged_CO_5_ref'].source_name == 'merged_CO')
    assert(len(gmm.ring_dict('ref')['merged_CO_5_ref'].files) == 4)

    assert(gmm.ring_dict('ref')['merged_IC_1_ref'].ring == 1)
    assert(gmm.ring_dict('ref')['merged_IC_1_ref'].source_name == 'merged_IC')
    assert(len(gmm.ring_dict('ref')['merged_IC_1_ref'].files) == 12)
Esempio n. 3
0
    def build_job_configs(self, args):
        """Hook to build job configurations
        """
        job_configs = {}

        gmm = make_ring_dicts(library=args['library'], basedir='.')

        for galkey in gmm.galkeys():
            ring_dict = gmm.ring_dict(galkey)
            for ring_key, ring_info in ring_dict.items():
                output_file = ring_info.merged_gasmap
                file_string = ""
                for fname in ring_info.files:
                    file_string += " %s" % fname
                logfile = make_nfs_path(output_file.replace('.fits', '.log'))
                job_configs[ring_key] = dict(output=output_file,
                                             args=file_string,
                                             logfile=logfile)

        return job_configs
Esempio n. 4
0
    def build_job_configs(self, args):
        """Hook to build job configurations
        """
        input_config = {}
        job_configs = {}

        gmm = make_ring_dicts(diffuse=args['diffuse'], basedir='.')

        for galkey in gmm.galkeys():
            ring_dict = gmm.ring_dict(galkey)
            for ring_key, ring_info in ring_dict.items():
                output_file = ring_info.merged_gasmap
                file_string = ""
                for fname in ring_info.files:
                    file_string += " %s" % fname
                job_configs[ring_key] = dict(output=output_file,
                                             args=file_string,
                                             logfile=output_file.replace('.fits', '.log'))

        output_config = {}
        return input_config, job_configs, output_config
Esempio n. 5
0
    def build_job_configs(self, args):
        """Hook to build job configurations
        """
        input_config = {}
        job_configs = {}

        gmm = make_ring_dicts(diffuse=args['diffuse'], basedir='.')

        for galkey in gmm.galkeys():
            ring_dict = gmm.ring_dict(galkey)
            for ring_key, ring_info in ring_dict.items():
                output_file = ring_info.merged_gasmap
                file_string = ""
                for fname in ring_info.files:
                    file_string += " %s" % fname
                job_configs[ring_key] = dict(output=output_file,
                                             args=file_string,
                                             logfile=output_file.replace(
                                                 '.fits', '.log'))

        output_config = {}
        return input_config, job_configs, output_config