当前位置: 首页>>代码示例>>Python>>正文


Python TimeSeries.abs_max_loc方法代码示例

本文整理汇总了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)
开发者ID:AbhayMK,项目名称:pycbc,代码行数:17,代码来源:test_injection.py

示例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)
开发者ID:AbhayMK,项目名称:pycbc,代码行数:18,代码来源:test_injection.py


注:本文中的pycbc.types.TimeSeries.abs_max_loc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。