本文整理匯總了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)