def _clone_config_and_srcmaps(config_path, seed):
        """Clone the configuration"""
        workdir = os.path.dirname(config_path)
        new_config_path = config_path.replace('.yaml', '_%06i.yaml' % seed)
        config = load_yaml(config_path)
        comps = config.get('components', [config])
        for i, comp in enumerate(comps):
            comp_name = "%02i" % i
            if 'gtlike' not in comp:
                comp['gtlike'] = {}
            orig_srcmap = os.path.abspath(os.path.join(workdir, 'srcmap_%s.fits' % (comp_name)))
            new_srcmap = os.path.abspath(os.path.join(workdir, 'srcmap_%06i_%s.fits' % (seed, comp_name)))
            comp['gtlike']['srcmap'] = os.path.abspath(os.path.join(workdir, 'srcmap_%06i_%s.fits' % (seed, comp_name)))
            comp['gtlike']['use_external_srcmap'] = True
            copyfile(orig_srcmap, new_srcmap)

        write_yaml(config, new_config_path)
        return new_config_path
def _clone_config_and_srcmaps ( config_path , seed ) : workdir = os . path . dirname ( config_path ) new_config_path = config_path . replace ( '.yaml' , '_%06i.yaml' % seed ) config = load_yaml ( config_path ) comps = config . get ( 'components' , [ config ] ) for i , comp in enumerate ( comps ) : comp_name = "%02i" % i if 'gtlike' not in comp : comp [ 'gtlike' ] = { } orig_srcmap = os . path . abspath ( os . path . join ( workdir , 'srcmap_%s.fits' % ( comp_name ) ) ) new_srcmap = os . path . abspath ( os . path . join ( workdir , 'srcmap_%06i_%s.fits' % ( seed , comp_name ) ) ) comp [ 'gtlike' ] [ 'srcmap' ] = os . path . abspath ( os . path . join ( workdir , 'srcmap_%06i_%s.fits' % ( seed , comp_name ) ) ) comp [ 'gtlike' ] [ 'use_external_srcmap' ] = True copyfile ( orig_srcmap , new_srcmap ) write_yaml ( config , new_config_path ) return new_config_path
Clone the configuration