本文整理汇总了Python中pycbc.types.TimeSeries.abs_max_loc方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.abs_max_loc方法的具体用法?Python TimeSeries.abs_max_loc怎么用?Python TimeSeries.abs_max_loc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycbc.types.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.abs_max_loc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_injection_presence
# 需要导入模块: from pycbc.types import TimeSeries [as 别名]
# 或者: from pycbc.types.TimeSeries import abs_max_loc [as 别名]
def test_injection_presence(self):
"""Verify presence of signals at expected times"""
injections = InjectionSet(self.inj_file.name)
for det in self.detectors:
for inj in self.injections:
ts = TimeSeries(numpy.zeros(10 * self.sample_rate),
delta_t=1/self.sample_rate,
epoch=lal.LIGOTimeGPS(inj.end_time - 5),
dtype=numpy.float64)
injections.apply(ts, det.name)
max_amp, max_loc = ts.abs_max_loc()
# FIXME could test amplitude and time more precisely
self.assertTrue(max_amp > 0 and max_amp < 1e-10)
time_error = ts.sample_times.numpy()[max_loc] - inj.end_time
self.assertTrue(abs(time_error) < 1.5 * self.earth_time)
示例2: test_injection_absence
# 需要导入模块: from pycbc.types import TimeSeries [as 别名]
# 或者: from pycbc.types.TimeSeries import abs_max_loc [as 别名]
def test_injection_absence(self):
"""Verify absence of signals outside known injection times"""
clear_times = [
self.injections[0].end_time - 86400,
self.injections[-1].end_time + 86400
]
injections = InjectionSet(self.inj_file.name)
for det in self.detectors:
for epoch in clear_times:
ts = TimeSeries(numpy.zeros(10 * self.sample_rate),
delta_t=1/self.sample_rate,
epoch=lal.LIGOTimeGPS(epoch),
dtype=numpy.float64)
injections.apply(ts, det.name)
max_amp, max_loc = ts.abs_max_loc()
self.assertEqual(max_amp, 0)