def test_010_vc(self):

        vector_length = 10
        repeats = 10
        value = [complex(5,2)+i for i in range(0, vector_length)]
        src_data = value * repeats

        src = gr.vector_source_c(src_data)
        s2v = gr.stream_to_vector(gr.sizeof_float, vector_length)
        dst = gr.probe_signal_vc(vector_length)

        self.tb.connect(src, s2v, dst)
        self.tb.run()
        output = dst.level
        self.assertEqual(len(output), vector_length)
        self.assertComplexAlmostEqual(value[3], output[3], places=6)
    def test_010_vc(self):

        vector_length = 10
        repeats = 10
        value = [complex(5, 2) + i for i in range(0, vector_length)]
        src_data = value * repeats

        src = gr.vector_source_c(src_data)
        s2v = gr.stream_to_vector(gr.sizeof_float, vector_length)
        dst = gr.probe_signal_vc(vector_length)

        self.tb.connect(src, s2v, dst)
        self.tb.run()
        output = dst.level
        self.assertEqual(len(output), vector_length)
        self.assertComplexAlmostEqual(value[3], output[3], places=6)
Пример #3
0
    def __init__(self, system, fftwidth=256, n=128, cutoff=100):
        """
        Add blocks to the top_blocks that will be used for extracting the fft
        from the flow graph for detection.

        Args:
            system: A wrapper for the top block.
            fftwidth: The width of the fft used for detection.
            n: The fft is only updated every 1 in n times.
            cutoff: How sharp peaks need to be, to be detected.
        """
        self.system = system
        self.fftwidth = fftwidth
        self.n = n
        self.cutoff = cutoff
        self.stream_to_vector = gr.stream_to_vector(gr.sizeof_gr_complex, fftwidth)
        self.keep_one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex*fftwidth, n) 
        self.fft = gr.fft_vcc(fftwidth, True, window.blackmanharris(fftwidth))
        self.probe = gr.probe_signal_vc(fftwidth)
        system.connect(system.out, self.stream_to_vector, self.keep_one_in_n,
                       self.fft, self.probe)