本文整理汇总了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
示例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
示例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'])
#.........这里部分代码省略.........