當前位置: 首頁>>代碼示例>>Python>>正文


Python mlab.stride_windows方法代碼示例

本文整理匯總了Python中matplotlib.mlab.stride_windows方法的典型用法代碼示例。如果您正苦於以下問題:Python mlab.stride_windows方法的具體用法?Python mlab.stride_windows怎麽用?Python mlab.stride_windows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在matplotlib.mlab的用法示例。


在下文中一共展示了mlab.stride_windows方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_stride_ensure_integer_type

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_ensure_integer_type(self):
        N = 100
        x = np.empty(N + 20, dtype='>f4')
        x.fill(np.NaN)
        y = x[10:-10]
        y.fill(0.3)
        # previous to #3845 lead to corrupt access
        y_strided = mlab.stride_windows(y, n=33, noverlap=0.6)
        assert_array_equal(y_strided, 0.3)
        # previous to #3845 lead to corrupt access
        y_strided = mlab.stride_windows(y, n=33.3, noverlap=0)
        assert_array_equal(y_strided, 0.3)
        # even previous to #3845 could not find any problematic
        # configuration however, let's be sure it's not accidentally
        # introduced
        y_strided = mlab.stride_repeat(y, n=33.815)
        assert_array_equal(y_strided, 0.3) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:19,代碼來源:test_mlab.py

示例2: test_apply_window_hanning_2D_stack_windows_axis1_unflatten

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_apply_window_hanning_2D_stack_windows_axis1_unflatten(self):
        n = 32
        ydata = np.arange(n)
        ydata1 = ydata+5
        ydata2 = ydata+3.3
        ycontrol1 = mlab.apply_window(ydata1, mlab.window_hanning)
        ycontrol2 = mlab.window_hanning(ydata2)
        ydata = np.vstack([ydata1, ydata2])
        ycontrol = np.vstack([ycontrol1, ycontrol2])
        ydata = np.tile(ydata, (20, 1))
        ycontrol = np.tile(ycontrol, (20, 1))
        ydata = ydata.flatten()
        ydata1 = mlab.stride_windows(ydata, 32, noverlap=0, axis=0)
        result = mlab.apply_window(ydata1, mlab.window_hanning, axis=0,
                                   return_window=False)
        assert_allclose(ycontrol.T, result, atol=1e-08) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:18,代碼來源:test_mlab.py

示例3: test_stride_windows_2D_ValueError

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_2D_ValueError(self):
        x = np.arange(10)[np.newaxis]
        assert_raises(ValueError, mlab.stride_windows, x, 5) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:5,代碼來源:test_mlab.py

示例4: test_stride_windows_0D_ValueError

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_0D_ValueError(self):
        x = np.array(0)
        assert_raises(ValueError, mlab.stride_windows, x, 5) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:5,代碼來源:test_mlab.py

示例5: test_stride_windows_noverlap_gt_n_ValueError

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_noverlap_gt_n_ValueError(self):
        x = np.arange(10)
        assert_raises(ValueError, mlab.stride_windows, x, 2, 3) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:5,代碼來源:test_mlab.py

示例6: test_stride_windows_noverlap_eq_n_ValueError

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_noverlap_eq_n_ValueError(self):
        x = np.arange(10)
        assert_raises(ValueError, mlab.stride_windows, x, 2, 2) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:5,代碼來源:test_mlab.py

示例7: test_stride_windows_n_gt_lenx_ValueError

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n_gt_lenx_ValueError(self):
        x = np.arange(10)
        assert_raises(ValueError, mlab.stride_windows, x, 11) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:5,代碼來源:test_mlab.py

示例8: test_stride_windows_n1_noverlap0_axis0

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n1_noverlap0_axis0(self):
        x = np.arange(10)
        y = mlab.stride_windows(x, 1)
        yt = self.calc_window_target(x, 1)
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal((1, ) + x.shape, y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例9: test_stride_windows_n1_noverlap0_axis1

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n1_noverlap0_axis1(self):
        x = np.arange(10)
        y = mlab.stride_windows(x, 1, axis=1)
        yt = self.calc_window_target(x, 1).T
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal(x.shape + (1, ), y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例10: test_stride_windows_n5_noverlap0_axis0

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n5_noverlap0_axis0(self):
        x = np.arange(100)
        y = mlab.stride_windows(x, 5)
        yt = self.calc_window_target(x, 5)
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal((5, 20), y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例11: test_stride_windows_n5_noverlap0_axis1

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n5_noverlap0_axis1(self):
        x = np.arange(100)
        y = mlab.stride_windows(x, 5, axis=1)
        yt = self.calc_window_target(x, 5).T
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal((20, 5), y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例12: test_stride_windows_n15_noverlap2_axis0

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n15_noverlap2_axis0(self):
        x = np.arange(100)
        y = mlab.stride_windows(x, 15, 2)
        yt = self.calc_window_target(x, 15, 2)
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal((15, 7), y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例13: test_stride_windows_n13_noverlapn3_axis0

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n13_noverlapn3_axis0(self):
        x = np.arange(100)
        y = mlab.stride_windows(x, 13, -3)
        yt = self.calc_window_target(x, 13, -3)
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal((13, 6), y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例14: test_stride_windows_n13_noverlapn3_axis1

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n13_noverlapn3_axis1(self):
        x = np.arange(100)
        y = mlab.stride_windows(x, 13, -3, axis=1)
        yt = self.calc_window_target(x, 13, -3).T
        assert_equal(yt.shape, y.shape)
        assert_array_equal(yt, y)
        assert_equal((6, 13), y.shape)
        assert_true(self.get_base(y) is x) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py

示例15: test_stride_windows_n32_noverlap0_axis0_unflatten

# 需要導入模塊: from matplotlib import mlab [as 別名]
# 或者: from matplotlib.mlab import stride_windows [as 別名]
def test_stride_windows_n32_noverlap0_axis0_unflatten(self):
        n = 32
        x = np.arange(n)[np.newaxis]
        x1 = np.tile(x, (21, 1))
        x2 = x1.flatten()
        y = mlab.stride_windows(x2, n)
        assert_equal(y.shape, x1.T.shape)
        assert_array_equal(y, x1.T) 
開發者ID:miloharper,項目名稱:neural-network-animation,代碼行數:10,代碼來源:test_mlab.py


注:本文中的matplotlib.mlab.stride_windows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。