當前位置: 首頁>>代碼示例>>Python>>正文


Python Catalog.get方法代碼示例

本文整理匯總了Python中catalog.Catalog.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Catalog.get方法的具體用法?Python Catalog.get怎麽用?Python Catalog.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在catalog.Catalog的用法示例。


在下文中一共展示了Catalog.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getExpByName

# 需要導入模塊: from catalog import Catalog [as 別名]
# 或者: from catalog.Catalog import get [as 別名]
    def getExpByName(self,src_names,egy_axis,cth_axis=None,weights=None):

        exph = None
        cat = Catalog.get()
        for s in src_names:

            if s == 'ridge':
                
                glon = np.linspace(0,360.,30.)
                glat = np.zeros(30)
                ra,dec = eq2gal(glon,glat)

                for i in range(30):
#                    print i, ra[i], dec[i]
                    h = self.eval2(ra[i],dec[i],egy_axis,
                                   cth_axis,wfn=weights)
       
                    if exph is None: exph = h
                    else: exph += h
            else:
                src = cat.get_source_by_name(s) 
                h = self.eval2(src['RAJ2000'], src['DEJ2000'],egy_axis,
                               cth_axis,wfn=weights)
       
                if exph is None: exph = h
                else: exph += h

        exph /= float(len(src_names))        
        return exph
開發者ID:woodmd,項目名稱:gammatools,代碼行數:31,代碼來源:exposure.py

示例2: getExpByName

# 需要導入模塊: from catalog import Catalog [as 別名]
# 或者: from catalog.Catalog import get [as 別名]
    def getExpByName(self,src_names,egy_axis,cth_axis=None):

        exph = None
        cat = Catalog.get()
        for s in src_names:
            src = cat.get_source_by_name(s) 
            h = self.eval(src['RAJ2000'], src['DEJ2000'],egy_axis,
                          cth_axis)
       
            if exph is None: exph = h
            else: exph += h

        exph /= float(len(src_names))        
        return exph
開發者ID:lcreyes,項目名稱:gammatools,代碼行數:16,代碼來源:exposure.py

示例3: setup_roi

# 需要導入模塊: from catalog import Catalog [as 別名]
# 或者: from catalog.Catalog import get [as 別名]
    def setup_roi(self,**kwargs):

        target_name = self.config['target']
        
        cat = Catalog.get('2fgl')
        self.src = CatalogSource(cat.get_source_by_name(target_name))

        
        if self.config['savedir'] is None:
            self.set_config('savedir',target_name)

        if not os.path.exists(self.config['savedir']):
            os.makedirs(self.config['savedir'])
        
        config = self.config

        self.savestate = os.path.join(config['savedir'],
                                    "%s_savestate.P"%target_name)
        
        self.ft1file = os.path.join(config['savedir'],
                                    "%s_ft1.fits"%target_name)

        
            
        self.binfile = os.path.join(config['savedir'],
                                    "%s_binfile.fits"%target_name)
        self.srcmdl = os.path.join(config['savedir'],
                                   "%s_srcmdl.xml"%target_name)
        
        self.srcmdl_fit = os.path.join(config['savedir'],
                                       "%s_srcmdl_fit.xml"%target_name)
        

        if os.path.isfile(config['ltcube']) and \
                re.search('\.fits?',config['ltcube']):
            self.ltcube = config['ltcube']
        else:
            ltcube = sorted(glob.glob(config['ltcube']))

            
            self.ltcube = os.path.join(config['savedir'],
                                       "%s_ltcube.fits"%target_name)

            lt_task = LTSumTask(self.ltcube,infile1=ltcube,
                                config=config)

            lt_task.run()

        
        self.evfile = config['evfile']#sorted(glob.glob(config['evfile']))
#        if len(self.evfile) > 1:
#            evfile_list = os.path.join(self.config('savedir'),'evfile.txt')
#            np.savetxt(evfile_list,self.evfile,fmt='%s')
#            self.evfile = os.path.abspath(evfile_list)
#        else:
#            self.evfile = self.evfile[0]
            
#        if len(self.ltfile) > 1:
#            ltfile_list = os.path.join(self.config('savedir'),'ltfile.txt')
#            np.savetxt(ltfile_list,self.ltfile,fmt='%s')
#            self.ltfile = os.path.abspath(ltfile_list)
#        else:
#            self.ltfile = self.ltfile[0]
            
#        print self.evfile
#        print self.ltfile
        
        self.skydir = SkyDir(self.src.ra,self.src.dec)

        sel_task = SelectorTask(self.evfile,self.ft1file,
                                ra=self.src.ra,dec=self.src.dec,
                                config=config['select'],overwrite=False)
        sel_task.run()

        cat.create_roi(self.src.ra,self.src.dec,
                       config['isodiff'],
                       config['galdiff'],                       
                       self.srcmdl,radius=5.0)
        
#        self.setup_pointlike()

        self.components = []
                
        for i, t in enumerate(self.config['joint']):

            print 'Setting up binned analysis ', i

#            kw = dict(irfs=None,isodiff=None)
#            kw.update(t)
            
            analysis = BinnedGtlike(self.src,
                                    target_name + '_%02i'%(i),
                                    config,
                                    evfile=self.ft1file,
                                    srcmdl=self.srcmdl,
                                    gtselect=dict(evclass=t['evclass'],
                                                  evtype=t['evtype']),
#                                    convtype=t['convtype'],
                                    irfs=t['irfs'],
                                    isodiff=t['isodiff'])
#.........這裏部分代碼省略.........
開發者ID:lcreyes,項目名稱:gammatools,代碼行數:103,代碼來源:fermi_analysis.py


注:本文中的catalog.Catalog.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。