def test_wigner_ville_regionprops(self): """Test the regional property of the Wigner Ville representation.""" signal, _ = fmsin(128) signal[64:] = 0 tfr, _, _ = cohen.WignerVilleDistribution(signal).run() self.assertTrue(np.all(tfr[:, 64:] == 0)) signal, _ = fmsin(128) signal[:64] = 0 tfr, _, _ = cohen.WignerVilleDistribution(signal).run() self.assertTrue(np.all(tfr[:, :64] == 0))
def test_wigner_ville_projection(self): """Test the projection property of the Wigner Ville representation.""" signal, _ = fmsin(128) tfr, _, _ = cohen.WignerVilleDistribution(signal).run() x = np.abs(signal)**2 y = np.sum(tfr, axis=0) / 128 np.testing.assert_allclose(x, y)
def test_wigner_ville_energy(self): """Test the energy property of the Wigner Ville representation.""" signal, _ = fmsin(128) signal = signal / 128.0 tfr, _, _ = cohen.WignerVilleDistribution(signal).run() x = np.sum(np.sum(tfr)) y = np.sum(np.abs(signal)**2) * 128 self.assertEqual(x, y)
def test_reality(self): """Test the reality property of the Wigner Ville representation.""" signal, _ = fmsin(128) tfr, _, _ = cohen.WignerVilleDistribution(signal).run() self.assertTrue(np.all(np.isreal(tfr)))