本文整理汇总了Python中pycbc.types.TimeSeries.time_slice方法的典型用法代码示例。如果您正苦于以下问题:Python TimeSeries.time_slice方法的具体用法?Python TimeSeries.time_slice怎么用?Python TimeSeries.time_slice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycbc.types.TimeSeries
的用法示例。
在下文中一共展示了TimeSeries.time_slice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: normal
# 需要导入模块: from pycbc.types import TimeSeries [as 别名]
# 或者: from pycbc.types.TimeSeries import time_slice [as 别名]
def normal(start, end, seed=0):
""" Generate data with a white Gaussian (normal) distribution
Parameters
----------
start_time : int
Start time in GPS seconds to generate noise
end_time : int
End time in GPS seconds to generate nosie
seed : {None, int}
The seed to generate the noise.
Returns
--------
noise : TimeSeries
A TimeSeries containing gaussian noise
"""
# This is reproduceable because we used fixed seeds from known values
s = int(start / BLOCK_SIZE)
e = int(end / BLOCK_SIZE)
# The data evenly divides so the last block would be superfluous
if end % BLOCK_SIZE == 0:
e -= 1
sv = RandomState(seed).randint(-2**50, 2**50)
data = numpy.concatenate([block(i + sv) for i in numpy.arange(s, e + 1, 1)])
ts = TimeSeries(data, delta_t=1.0 / SAMPLE_RATE, epoch=start)
return ts.time_slice(start, end)