Exemple #1
0
 def test_transformer_2d(self):
     a = numpy.random.random((self._size, )*2)
     t = nfft.Transformer(a, 5)
     ft_nfft = t.transform([[self._coord_1d[self._2d_coord[0][0]], self._coord_1d[self._2d_coord[0][1]]],
                            [self._coord_1d[self._2d_coord[1][0]], self._coord_1d[self._2d_coord[1][1]]]])
     ft_fftw = numpy.fft.fftshift(numpy.fft.fft2(numpy.fft.fftshift(a)))
     numpy.testing.assert_almost_equal(ft_nfft, ft_fftw[(self._2d_coord[0][0], self._2d_coord[1][0]), (self._2d_coord[0][1], self._2d_coord[1][1])])
Exemple #2
0
 def test_transformer_direct(self):
     a = numpy.random.random(self._size)
     t = nfft.Transformer(a, 100)
     coordinates = -0.5+numpy.random.random(100)
     ft_nfft = t.transform(coordinates, use_direct=False)
     ft_nfft_direct = t.transform(coordinates, use_direct=True)
     numpy.testing.assert_almost_equal(ft_nfft, ft_nfft_direct, decimal=self._decimals)
Exemple #3
0
 def test_transformer_1d(self):
     a = numpy.random.random(self._size)
     t = nfft.Transformer(a, 1., 20)
     ft_nfft = t.transform(self._coord_1d)
     ft_fftw = numpy.fft.fftshift(numpy.fft.fft(numpy.fft.fftshift(a)))
     numpy.testing.assert_almost_equal(ft_nfft,
                                       ft_fftw,
                                       decimal=self._decimals)