当前位置: 首页>>代码示例>>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;未经允许,请勿转载。