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_unpack(self): a = np.random.randn(8,4) + np.random.randn(8,4)*1j b = fft.unpack(a) c = fft.unpack(a, inplace = True) self.assert_equal(b[...,0:-1],c)