Esempio n. 1
0
    def test_003_stream(self):
        nframes = 3
        block_power = 8
        block_size = 2**block_power
        num_info_bits = 2**(block_power - 1)
        num_frozen_bits = block_size - num_info_bits
        frozen_bit_positions = cc.frozen_bit_positions(block_size,
                                                       num_info_bits, 0.0)
        frozen_bit_values = np.array([0] * num_frozen_bits, )

        bits, gr_data = self.generate_test_data(block_size, num_info_bits,
                                                frozen_bit_positions,
                                                frozen_bit_values, nframes,
                                                False)

        polar_decoder = fec.polar_decoder_sc.make(block_size, num_info_bits,
                                                  frozen_bit_positions,
                                                  frozen_bit_values)
        src = blocks.vector_source_f(gr_data, False)
        dec_block = extended_decoder(polar_decoder, None)
        snk = blocks.vector_sink_b(1)

        self.tb.connect(src, dec_block)
        self.tb.connect(dec_block, snk)
        self.tb.run()

        res = np.array(snk.data()).astype(dtype=int)
        self.assertTupleEqual(tuple(res), tuple(bits))
Esempio n. 2
0
    def test_parallelism2_01(self):
        frame_size = 30
        dims1 = 16
        dims2 = 16
        dec = list(map((lambda b: list(map((lambda a: fec.dummy_decoder_make(frame_size*8)), list(range(0,dims1))))), list(range(0,dims2))))
        threading = 'capillary'

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

        self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
Esempio n. 4
0
    def test_parallelism2_01(self):
        frame_size = 30
        dims1 = 16
        dims2 = 16
        dec = list(map((lambda b: list(map((lambda a: fec.dummy_decoder_make(frame_size*8)), list(range(0,dims1))))), list(range(0,dims2))))
        threading = 'capillary'

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

        self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
Esempio n. 6
0
 def test_parallelism1_06(self):
     filename = LDPC_ALIST_DIR + "n_0100_k_0027_gap_04.alist"
     gap = 4
     dims = 5
     LDPC_matrix_object = fec.ldpc_H_matrix(filename, gap)
     k = LDPC_matrix_object.k()
     dec = list(map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), list(range(0,dims))))
     threading = 'capillary'
     self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
Esempio n. 7
0
    def test_002_one_vector(self):
        block_power = 10
        block_size = 2 ** block_power
        num_info_bits = 2 ** (block_power - 1)
        num_frozen_bits = block_size - num_info_bits
        frozen_bit_positions = cc.frozen_bit_positions(block_size, num_info_bits, 0.0)
        frozen_bit_values = np.array([0] * num_frozen_bits,)

        bits, gr_data = self.generate_test_data(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values, 1, True)

        polar_decoder = fec.polar_decoder_sc.make(block_size, num_info_bits, frozen_bit_positions, frozen_bit_values)
        src = blocks.vector_source_f(gr_data, False)
        dec_block = extended_decoder(polar_decoder, None)
        snk = blocks.vector_sink_b(1)

        self.tb.connect(src, dec_block)
        self.tb.connect(dec_block, snk)
        self.tb.run()

        res = np.array(snk.data()).astype(dtype=int)
        self.assertTupleEqual(tuple(res), tuple(bits))