本文整理汇总了Python中Analyzer.Analyzer.window_signal方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.window_signal方法的具体用法?Python Analyzer.window_signal怎么用?Python Analyzer.window_signal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.window_signal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_window_signal
# 需要导入模块: from Analyzer import Analyzer [as 别名]
# 或者: from Analyzer.Analyzer import window_signal [as 别名]
def test_window_signal(self):
"""
Tests functionality of window signal method.
"""
test_signal_one = np.arange(0, 11)
test_signal_two = np.arange(1, 11)
test_one = Analyzer(np.copy(test_signal_one), 1, 1)
test_two = Analyzer(np.copy(test_signal_two), 1, 1)
test_three = Analyzer(np.copy(test_signal_one), 2, 1)
windows_one = test_one.window_signal()
windows_two = test_two.window_signal()
windows_three = test_three.window_signal()
arr = np.asarray([0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10])
expected_one = np.reshape(arr, (5, 3))
arr2 = np.asarray([1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 0])
expected_two = np.reshape(arr2, (5, 3))
arr3 = np.asarray([0, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 0, 0, 0])
expected_three = np.reshape(arr3, (3, 6))
assert_array_almost_equal(expected_one, windows_one)
assert_array_almost_equal(expected_two, windows_two)
assert_array_almost_equal(expected_three, windows_three)