예제 #1
0
    def __init__(self, **kwargs):
        """ C'tor

        Keyword arguments
        -----------------

        basedir : str
            Top level directory for finding files
        """
        self._name_factory = NameFactory(**kwargs)
        self._catalog_comp_info_dicts = {}
        self._split_comp_info_dicts = {}
예제 #2
0
    def __init__(self, **kwargs):
        """ C'tor

        Keyword arguments
        -----------------

        name_policy : str
            Name of yaml file contain file naming policy definitions
        basedir : str
            Top level directory for finding files
        """
        self._name_factory = NameFactory(basedir=kwargs.get('basedir'))
        self._diffuse_comp_info_dict = {}
예제 #3
0
    def __init__(self, **kwargs):
        """ C'tor

        Keyword arguments
        -----------------

        projtype : str [healpix]
            Used to define path to gasmap files
        basedir : str
            Top level directory for finding files
        """
        self.projtype = kwargs.get('projtype', 'healpix')
        self._name_factory = NameFactory(basedir=kwargs.get('basedir'))
        self._ring_dicts = {}
        self._diffuse_comp_info_dicts = {}
예제 #4
0
 def __init__(self, **kwargs):
     """
     Keyword arguments
     -------------------
     basedir : str
         Top level directory for finding files
     """
     self._name_factory = NameFactory(**kwargs)
     self._dmm = kwargs.get('DiffuseModelManager',
                            DiffuseModelManager(**kwargs))
     self._gmm = kwargs.get('GalpropMapManager',
                            GalpropMapManager(**kwargs))
     self._csm = kwargs.get('CatalogSourceManager',
                            CatalogSourceManager(**kwargs))
     self._library = {}
     self._models = {}
     self._spec_lib = SpectralLibrary({})
예제 #5
0
def test_name_factory():
    names = dict(data_pass='******',
                 data_ver='P302',
                 evclass='source',
                 data_time='8years',
                 zcut='zmax105',
                 psftype='PSF3',
                 mktime='none',
                 ebin='E3',
                 coordsys='GAL',
                 irf_ver='V6',
                 sourcekey='ptsrc')

    name_fact = NameFactory(**names)

    test_dict = name_fact.make_filenames(**names)
    test_irfs = name_fact.irfs(**names)

    assert (test_dict['ltcube'] == 'lt_cubes/ltcube_8years_none_zmax105.fits')
    assert (test_dict['ft1file'] == 'P8_P302_8years_source_zmax105.lst')
    assert (
        test_dict['bexpcube'] ==
        'bexp_cubes/bexcube_P8_P302_8years_source_none_zmax105_E3_PSF3_GAL_V6.fits'
    )
    assert (
        test_dict['srcmaps'] ==
        'srcmaps/srcmaps_ptsrc_P8_P302_8years_source_none_zmax105_E3_PSF3_GAL_V6.fits'
    )
    assert (
        test_dict['ccube'] ==
        'counts_cubes/ccube_P8_P302_8years_source_none_zmax105_E3_PSF3_GAL.fits'
    )
    assert (
        test_dict['mcube'] ==
        'model_cubes/mcube_ptsrc_P8_P302_8years_source_none_zmax105_E3_PSF3_GAL_V6.fits'
    )
    assert (test_irfs == 'P8R2_SOURCE_V6')
예제 #6
0
import math

from fermipy.jobs.file_archive import FileFlags
from fermipy.jobs.chain import Link
from fermipy.jobs.gtlink import Gtlink
from fermipy.jobs.scatter_gather import ConfigMaker, build_sg_from_link
from fermipy.jobs.lsf_impl import make_nfs_path, get_lsf_default_args, LSF_Interface
from fermipy.diffuse.utils import create_inputlist
from fermipy.diffuse.name_policy import NameFactory
from fermipy.diffuse.binning import Component
from fermipy.diffuse.diffuse_src_manager import make_ring_dicts,\
    make_diffuse_comp_info_dict
from fermipy.diffuse.catalog_src_manager import make_catalog_comp_dict
from fermipy.diffuse import defaults as diffuse_defaults

NAME_FACTORY = NameFactory()


def make_input_file_list(binnedfile, num_files):
    """Make the list of input files for a particular energy bin X psf type """
    outdir_base = os.path.dirname(binnedfile)
    outbasename = os.path.basename(binnedfile)
    filelist = ""
    for i in range(num_files):
        split_key = "%06i" % i
        output_dir = os.path.join(outdir_base, split_key)
        filepath = os.path.join(
            output_dir, outbasename.replace('.fits',
                                            '_%s.fits.gz' % split_key))
        filelist += ' %s' % filepath
    return filelist
예제 #7
0
from fermipy import fits_utils
from fermipy.utils import load_yaml
from fermipy.jobs.file_archive import FileFlags
from fermipy.jobs.scatter_gather import ScatterGather
from fermipy.jobs.slac_impl import make_nfs_path
from fermipy.jobs.link import Link
from fermipy.jobs.chain import Chain

from fermipy.diffuse.binning import Component
from fermipy.diffuse.name_policy import NameFactory
from fermipy.diffuse import defaults as diffuse_defaults

from fermipy.diffuse.gt_split_and_mktime import SplitAndMktimeChain


NAME_FACTORY = NameFactory()
NAME_FACTORY_CLEAN = NameFactory()
NAME_FACTORY_DIRTY = NameFactory()


class ResidualCR(Link):
    """Small class to analyze the residual cosmic-ray contaimination.
    """
    appname = 'fermipy-residual-cr'
    linkname_default = 'residual-cr'
    usage = '%s [options]' % (appname)
    description = "Compute the residual cosmic-ray contamination"

    default_options = dict(ccube_dirty=diffuse_defaults.residual_cr['ccube_dirty'],
                           ccube_clean=diffuse_defaults.residual_cr['ccube_clean'],
                           bexpcube_dirty=diffuse_defaults.residual_cr['bexpcube_dirty'],