Ejemplo n.º 1
0
 def testFullFft(self):
     data = np.array([1, 2, 1, 3, 1, 4, 1, 2], dtype=np.float32)
     dft = np.array([15, -2.1213 + 0.7071j, -1j, 2.1213 + 0.7071j,
                     -7, 2.1213 - 0.7071j, 1j, -2.1213 - 0.7071j])
     self.stft.performStft(data)
     dfts = self.stft.getDFTs()
     reals = dfts[0][0][0]
     imags = dfts[0][1][0]
     full_fft = mat.to_full_fft(reals, imags)
     print full_fft / 2
     self.assertListFloatEqual(dft, full_fft / 2)
Ejemplo n.º 2
0
 def testFullFfft2(self):
     reals = [4, 0, 1, 0]
     imags = [1, 2, 0, 0]
     full_fft = mat.to_full_fft(reals, imags)
     self.assertListFloatEqual(
         np.array([4, 2j, 1, 0, 1, 0, 1, -2j]), full_fft)