def test_00(self):
        expected_result = (
            0x00, 0x11, 0x22, 0x33,
            0x44, 0x55, 0x66, 0x77,
            0x88, 0x99, 0xaa, 0xbb,
            0xcc, 0xdd, 0xee, 0xff)

        # Filter taps to expand the data to oversample by 8
        # Just using a RRC for some basic filter shape
        taps = filter.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
        
        src = blocks.vector_source_b(expected_result)
        frame = digital.simple_framer(4)
        unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
        expand = filter.interp_fir_filter_fff(8, taps)
        b2f = blocks.char_to_float()
        mult2 = blocks.multiply_const_ff(2)
        sub1 = blocks.add_const_ff(-1)
        op = digital.simple_correlator(4)
        dst = blocks.vector_sink_b()
        self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand)
        self.tb.connect(expand, op, dst)
        self.tb.run()
        result_data = dst.data()

        self.assertEqual(expected_result, result_data)
def reference_interp_filter(src_data, interp, taps):
    tb = gr.top_block()
    src = gr.vector_source_f(src_data)
    op = filter.interp_fir_filter_fff(interp, taps)
    dst = gr.vector_sink_f()
    tb.connect(src, op, dst)
    tb.run()
    result_data = dst.data()
    tb = None
    return result_data
def reference_interp_dec_filter(src_data, interp, decim, taps):
    tb = gr.top_block()
    src = gr.vector_source_f(src_data)
    up = filter.interp_fir_filter_fff(interp, (1,))
    dn = filter.fir_filter_fff(decim, taps)
    dst = gr.vector_sink_f()
    tb.connect(src, up, dn, dst)
    tb.run()
    result_data = dst.data()
    tb = None
    return result_data
    def test_fff(self):
        taps = [1, 10, 100, 1000, 10000]
        src_data = (0, 2, 3, 5, 7, 11, 13, 17)
        interpolation = 3
        xr = (0,0,0,0,
              2,20,200,2003,20030,
              300,3005,30050,
              500,5007,50070,
              700,7011,70110,
              1100,11013,110130,
              1300,13017,130170)
        expected_result = tuple([float(x) for x in xr])

        src = blocks.vector_source_f(src_data)
        op = filter.interp_fir_filter_fff(interpolation, taps)
        dst = blocks.vector_sink_f()
        self.tb.connect(src, op)
        self.tb.connect(op, dst)
        self.tb.run()
        result_data = dst.data()
        L = min(len(result_data), len(expected_result))
        self.assertEqual(expected_result[0:L], result_data[0:L])