def test_extended_pack_data(self):
        # test if extended encoder gets correct values for input and output conversion.
        n_frames = 10
        frame_size = 32

        data = np.random.randint(0, 2, n_frames * frame_size)
        packed_data = np.packbits(data)

        tb = gr.top_block()

        src = blocks.vector_source_b(data)
        snk0 = blocks.vector_sink_b(1)
        snk1 = blocks.vector_sink_b(1)
        snk2 = blocks.vector_sink_b(1)
        snk3 = blocks.vector_sink_b(1)

        packer = blocks.pack_k_bits_bb(8)
        tb.connect(src, packer, snk0)

        enc_unpacked = fec.dummy_encoder_make(frame_size, False, False)
        ext_enc_unp = extended_encoder(enc_unpacked,
                                       threading='none',
                                       puncpat='11')
        tb.connect(src, ext_enc_unp, snk1)

        enc_pack = fec.dummy_encoder_make(frame_size // 8, True, False)
        ext_enc_pack = extended_encoder(enc_pack,
                                        threading='none',
                                        puncpat='11')
        tb.connect(src, ext_enc_pack, snk2)

        enc_packed_bits = fec.dummy_encoder_make(frame_size // 8, False, True)
        ext_enc_packed_bits = extended_encoder(enc_packed_bits,
                                               threading='none',
                                               puncpat='11')
        tb.connect(packer, ext_enc_packed_bits, snk3)

        tb.run()

        r0 = snk0.data()
        r1 = snk1.data()
        r2 = snk2.data()
        r3 = snk3.data()

        data = tuple(data)
        packed_data = tuple(packed_data)
        self.assertTupleEqual(packed_data, r0)
        self.assertTupleEqual(data, r1)
        self.assertTupleEqual(packed_data, r2)
        self.assertTupleEqual(data, r3)
Example #2
0
    def test_parallelism1_05(self):
        frame_size = 30
        dims = 5
        enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims))
        #dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,dims))
        threading = 'capillary'

        self.assertRaises(AttributeError, lambda: extended_encoder(enc, threading=threading, puncpat="11"))
    def test_parallelism1_05(self):
        frame_size = 30
        dims = 5
        enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims))
        #dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,dims))
        threading = 'capillary'

        self.assertRaises(AttributeError, lambda: extended_encoder(enc, threading=threading, puncpat="11"))
Example #4
0
    def test_extended_pack_data(self):
        # test if extended encoder gets correct values for input and output conversion.
        n_frames = 10
        frame_size = 32

        data = np.random.randint(0, 2, n_frames * frame_size)
        packed_data = np.packbits(data)

        tb = gr.top_block()

        src = blocks.vector_source_b(data)
        snk0 = blocks.vector_sink_b(1)
        snk1 = blocks.vector_sink_b(1)
        snk2 = blocks.vector_sink_b(1)
        snk3 = blocks.vector_sink_b(1)

        packer = blocks.pack_k_bits_bb(8)
        tb.connect(src, packer, snk0)

        enc_unpacked = fec.dummy_encoder_make(frame_size, False, False)
        ext_enc_unp = extended_encoder(enc_unpacked, threading='none', puncpat='11')
        tb.connect(src, ext_enc_unp, snk1)

        enc_pack = fec.dummy_encoder_make(frame_size // 8, True, False)
        ext_enc_pack = extended_encoder(enc_pack, threading='none', puncpat='11')
        tb.connect(src, ext_enc_pack, snk2)

        enc_packed_bits = fec.dummy_encoder_make(frame_size // 8, False, True)
        ext_enc_packed_bits = extended_encoder(enc_packed_bits, threading='none', puncpat='11')
        tb.connect(packer, ext_enc_packed_bits, snk3)

        tb.run()

        r0 = snk0.data()
        r1 = snk1.data()
        r2 = snk2.data()
        r3 = snk3.data()

        data = tuple(data)
        packed_data = tuple(packed_data)
        self.assertTupleEqual(packed_data, r0)
        self.assertTupleEqual(data, r1)
        self.assertTupleEqual(packed_data, r2)
        self.assertTupleEqual(data, r3)
Example #5
0
    def test_parallelism1_01(self):
        frame_size = 30
        enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,1))
        dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,1))
        threading = 'ordinary'
        self.test = _qa_helper(10*frame_size, enc, dec, threading)
        self.tb.connect(self.test)
        self.tb.run()

        data_in = self.test.snk_input.data()
        data_out =self.test.snk_output.data()

        self.assertEqual(data_in, data_out)
Example #6
0
    def test_parallelism0_02(self):
        frame_size = 30
        enc = fec.dummy_encoder_make(frame_size*8)
        dec = fec.dummy_decoder.make(frame_size*8)
        threading = 'capillary'
        self.test = _qa_helper(10*frame_size, enc, dec, threading)
        self.tb.connect(self.test)
        self.tb.run()

        data_in = self.test.snk_input.data()
        data_out =self.test.snk_output.data()

        self.assertEqual(data_in, data_out)
    def test_parallelism0_02(self):
        frame_size = 30
        enc = fec.dummy_encoder_make(frame_size * 8)
        dec = fec.dummy_decoder.make(frame_size * 8)
        threading = 'capillary'
        self.test = _qa_helper(10 * frame_size, enc, dec, threading)
        self.tb.connect(self.test)
        self.tb.run()

        data_in = self.test.snk_input.data()
        data_out = self.test.snk_output.data()

        self.assertEqual(data_in, data_out)
    def test_parallelism1_01(self):
        frame_size = 30
        enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,1))
        dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,1))
        threading = 'ordinary'
        self.test = _qa_helper(10*frame_size, enc, dec, threading)
        self.tb.connect(self.test)
        self.tb.run()

        data_in = self.test.snk_input.data()
        data_out =self.test.snk_output.data()

        self.assertEqual(data_in, data_out)