def test_wpe_v6_vs_v7(self): desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='full') actual = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-10) desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='valid') actual = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='valid') tc.assert_allclose(actual, desired, atol=1e-10) desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='valid') actual = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='full') tc.assert_raises(AssertionError, tc.assert_array_equal, desired, actual)
def test_wpe_v8(self): desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='valid') actual = wpe.wpe_v8(self.Y, self.K, self.delay, statistics_mode='valid') tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='valid') actual = wpe.wpe_v8(self.Y, self.K, self.delay, statistics_mode='valid') tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='full') actual = wpe.wpe_v8(self.Y, self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='full') actual = wpe.wpe_v8(self.Y, self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-6)
def test_wpe_batched_multi_freq(self): def to_batched_multi_freq(x): return np.array([ [x, x * 2], [x * 3, x * 4], [x * 5, x * 6], ]) Y_batched_multi_freq = to_batched_multi_freq(self.Y) tc.assert_raises(NotImplementedError, wpe.wpe_v0, Y_batched_multi_freq, self.K, self.delay, statistics_mode='full') desired = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='full') desired = to_batched_multi_freq(desired) actual = wpe.wpe_v7(Y_batched_multi_freq, self.K, self.delay, statistics_mode='full') assert desired.shape == (3, 2, self.D, self.T) assert actual.shape == (3, 2, self.D, self.T) tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='full') desired = to_batched_multi_freq(desired) actual = wpe.wpe_v6(Y_batched_multi_freq, self.K, self.delay, statistics_mode='full') assert desired.shape == (3, 2, self.D, self.T) assert actual.shape == (3, 2, self.D, self.T) tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v8(self.Y, self.K, self.delay, statistics_mode='full') desired = to_batched_multi_freq(desired) actual = wpe.wpe_v8(Y_batched_multi_freq, self.K, self.delay, statistics_mode='full') assert desired.shape == (3, 2, self.D, self.T) assert actual.shape == (3, 2, self.D, self.T) tc.assert_allclose(actual, desired, atol=1e-6)
def test_wpe_multi_freq(self): desired = wpe.wpe_v0(self.Y, self.K, self.delay, statistics_mode='full') desired = [desired, desired] actual = wpe.wpe_v0(np.array([self.Y, self.Y]), self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v7(self.Y, self.K, self.delay, statistics_mode='full') desired = [desired, desired] actual = wpe.wpe_v7(np.array([self.Y, self.Y]), self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v6(self.Y, self.K, self.delay, statistics_mode='full') desired = [desired, desired] actual = wpe.wpe_v6(np.array([self.Y, self.Y]), self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-6) desired = wpe.wpe_v8(self.Y, self.K, self.delay, statistics_mode='full') desired = [desired, desired] actual = wpe.wpe_v8(np.array([self.Y, self.Y]), self.K, self.delay, statistics_mode='full') tc.assert_allclose(actual, desired, atol=1e-6)
def test_wpe_v6_vs_v7(self): desired = wpe.wpe_v6(self.Y, self.K, self.delay) actual = wpe.wpe_v7(self.Y, self.K, self.delay) tc.assert_allclose(actual, desired, atol=1e-10)
def test_wpe_v6_vs_sc(self): from cbj.wpe._numpy import sc_wpe desired = wpe.wpe_v6(self.Y, self.K, self.delay) actual = sc_wpe(self.Y, self.K, self.delay, iterations=3) tc.assert_allclose(actual, desired)