def testFFTFreqExecution(self): t = fftfreq(10, .1, chunk_size=3) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, np.fft.fftfreq(10, .1))) t = fftfreq(11, .01, chunk_size=3) res = self.executor.execute_tensor(t, concat=True)[0] self.assertTrue(np.allclose(res, np.fft.fftfreq(11, .01)))
def testFFTShiftExecution(self): t = fftfreq(10, .1, chunk_size=3) r = fftshift(t) res = self.executor.execute_tensor(r, concat=True)[0] np.testing.assert_allclose(res, np.fft.fftshift(np.fft.fftfreq(10, .1))) freqs = fftfreq(9, d=1./9, chunk_size=2).reshape(3, 3) r = fftshift(freqs, axes=(1,)) res = self.executor.execute_tensor(r, concat=True)[0] expected = np.fft.fftshift(np.fft.fftfreq(9, d=1./9).reshape(3, 3), axes=(1,)) np.testing.assert_allclose(res, expected)
def testIFFTShiftExecution(self): t = fftfreq(9, d=1. / 9, chunk_size=2).reshape(3, 3) r = ifftshift(t) res = self.executor.execute_tensor(r, concat=True)[0] expected = np.fft.ifftshift(np.fft.fftfreq(9, d=1. / 9).reshape(3, 3)) self.assertTrue(np.allclose(res, expected))