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


Python mlab.window_hanning方法代码示例

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


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

示例1: test_apply_window_hanning_2D_stack_windows_axis1_unflatten

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

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import window_hanning [as 别名]
def test_psd_windowarray_equal(self):
        freqs = self.freqs_density
        win = mlab.window_hanning(np.ones(self.NFFT_density_real))
        speca, fspa = mlab.psd(x=self.y,
                               NFFT=self.NFFT_density,
                               Fs=self.Fs,
                               noverlap=self.nover_density,
                               pad_to=self.pad_to_density,
                               sides=self.sides,
                               window=win)
        specb, fspb = mlab.psd(x=self.y,
                               NFFT=self.NFFT_density,
                               Fs=self.Fs,
                               noverlap=self.nover_density,
                               pad_to=self.pad_to_density,
                               sides=self.sides)
        assert_array_equal(fspa, fspb)
        assert_allclose(speca, specb, atol=1e-08)


# extra test for cohere... 
开发者ID:holzschu,项目名称:python3_ios,代码行数:23,代码来源:test_mlab.py

示例3: test_window_hanning_rand

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import window_hanning [as 别名]
def test_window_hanning_rand(self):
        targ = np.hanning(len(self.sig_rand)) * self.sig_rand
        res = mlab.window_hanning(self.sig_rand)

        assert_allclose(targ, res, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:7,代码来源:test_mlab.py

示例4: test_window_hanning_ones

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import window_hanning [as 别名]
def test_window_hanning_ones(self):
        targ = np.hanning(len(self.sig_ones))
        res = mlab.window_hanning(self.sig_ones)

        assert_allclose(targ, res, atol=1e-06) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:7,代码来源:test_mlab.py

示例5: test_apply_window_1D_axis1_ValueError

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

示例6: test_apply_window_1D_els_wrongsize_ValueError

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

示例7: test_apply_window_0D_ValueError

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

示例8: test_apply_window_hanning_1D

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

示例9: test_apply_window_hanning_1D_axis0

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import window_hanning [as 别名]
def test_apply_window_hanning_1D_axis0(self):
        x = self.sig_rand
        window = mlab.window_hanning
        y = mlab.apply_window(x, window, axis=0, return_window=False)
        yt = window(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,代码行数:10,代码来源:test_mlab.py

示例10: test_apply_window_hanning_els_1D_axis0

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

示例11: test_apply_window_hanning_2D_axis0

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

示例12: test_apply_window_hanning_els1_2D_axis0

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

示例13: test_apply_window_hanning_els3_2D_axis0

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

示例14: test_apply_window_hanning_2D_axis1

# 需要导入模块: from matplotlib import mlab [as 别名]
# 或者: from matplotlib.mlab import window_hanning [as 别名]
def test_apply_window_hanning_2D_axis1(self):
        x = np.random.standard_normal([10, 1000]) + 100.
        window = 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, :] = 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

示例15: test_apply_window_hanning_2D__els1_axis1

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


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