本文整理汇总了Python中obspy.signal.spectral_estimation.PPSD.ppsd_length方法的典型用法代码示例。如果您正苦于以下问题:Python PPSD.ppsd_length方法的具体用法?Python PPSD.ppsd_length怎么用?Python PPSD.ppsd_length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.signal.spectral_estimation.PPSD
的用法示例。
在下文中一共展示了PPSD.ppsd_length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ppsd_time_checks
# 需要导入模块: from obspy.signal.spectral_estimation import PPSD [as 别名]
# 或者: from obspy.signal.spectral_estimation.PPSD import ppsd_length [as 别名]
def test_ppsd_time_checks(self):
"""
Some tests that make sure checking if a new PSD slice to be addded to
existing PPSD has an invalid overlap or not works as expected.
"""
ppsd = PPSD(Stats(), Response())
one_second = 1000000000
t0 = 946684800000000000 # 2000-01-01T00:00:00
time_diffs = [
0, one_second, one_second * 2, one_second * 3,
one_second * 8, one_second * 9, one_second * 10]
ppsd._times_processed = [t0 + td for td in time_diffs]
ppsd.ppsd_length = 2
ppsd.overlap = 0.5
# valid time stamps to insert data for (i.e. data that overlaps with
# existing data at most "overlap" times "ppsd_length")
ns_ok = [
t0 - 3 * one_second,
t0 - 1.01 * one_second,
t0 - one_second,
t0 + 4 * one_second,
t0 + 4.01 * one_second,
t0 + 6 * one_second,
t0 + 7 * one_second,
t0 + 6.99 * one_second,
t0 + 11 * one_second,
t0 + 11.01 * one_second,
t0 + 15 * one_second,
]
for ns in ns_ok:
t = UTCDateTime(ns=int(ns))
# getting False means time is not present yet and a PSD slice would
# be added to the PPSD data
self.assertFalse(ppsd._PPSD__check_time_present(t))
# invalid time stamps to insert data for (i.e. data that overlaps with
# existing data more than "overlap" times "ppsd_length")
ns_bad = [
t0 - 0.99 * one_second,
t0 - 0.5 * one_second,
t0,
t0 + 1.1 * one_second,
t0 + 3.99 * one_second,
t0 + 7.01 * one_second,
t0 + 7.5 * one_second,
t0 + 8 * one_second,
t0 + 8.8 * one_second,
t0 + 10 * one_second,
t0 + 10.99 * one_second,
]
for ns in ns_bad:
t = UTCDateTime(ns=int(ns))
# getting False means time is not present yet and a PSD slice would
# be added to the PPSD data
self.assertTrue(ppsd._PPSD__check_time_present(t))