当前位置: 首页>>代码示例>>Python>>正文


Python mlab.apply_window方法代码示例

本文整理汇总了Python中matplotlib.mlab.apply_window方法的典型用法代码示例。如果您正苦于以下问题:Python mlab.apply_window方法的具体用法?Python mlab.apply_window怎么用?Python mlab.apply_window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.mlab的用法示例。


在下文中一共展示了mlab.apply_window方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_apply_window_hanning_2D_stack_windows_axis1_unflatten

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [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

示例2: test_apply_window_1D_axis1_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_1D_axis1_ValueError(self):
        x = self.sig_rand
        window = mlab.window_hanning
        assert_raises(ValueError, mlab.apply_window, x, window, axis=1,
                      return_window=False) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:7,代码来源:test_mlab.py

示例3: test_apply_window_1D_els_wrongsize_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_1D_els_wrongsize_ValueError(self):
        x = self.sig_rand
        window = mlab.window_hanning(np.ones(x.shape[0]-1))
        assert_raises(ValueError, mlab.apply_window, x, window) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:6,代码来源:test_mlab.py

示例4: test_apply_window_0D_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_0D_ValueError(self):
        x = np.array(0)
        window = mlab.window_hanning
        assert_raises(ValueError, mlab.apply_window, x, window, axis=1,
                      return_window=False) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:7,代码来源:test_mlab.py

示例5: test_apply_window_3D_ValueError

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_3D_ValueError(self):
        x = self.sig_rand[np.newaxis][np.newaxis]
        window = mlab.window_hanning
        assert_raises(ValueError, mlab.apply_window, x, window, axis=1,
                      return_window=False) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:7,代码来源:test_mlab.py

示例6: test_apply_window_hanning_1D

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_1D(self):
        x = self.sig_rand
        window = mlab.window_hanning
        window1 = mlab.window_hanning(np.ones(x.shape[0]))
        y, window2 = mlab.apply_window(x, window, return_window=True)
        yt = window(x)
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06)
        assert_array_equal(window1, window2) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:12,代码来源:test_mlab.py

示例7: test_apply_window_hanning_els_1D_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_els_1D_axis0(self):
        x = self.sig_rand
        window = mlab.window_hanning(np.ones(x.shape[0]))
        window1 = mlab.window_hanning
        y = mlab.apply_window(x, window, axis=0, return_window=False)
        yt = window1(x)
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:11,代码来源:test_mlab.py

示例8: test_apply_window_hanning_2D_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_2D_axis0(self):
        x = np.random.standard_normal([1000, 10]) + 100.
        window = mlab.window_hanning
        y = mlab.apply_window(x, window, axis=0, return_window=False)
        yt = np.zeros_like(x)
        for i in range(x.shape[1]):
            yt[:, i] = window(x[:, i])
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:12,代码来源:test_mlab.py

示例9: test_apply_window_hanning_els1_2D_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_els1_2D_axis0(self):
        x = np.random.standard_normal([1000, 10]) + 100.
        window = mlab.window_hanning(np.ones(x.shape[0]))
        window1 = mlab.window_hanning
        y = mlab.apply_window(x, window, axis=0, return_window=False)
        yt = np.zeros_like(x)
        for i in range(x.shape[1]):
            yt[:, i] = window1(x[:, i])
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:13,代码来源:test_mlab.py

示例10: test_apply_window_hanning_els2_2D_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_els2_2D_axis0(self):
        x = np.random.standard_normal([1000, 10]) + 100.
        window = mlab.window_hanning
        window1 = mlab.window_hanning(np.ones(x.shape[0]))
        y, window2 = mlab.apply_window(x, window, axis=0, return_window=True)
        yt = np.zeros_like(x)
        for i in range(x.shape[1]):
            yt[:, i] = window1*x[:, i]
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06)
        assert_array_equal(window1, window2) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:14,代码来源:test_mlab.py

示例11: test_apply_window_hanning_els3_2D_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_els3_2D_axis0(self):
        x = np.random.standard_normal([1000, 10]) + 100.
        window = mlab.window_hanning
        window1 = mlab.window_hanning(np.ones(x.shape[0]))
        y, window2 = mlab.apply_window(x, window, axis=0, return_window=True)
        yt = mlab.apply_window(x, window1, axis=0, return_window=False)
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06)
        assert_array_equal(window1, window2) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:12,代码来源:test_mlab.py

示例12: test_apply_window_hanning_2D__els1_axis1

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_2D__els1_axis1(self):
        x = np.random.standard_normal([10, 1000]) + 100.
        window = mlab.window_hanning(np.ones(x.shape[1]))
        window1 = mlab.window_hanning
        y = mlab.apply_window(x, window, axis=1, return_window=False)
        yt = np.zeros_like(x)
        for i in range(x.shape[0]):
            yt[i, :] = window1(x[i, :])
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:13,代码来源:test_mlab.py

示例13: test_apply_window_hanning_2D_els2_axis1

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_2D_els2_axis1(self):
        x = np.random.standard_normal([10, 1000]) + 100.
        window = mlab.window_hanning
        window1 = mlab.window_hanning(np.ones(x.shape[1]))
        y, window2 = mlab.apply_window(x, window, axis=1, return_window=True)
        yt = np.zeros_like(x)
        for i in range(x.shape[0]):
            yt[i, :] = window1 * x[i, :]
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06)
        assert_array_equal(window1, window2) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:14,代码来源:test_mlab.py

示例14: test_apply_window_hanning_2D_els3_axis1

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_hanning_2D_els3_axis1(self):
        x = np.random.standard_normal([10, 1000]) + 100.
        window = mlab.window_hanning
        window1 = mlab.window_hanning(np.ones(x.shape[1]))
        y = mlab.apply_window(x, window, axis=1, return_window=False)
        yt = mlab.apply_window(x, window1, axis=1, return_window=False)
        assert_equal(yt.shape, y.shape)
        assert_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:11,代码来源:test_mlab.py

示例15: test_apply_window_stride_windows_hanning_2D_n13_noverlapn3_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import apply_window [as 别名]
def test_apply_window_stride_windows_hanning_2D_n13_noverlapn3_axis0(self):
        x = self.sig_rand
        window = mlab.window_hanning
        yi = mlab.stride_windows(x, n=13, noverlap=2, axis=0)
        y = mlab.apply_window(yi, window, axis=0, return_window=False)
        yt = self.check_window_apply_repeat(x, window, 13, 2)
        assert_equal(yt.shape, y.shape)
        assert_not_equal(x.shape, y.shape)
        assert_allclose(yt, y, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:11,代码来源:test_mlab.py


注:本文中的matplotlib.mlab.apply_window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。