Exemple #1
0
	def test_002_moving_sum_ff(self):
		src_data = [float(i**3)*(7**-2) for i in range(-20,20)]
		expected_result = [src_data[0]]+[src_data[i]+src_data[i-1] for i in range(1,40)]
		src = gr.vector_source_f(src_data)
		moving_sum = dab_swig.moving_sum_ff(2)
		dst = gr.vector_sink_f()
		self.tb.connect(src, moving_sum)
		self.tb.connect(moving_sum, dst)
		self.tb.run()
		result_data = dst.data()
		self.assertFloatTuplesAlmostEqual(expected_result, result_data, 4)
Exemple #2
0
	def test_001_moving_sum_ff(self):
		src_data = (0,1,3,3,-3.5,-7.7,2,2,3)
		expected_result = (0,1,4,7,2.5,-8.2,-9.2,-3.7,7)
		src = gr.vector_source_f(src_data)
		moving_sum = dab_swig.moving_sum_ff(3)
		dst = gr.vector_sink_f()
		self.tb.connect(src, moving_sum)
		self.tb.connect(moving_sum, dst)
		self.tb.run()
		result_data = dst.data()
		self.assertFloatTuplesAlmostEqual(expected_result, result_data, 6)