本文整理汇总了Python中glue.lal.Cache.from_urls方法的典型用法代码示例。如果您正苦于以下问题:Python Cache.from_urls方法的具体用法?Python Cache.from_urls怎么用?Python Cache.from_urls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glue.lal.Cache
的用法示例。
在下文中一共展示了Cache.from_urls方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _query
# 需要导入模块: from glue.lal import Cache [as 别名]
# 或者: from glue.lal.Cache import from_urls [as 别名]
def _query(self, channel, start, end):
"Do we know where the frame file is?"
if segment(start, end) in self._remotecoverage:
return True
urls = query_LDR(self.host, self.port, channel[0], self.frametype, start, end, urlType="file")
if urls:
new = Cache.from_urls(urls, coltype=int)
new.sort(key=operator.attrgetter("segment"))
self.add_cache(new)
return segment(start, end) in self._remotecoverage
示例2: _losc_json_cache
# 需要导入模块: from glue.lal import Cache [as 别名]
# 或者: from glue.lal.Cache import from_urls [as 别名]
def _losc_json_cache(metadata, detector, sample_rate=4096,
format='hdf5', duration=4096):
"""Parse a :class:`~glue.lal.Cache` from a LOSC metadata packet
"""
urls = []
for fmd in metadata: # loop over file metadata dicts
# skip over files we don't want
if (fmd['detector'] != detector or
fmd['sampling_rate'] != sample_rate or
fmd['format'] != format or
fmd['duration'] != duration):
continue
urls.append(fmd['url'])
return Cache.from_urls(urls)
示例3: test_aux_channels_from_cache
# 需要导入模块: from glue.lal import Cache [as 别名]
# 或者: from glue.lal.Cache import from_urls [as 别名]
def test_aux_channels_from_cache(self):
cache = Cache.from_urls(AUX_FILES.values())
channels = triggers.find_auxiliary_channels('omicron', None, None,
cache=cache)
self.assertListEqual(channels, sorted(AUX_FILES.keys()))