def __init__(self, channel, timeseries=None, stats=None, n=None):
"""If timeseries is None, then we are manually initializing with custom
stat values. Otherwise, calculate stat values from the timeseries.
Input is assumed to be a GWpy timeseries."""
self.channel = channel
if timeseries is None:
self.n = n
self.stats = stats
else:
self.n = 1
# wrap the end of the second onto the start of that same second.
# obviously this is only okay with quasi periodic signals!
zero_crossing = np.concatenate((timeseries.value[DUOTONE_START:],
timeseries.value[:DUOTONE_END]))
self.stats = {
"sum": zero_crossing,
"sum_sq": np.square(zero_crossing),
"mean": zero_crossing,
"sigma": zero_crossing * 0., # i.e. zeros
"max": zero_crossing,
"min": zero_crossing
}
评论列表
文章目录