def __init__(self, linkname, **kwargs): """C'tor """ from fermipy.diffuse.job_library import create_sg_sum_ring_gasmaps, create_sg_vstack_diffuse from fermipy.diffuse.gt_srcmap_partial import create_sg_srcmap_partial link_gasmaps = create_sg_sum_ring_gasmaps(linkname="%s.merge_galprop" % linkname) link_srcmaps = create_sg_srcmap_partial(linkname="%s.srcmaps" % linkname) link_vstack_srcmaps = create_sg_vstack_diffuse(linkname="%s.vstack" % linkname) parser = argparse.ArgumentParser( usage='fermipy-diffuse-chain', description="Run diffuse component analysis setup") Chain.__init__(self, linkname, appname='fermipy-diffuse-chain', links=[link_gasmaps, link_srcmaps, link_vstack_srcmaps], options=DiffuseComponentChain.default_options.copy(), argmapper=self._map_arguments, parser=parser, **kwargs)
def __init__(self, linkname): """C'tor """ link_gtexphpsun = create_sg_Gtexphpsun(linkname="%s.gtexphpsun" % linkname, mapping={ 'data': 'dataset_yaml', 'comp': 'binning_yaml' }) link_gtsuntemp = create_sg_Gtsuntemp(linkname="%s.gtsuntemp" % linkname, mapping={ 'data': 'dataset_yaml', 'comp': 'binning_yaml' }) options = diffuse_defaults.sun_moon.copy() options['dry_run'] = (False, 'Print commands but do not run', bool) parser = argparse.ArgumentParser( usage='fermipy-solar-chain', description="Build sun and moon templates") Chain.__init__(self, linkname, appname='FIXME', links=[link_gtexphpsun, link_gtsuntemp], options=options, parser=parser)
def __init__(self, linkname, **kwargs): """C'tor """ comp_file = kwargs.get('comp', None) if comp_file: self.comp_dict = yaml.safe_load(open(comp_file)) coordsys = self.comp_dict.pop('coordsys') for v in self.comp_dict.values(): v['coordsys'] = coordsys else: self.comp_dict = None job_archive = kwargs.get('job_archive', None) parser = argparse.ArgumentParser(usage="fermipy-split-and-mktime [options]", description="Run gtselect, gtmktime and gtbin together") Chain.__init__(self, linkname, appname='fermipy-split-and-mktime', links=[], options=SplitAndMktime.default_options.copy(), argmapper=self._map_arguments, parser=parser, **kwargs) if self.comp_dict is not None: self.update_links(self.comp_dict) self.set_links_job_archive()
def __init__(self, linkname, **kwargs): """C'tor """ link_split_mktime = create_sg_split_and_mktime(linkname="%s.split" % linkname, mapping={ 'data': 'dataset_yaml', 'action': 'action_split', 'hpx_order_max': 'hpx_order_binning' }) link_coadd_split = create_sg_fermipy_coadd(linkname="%s.coadd" % linkname, mapping={ 'data': 'dataset_yaml', 'comp': 'binning_yaml', 'action': 'action_coadd' }) link_ltsum = crate_sg_gtltsum(linkname="%s.ltsum" % linkname, mapping={ 'data': 'dataset_yaml', 'comp': 'binning_yaml', 'action': 'action_ltsum' }) link_expcube = create_sg_gtexpcube2(linkname="%s.expcube" % linkname, mapping={ 'data': 'dataset_yaml', 'comp': 'binning_yaml', 'hpx_order': 'hpx_order_binning', 'action': 'action_expcube' }) link_cr_analysis = create_sg_residual_cr( linkname="%s.cr_analysis" % linkname, mapping={ 'data_dirty': 'dataset_dirty_yaml', 'data_clean': 'dataset_clean_yaml', 'hpx_order': 'hpx_order_fitting', 'action': 'action_analysis', 'comp': 'binning_yaml' }) parser = argparse.ArgumentParser( usage='fermipy-residual-cr-chain', description="Run residual cosmic-ray analysis chain") Chain.__init__(self, linkname, appname='fermipy-residual-cr-chain', links=[ link_split_mktime, link_coadd_split, link_ltsum, link_expcube, link_cr_analysis ], options=ResidualCRChain.default_options.copy(), argmapper=self._map_arguments, parser=parser, **kwargs)
def __init__(self, linkname, **kwargs): """C'tor """ link_split_and_bin = create_sg_split_and_bin( linkname="%s.split" % linkname, mapping={ 'hpx_order_max': 'hpx_order_ccube', 'action': 'action_split' }) link_expcube = create_sg_gtexpcube2(linkname="%s.expcube" % linkname, mapping={ 'hpx_order_max': 'hpx_order_expcube', 'action': 'action_expcube' }) link_gasmaps = create_sg_sum_ring_gasmaps( linkname="%s.gasmaps" % linkname, mapping={'action': 'action_gasmaps'}) link_srcmaps_diffuse = create_sg_srcmap_partial( linkname="%s.srcmaps_diffuse" % linkname, mapping={'action': 'action_srcmaps_diffuse'}) link_vstack_srcmaps = create_sg_vstack_diffuse( linkname="%s.vstack" % linkname, mapping={'action': 'action_vstack'}) link_srcmaps_catalogs = create_sg_gtsrcmaps_catalog( linkname="%s.catalog_diffuse" % linkname, mapping={'action': 'action_srcmaps_catalog'}) link_srcmaps_composite = create_sg_merge_srcmaps( linkname="%s.composite" % linkname, mapping={'action': 'action_composite'}) link_assemble_model = create_sg_assemble_model(linkname="%s.assemble" % linkname, mapping={ 'hpx_order': 'hpx_order_fitting', 'action': 'action_assemble' }) parser = argparse.ArgumentParser( usage='fermipy-diffuse-analysis', description="Run diffuse analysis setup") Chain.__init__(self, linkname, appname='fermipy-diffuse-analysis', links=[ link_split_and_bin, link_expcube, link_gasmaps, link_srcmaps_diffuse, link_vstack_srcmaps, link_srcmaps_catalogs, link_srcmaps_composite, link_assemble_model ], options=DiffuseAnalysisChain.default_options.copy(), argmapper=self._map_arguments, parser=parser, **kwargs)
def __init__(self, linkname): """C'tor """ link_gtexphpsun = create_sg_Gtexphpsun(linkname="%s.gtexphpsun"%linkname, mapping={'data':'dataset_yaml', 'comp':'binning_yaml'}) link_gtsuntemp = create_sg_Gtsuntemp(linkname="%s.gtsuntemp"%linkname, mapping={'data':'dataset_yaml', 'comp':'binning_yaml'}) options = diffuse_defaults.sun_moon.copy() options['dry_run'] = (False, 'Print commands but do not run', bool) Chain.__init__(self, linkname, appname='FIXME', links=[link_gtexphpsun, link_gtsuntemp], options=options, parser=SunMoonChain._make_parser())
def __init__(self, linkname, comp_dict=None): """C'tor """ self.comp_dict = comp_dict Chain.__init__(self, linkname, links=[], options=dict(comp=diffuse_defaults.diffuse['binning_yaml'], data=diffuse_defaults.diffuse['dataset_yaml'], coordsys=diffuse_defaults.diffuse['coordsys'], nfiles=(96, 'Number of input files', int), dry_run=(False, 'Print commands but do not run them', bool)), appname='fermipy-coadd-split', argmapper=self._map_arguments, parser=CoaddSplit._make_parser()) if comp_dict is not None: self.update_links(comp_dict)
def __init__(self, linkname): """C'tor """ from fermipy.diffuse.job_library import create_sg_gtsrcmaps_catalog from fermipy.diffuse.gt_merge_srcmaps import create_sg_merge_srcmaps link_srcmaps_catalogs = create_sg_gtsrcmaps_catalog(linkname="%s.catalog"%linkname, appname='fermipy-srcmaps-catalog-sg') link_srcmaps_composite = create_sg_merge_srcmaps(linkname="%s.composite"%linkname, appname='fermipy-merge-srcmaps-sg') Chain.__init__(self, linkname, appname='FIXME', links=[link_srcmaps_catalogs, link_srcmaps_composite], options=CatalogComponentChain.default_options.copy(), parser=CatalogComponentChain._make_parser())
def __init__(self, linkname): """C'tor """ from fermipy.diffuse.job_library import create_sg_sum_ring_gasmaps, create_sg_vstack_diffuse from fermipy.diffuse.gt_srcmap_partial import create_sg_srcmap_partial link_gasmaps = create_sg_sum_ring_gasmaps(linkname="%s.merge_galprop"%linkname) link_srcmaps = create_sg_srcmap_partial(linkname="%s.srcmaps"%linkname) link_vstack_srcmaps = create_sg_vstack_diffuse(linkname="%s.vstack"%linkname) Chain.__init__(self, linkname, appname='fermipy-diffuse-chain', # links=[link_gasmaps, link_srcmaps, # link_vstack_srcmaps], links=[link_srcmaps,link_vstack_srcmaps], options=DiffuseComponentChain.default_options.copy(), parser=DiffuseComponentChain._make_parser())
def __init__(self, linkname): """C'tor """ from fermipy.diffuse.job_library import create_sg_gtsrcmaps_catalog from fermipy.diffuse.gt_merge_srcmaps import create_sg_merge_srcmaps link_srcmaps_catalogs = create_sg_gtsrcmaps_catalog(linkname="%s.catalog"%linkname, appname='fermipy-srcmaps-catalog-sg') link_srcmaps_composite = create_sg_merge_srcmaps(linkname="%s.composite"%linkname, appname='fermipy-merge-srcmaps-sg') parser = argparse.ArgumentParser(usage='fermipy-catalog-chain', description="Run catalog component analysis setup") Chain.__init__(self, linkname, appname='fermipy-catalog-chain', links=[link_srcmaps_catalogs, link_srcmaps_composite], options=CatalogComponentChain.default_options.copy(), parser=parser)
def __init__(self, linkname, **kwargs): """C'tor """ job_archive = kwargs.get('job_archive', None) link_spec_table = create_link_spec_table_builder( linkname="%s.spec-table" % linkname, mapping={ 'outfile': 'spec_table', 'config': 'baseconfig' }, job_archive=job_archive) link_prepare_targets = create_link_prepare_targets( linkname="%s.prepare-targets" % linkname, job_archive=job_archive) sg_roi_analysis = create_sg_roi_analysis( linkname="%s.roi-analysis" % linkname, mapping={'action': 'action_roi'}, job_archive=job_archive) sg_sed_analysis = create_sg_sed_analysis( linkname="%s.sed-analysis" % linkname, mapping={'action': 'action_sed'}, job_archive=job_archive) sg_castro_conv = create_sg_castro_convertor( linkname="%s.dm-castro" % linkname, mapping={'action': 'action_castro'}, job_archive=job_archive) link_stack_likelihood = create_link_stack_likelihood( linkname="%s.stack-likelihood" % linkname, job_archive=job_archive) parser = argparse.ArgumentParser( usage='dmpipe-dsph-chain', description="Run dSphs analysis chain") Chain.__init__(self, linkname, links=[ link_spec_table, link_prepare_targets, sg_roi_analysis, sg_sed_analysis, sg_castro_conv, link_stack_likelihood ], appname='dmpipe-dsph-chain', options=Pipeline_dsph.default_options.copy(), argmapper=self._map_arguments, parser=parser, **kwargs)
def __init__(self, linkname, comp_dict=None): """C'tor """ self.comp_dict = comp_dict Chain.__init__(self, linkname, appname='fermipy-split-and-bin', links=[], options=dict(comp=diffuse_defaults.diffuse['binning_yaml'], coordsys=diffuse_defaults.diffuse['coordsys'], hpx_order_max=diffuse_defaults.diffuse['hpx_order_ccube'], ft1file=(None, 'Input FT1 file', str), evclass=(128, 'Event class bit mask', int), output=(None, 'Base name for output files', str), pfiles=(None, 'Directory for .par files', str), scratch=(None, 'Scratch area', str), dry_run=(False, 'Print commands but do not run them', bool)), argmapper=self._map_arguments, parser=SplitAndBin._make_parser()) if comp_dict is not None: self.update_links(comp_dict)
def __init__(self, linkname): """C'tor """ link_sb_clean = create_sg_split_and_bin(linkname="%s.sb_clean"%linkname, mapping={'data':'dataset_clean_yaml', 'hpx_order':'hpx_order_binning', 'inputlist':'ft1file', 'comp':'binning_yaml'}) link_sb_dirty = create_sg_split_and_bin(linkname="%s.sb_dirty"%linkname, mapping={'data':'dataset_dirty_yaml', 'hpx_order':'hpx_order_binning', 'inputlist':'ft1file', 'comp':'binning_yaml'}) link_excube_clean = create_sg_gtexpcube2(linkname="%s.expcube_clean"%linkname, mapping={'cmap':'ccube_clean', 'outfile':'bexpcube_clean', 'data':'dataset_clean_yaml', 'hpx_order':'hpx_order_binning', 'comp':'binning_yaml'}) link_excube_dirty = create_sg_gtexpcube2(linkname="%s.expcube_dirty"%linkname, mapping={'cmap':'ccube_dirty', 'outfile':'bexpcube_dirty', 'data':'dataset_dirty_yaml', 'hpx_order':'hpx_order_binning', 'comp':'binning_yaml'}) link_cr_analysis = create_sg_residual_cr(linkname="%s.cr_analysis"%linkname, mapping={'data_dirty':'dataset_dirty_yaml', 'data_clean':'dataset_clean_yaml', 'hpx_order':'hpx_order_fitting', 'comp':'binning_yaml'}) options = diffuse_defaults.residual_cr.copy() options['dry_run'] = (False, 'Print commands but do not run', bool) Chain.__init__(self, linkname, appname='FIXME', links=[link_sb_clean, link_sb_dirty, link_excube_clean, link_excube_dirty, link_cr_analysis], options=options, argmapper=self._map_arguments, parser=ResidualCRChain._make_parser())
def __init__(self, linkname, **kwargs): """C'tor """ comp_file = kwargs.get('comp', None) if comp_file: self.comp_dict = yaml.safe_load(open(comp_file)) else: self.comp_dict = None job_archive = kwargs.get('job_archive', None) parser = argparse.ArgumentParser(usage="fermipy-coadd-split [options]", description="Merge a set of counts cube files") Chain.__init__(self, linkname, links=[], options=CoaddSplit.default_options.copy(), appname='fermipy-coadd-split', argmapper=self._map_arguments, parser=parser, **kwargs) if self.comp_dict is not None: self.update_links(self.comp_dict) self.set_links_job_archive()
def __init__(self, linkname, comp_dict=None, **kwargs): """C'tor """ self.comp_dict = comp_dict parser = argparse.ArgumentParser(usage='fermipy-split-and-bin [options]', description='Run gtselect and gtbin together') Chain.__init__(self, linkname, appname='fermipy-split-and-bin', links=[], options=dict(data=diffuse_defaults.diffuse['data'], comp=diffuse_defaults.diffuse['comp'], hpx_order_max=diffuse_defaults.diffuse['hpx_order_ccube'], ft1file=(None, 'Input FT1 file', str), evclass=(128, 'Event class bit mask', int), outdir=('counts_cubes_cr', 'Base name for output files', str), outkey=(None, 'Key for this particular output file', str), pfiles=(None, 'Directory for .par files', str), scratch=(None, 'Scratch area', str), dry_run=(False, 'Print commands but do not run them', bool)), argmapper=self._map_arguments, parser=parser) if comp_dict is not None: self.update_links(comp_dict)
def test_chain(): kwargs = dict(appname='dummy', options=dict(arg_float=(4.0, 'a float', float), arg_in=('test.in', 'an input file', str), arg_out=('test.out', 'an output file', str)), mapping=dict(arg_in='alias'), file_args=dict(arg_in=FileFlags.input_mask, arg_out=FileFlags.output_mask)) link = Link('link', **kwargs) kwargs = dict(options=dict(irfs=('CALDB', 'IRF version', str), expcube=(None, 'Livetime cube file', str), bexpmap=(None, 'Binned exposure map', str), cmap=(None, 'Binned counts map', str), srcmdl=(None, 'Input source model xml file', str), outfile=(None, 'Output file', str)), file_args=dict(expcube=FileFlags.input_mask, cmap=FileFlags.input_mask, bexpmap=FileFlags.input_mask, srcmdl=FileFlags.input_mask, outfile=FileFlags.output_mask)) # This should be a Gtlink, but we only really wanna test the chain functionality here link2 = Link('gtsrcmaps', **kwargs) def argmapper(args): basename = args['basename'] ret_dict = dict(expcube="%s_ltcube.fits"%basename, cmap="%s_ccube.fits"%basename, bexpmap="%s_bexpmap.fits"%basename, srcmdl="%s_srcmdl.xml"%basename) return ret_dict chain = Chain('chain', links=[link, link2], options=dict(basename=('dummy', 'Base file name', str)), argmapper=argmapper)