本文整理汇总了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)
示例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...
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)