예제 #1
0
    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))
예제 #2
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)
예제 #3
0
 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)
예제 #4
0
 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)))