Esempio n. 1
0
 def test_simple_ifft(self):
     """Put test data through a ring buffer and check correctness"""
     self.logfile = '.log.txt'
     self.blocks = []
     test_array = [1, 2, 3]
     self.blocks.append((TestingBlock(test_array), [], [0]))
     self.blocks.append((IFFTBlock(gulp_size=3 * 4), [0], [1]))
     self.blocks.append((WriteAsciiBlock(self.logfile), [1], []))
     open(self.logfile, 'w').close()
     Pipeline(self.blocks).main()
     true_result = np.fft.ifft(test_array)
     result = np.loadtxt(self.logfile).astype(np.float32).view(np.complex64)
     np.testing.assert_almost_equal(result, true_result, 2)
Esempio n. 2
0
 def test_equivalent_data_to_copy(self):
     """Test that the data coming out of this pipeline is equivalent
     the initial read data"""
     self.logfile = '.log.txt'
     self.blocks = []
     self.blocks.append((
         SigprocReadBlock(
             './data/1chan8bitNoDM.fil'),
         [], [0]))
     self.blocks.append((FFTBlock(gulp_size=4096 * 8 * 8 * 8 * 8), [0], [1]))
     self.blocks.append((IFFTBlock(gulp_size=4096 * 8 * 8 * 8 * 8), [1], [2]))
     self.blocks.append((WriteAsciiBlock(self.logfile), [2], []))
     open(self.logfile, 'w').close()
     Pipeline(self.blocks).main()
     unfft_result = np.loadtxt(self.logfile).astype(np.float32).view(np.complex64)
     self.blocks[1] = (CopyBlock(), [0], [1])
     self.blocks[2] = (WriteAsciiBlock(self.logfile), [1], [])
     del self.blocks[3]
     open(self.logfile, 'w').close()
     Pipeline(self.blocks).main()
     untouched_result = np.loadtxt(self.logfile).astype(np.float32)
     np.testing.assert_almost_equal(unfft_result, untouched_result, 2)