def test_rfft_double_axis(self): a = np.array(np.random.randn(2,4,8),"float64") b = a.reshape(2,8,4) self.assert_equal(fft.unpack(fft.rfft(a,axis = 0), axis = 0)/2., np.fft.rfft(a, axis = 0)) self.assert_equal(fft.unpack(fft.rfft(b,axis = 0),axis = 0)/2., np.fft.rfft(b,axis = 0)) self.assert_equal(fft.unpack(fft.rfft(a,axis = 1), axis = 1)/2., np.fft.rfft(a, axis = 1)) self.assert_equal(fft.unpack(fft.rfft(b,axis = 1),axis = 1)/2., np.fft.rfft(b,axis = 1))
def test_rfft_split_out_double(self): a = np.array(np.random.randn(2,4,8),"float64") b = a.reshape(2,8,4) for x in (a,b): r,i = fft.rfft(x, split_out = True) c = r + 1j*i self.assert_equal(fft.unpack(c)/2., np.fft.rfft(x))
def test_rfft_double(self): a = np.array(np.random.randn(2,4,8),"float32") b = a.reshape(2,8,4) self.assert_equal(fft.unpack(fft.rfft(a))/2., np.fft.rfft(a)) self.assert_equal(fft.unpack(fft.rfft(b))/2., np.fft.rfft(b))
def test_rfft_float(self): a = np.array(np.random.randn(2,4,8),"float32") with self.subTest(i = 0): self.assert_equal(fft.irfft(fft.rfft(a, split_out = True), split_in = True)/8/2, a)
def test_rfft_64(self): with self.assertWarns(np.ComplexWarning): fft.rfft(c64)
def test_rfft_128(self): with self.assertWarns(np.ComplexWarning): fft.rfft(c128)
def test_irfft_double(self): a = np.array(np.random.randn(2,4,8),"float64") b = a.reshape(2,8,4) self.assert_equal(fft.irfft(fft.rfft(a))/8/2, a) self.assert_equal(fft.irfft(fft.rfft(b))/4/2, b)