Esempio n. 1
0
    def xtest_004(self):
        vlen = 4
        tune = counter4(self, 1)
        tune_delay = 1
        dwell_delay = 2
        msgq = gr.msg_queue()

        src_data = tuple([float(x) for x in
                          ( 1,  2,  3,  4,
                            9,  6, 11,  8,
                            5, 10,  7, 12,
                            13, 14, 15, 16
                            )])

        expected_results = tuple([float(x) for x in
                                  ( 9, 10, 11, 12)])

        src = gr.vector_source_f(src_data, False)
        s2v = blocks.stream_to_vector(gr.sizeof_float, vlen)
        stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
        self.tb.connect(src, s2v, stats)
        self.tb.run()
        self.assertEqual(1, msgq.count())
        for i in range(1):
            m = parse_msg(msgq.delete_head())
            #print "m =", m.center_freq, m.data
            self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)
Esempio n. 2
0
    def test_004(self):
        vlen = 4
        tune = counter4(self, 1)
        tune_delay = 1
        dwell_delay = 2
        msgq = gr.msg_queue()

        src_data = tuple([float(x) for x in
                          ( 1,  2,  3,  4,
                            9,  6, 11,  8,
                            5, 10,  7, 12,
                            13, 14, 15, 16
                            )])

        expected_results = tuple([float(x) for x in
                                  ( 9, 10, 11, 12)])

        src = blocks.vector_source_f(src_data, False)
        s2v = blocks.stream_to_vector(gr.sizeof_float, vlen)
        stats = blocks.bin_statistics_f(vlen, msgq, tune, tune_delay, dwell_delay)
        self.tb.connect(src, s2v, stats)
        self.tb.run()
        self.assertEqual(1, msgq.count())
        for i in range(1):
            m = parse_msg(msgq.delete_head())
            #print "m =", m.center_freq, m.data
            self.assertEqual(expected_results[vlen*i:vlen*i + vlen], m.data)