def test_parallelism0_03(self): filename = LDPC_ALIST_DIR + "n_0100_k_0058_gen_matrix.alist" gap = 4 LDPC_matrix_object = fec.ldpc_G_matrix(filename) k = LDPC_matrix_object.k() enc = fec.ldpc_gen_mtrx_encoder.make(LDPC_matrix_object) dec = fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr()) threading = 'capillary' self.test = _qa_helper(10*k, 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 __init__(self, puncpat='11'): gr.top_block.__init__(self, "Fecapi Tagged Ldpc Encoders") Qt.QWidget.__init__(self) self.setWindowTitle("Fecapi Tagged Ldpc Encoders") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "fecapi_tagged_ldpc_encoders") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.puncpat = puncpat ################################################## # Variables ################################################## self.G = G = fec.ldpc_G_matrix( '/home/mbkitine/Dropbox/Lulea/GRC/DeepSpace/gr-ccsds/examples/LDPC/sim_matlab/AR4JA/alist/AR4JA_r12_k1024n.alist' ) self.samp_rate = samp_rate = 50000 self.ldpc_enc_G = ldpc_enc_G = fec.ldpc_gen_mtrx_encoder_make(G) self.frame_size_H = frame_size_H = 42 self.frame_size_G = frame_size_G = 1024 self.MTU_H = MTU_H = 1512 self.MTU_G = MTU_G = 1508
def __init__(self, frame_size=100, puncpat='11'): gr.top_block.__init__(self, "Fecapi Ldpc Decoders") Qt.QWidget.__init__(self) self.setWindowTitle("Fecapi Ldpc Decoders") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "fecapi_ldpc_decoders") self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray)) ################################################## # Parameters ################################################## self.frame_size = frame_size self.puncpat = puncpat ################################################## # Variables ################################################## self.H = H = fec.ldpc_H_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 2) self.G = G = fec.ldpc_G_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0058_gen_matrix.alist") self.samp_rate = samp_rate = 50000 self.ldpc_enc_H = ldpc_enc_H = fec.ldpc_par_mtrx_encoder_make_H(H) self.ldpc_enc_G = ldpc_enc_G = fec.ldpc_gen_mtrx_encoder_make(G) self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist"); self.ldpc_dec_H = ldpc_dec_H = fec.ldpc_bit_flip_decoder.make(H.get_base_sptr(), 100) self.ldpc_dec_G = ldpc_dec_G = fec.ldpc_bit_flip_decoder.make(G.get_base_sptr(), 100) self.ldpc_dec = ldpc_dec = fec.ldpc_decoder.make(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 0.5, 50); ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate '', #name 4 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.01) self.qtgui_time_sink_x_0.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) self.qtgui_time_sink_x_0.enable_stem_plot(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['Input', 'LDPC (alist)', 'LDPC (H)', 'LDPC (G)', 'CCSDS', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = ["blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue"] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 0.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(4): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win) self.fec_extended_encoder_1_0_0 = fec.extended_encoder(encoder_obj_list=ldpc_enc, threading= None, puncpat=puncpat) self.fec_extended_encoder_1_0 = fec.extended_encoder(encoder_obj_list=ldpc_enc_H, threading= None, puncpat=puncpat) self.fec_extended_encoder_1 = fec.extended_encoder(encoder_obj_list=ldpc_enc_G, threading= None, puncpat=puncpat) self.fec_extended_decoder_0_1_0 = fec.extended_decoder(decoder_obj_list=ldpc_dec, threading= None, ann=None, puncpat=puncpat, integration_period=10000) self.fec_extended_decoder_0_1 = fec.extended_decoder(decoder_obj_list=ldpc_dec_H, threading= None, ann=None, puncpat=puncpat, integration_period=10000) self.fec_extended_decoder_0 = fec.extended_decoder(decoder_obj_list=ldpc_dec_G, threading= None, ann=None, puncpat=puncpat, integration_period=10000) self.digital_map_bb_0_0_0_0 = digital.map_bb(([-1, 1])) self.digital_map_bb_0_0_0 = digital.map_bb(([-1, 1])) self.digital_map_bb_0_0 = digital.map_bb(([-1, 1])) self.blocks_vector_source_x_0_1_0 = blocks.vector_source_b((frame_size/15)*[0, 0, 1, 0, 3, 0, 7, 0, 15, 0, 31, 0, 63, 0, 127], True, 1, []) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True) self.blocks_char_to_float_0_2_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_2 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_0_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) ################################################## # Connections ################################################## self.connect((self.blocks_char_to_float_0, 0), (self.fec_extended_decoder_0, 0)) self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0, 3)) self.connect((self.blocks_char_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0, 2)) self.connect((self.blocks_char_to_float_0_0_0_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_char_to_float_0_2, 0), (self.fec_extended_decoder_0_1, 0)) self.connect((self.blocks_char_to_float_0_2_0, 0), (self.fec_extended_decoder_0_1_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0_1, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1_0_0, 0)) self.connect((self.blocks_vector_source_x_0_1_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_map_bb_0_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.digital_map_bb_0_0_0, 0), (self.blocks_char_to_float_0_2, 0)) self.connect((self.digital_map_bb_0_0_0_0, 0), (self.blocks_char_to_float_0_2_0, 0)) self.connect((self.fec_extended_decoder_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.fec_extended_decoder_0_1, 0), (self.blocks_char_to_float_0_0_0, 0)) self.connect((self.fec_extended_decoder_0_1_0, 0), (self.blocks_char_to_float_0_0_0_0, 0)) self.connect((self.fec_extended_encoder_1, 0), (self.digital_map_bb_0_0, 0)) self.connect((self.fec_extended_encoder_1_0, 0), (self.digital_map_bb_0_0_0, 0)) self.connect((self.fec_extended_encoder_1_0_0, 0), (self.digital_map_bb_0_0_0_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ber Curve Gen Ldpc") Qt.QWidget.__init__(self) self.setWindowTitle("Ber Curve Gen Ldpc") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "ber_curve_gen_ldpc") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.framebits = framebits = 4096 self.esno_0 = esno_0 = numpy.arange(0, 8.1, .5) self.H = H = fec.ldpc_H_matrix( gr.prefix() + "/share/gnuradio/fec/ldpc/n_1800_k_0902_gap_28.alist", 28) self.G = G = fec.ldpc_G_matrix( gr.prefix() + "/share/gnuradio/fec/ldpc/simple_g_matrix.alist") self.samp_rate_0 = samp_rate_0 = 35000000 self.k = k = 7 self.enc_rep = enc_rep = map((lambda b: map( (lambda a: fec.repetition_encoder_make(framebits, 3)), range(0, 1)) ), range(0, len(esno_0))) self.enc_ldpc_G = enc_ldpc_G = map((lambda b: map( (lambda a: fec.ldpc_gen_mtrx_encoder_make(G)), range(0, 1))), range(0, len(esno_0))) self.enc_ldpc = enc_ldpc = map((lambda b: map( (lambda a: fec.ldpc_par_mtrx_encoder_make_H(H)), range(0, 1))), range(0, len(esno_0))) self.enc_dummy = enc_dummy = map((lambda b: map( (lambda a: fec.dummy_encoder_make(framebits)), range(0, 1))), range(0, len(esno_0))) self.dec_rep = dec_rep = map((lambda b: map( (lambda a: fec.repetition_decoder.make(framebits, 3, 0.5)), range(0, 1))), range(0, len(esno_0))) self.dec_ldpc_G = dec_ldpc_G = map((lambda b: map( (lambda a: fec.ldpc_bit_flip_decoder.make(G.get_base_sptr(), 100)), range(0, 1))), range(0, len(esno_0))) self.dec_ldpc = dec_ldpc = map((lambda b: map( (lambda a: fec.ldpc_bit_flip_decoder.make(H.get_base_sptr(), 100)), range(0, 1))), range(0, len(esno_0))) self.dec_dummy = dec_dummy = map((lambda b: map( (lambda a: fec.dummy_decoder.make(framebits)), range(0, 1))), range(0, len(esno_0))) ################################################## # Blocks ################################################## self.qtgui_bercurve_sink_0 = qtgui.ber_sink_b( esno_0, #range of esnos 4, #number of curves 1000, #ensure at least -10, #cutoff [], #indiv. curve names ) self.qtgui_bercurve_sink_0.set_update_time(0.10) self.qtgui_bercurve_sink_0.set_y_axis(-10, 0) self.qtgui_bercurve_sink_0.set_x_axis(esno_0[0], esno_0[-1]) labels = [ 'None', 'Rep. (Rate=3)', 'LDPC (H matrix)', 'LDPC (Gen. matrix)', '', '', '', '', '', '' ] widths = [2, 2, 2, 2, 1, 1, 1, 1, 1, 1] colors = [ "black", "blue", "green", "red", "red", "red", "red", "red", "red", "red" ] styles = [3, 2, 4, 1, 0, 0, 0, 0, 0, 0] markers = [8, 1, 2, 0, 0, 0, 0, 0, 0, 0] alphas = [1, 1, 1, 1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(4): if len(labels[i]) == 0: self.qtgui_bercurve_sink_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_bercurve_sink_0.set_line_label(i, labels[i]) self.qtgui_bercurve_sink_0.set_line_width(i, widths[i]) self.qtgui_bercurve_sink_0.set_line_color(i, colors[i]) self.qtgui_bercurve_sink_0.set_line_style(i, styles[i]) self.qtgui_bercurve_sink_0.set_line_marker(i, markers[i]) self.qtgui_bercurve_sink_0.set_line_alpha(i, alphas[i]) self._qtgui_bercurve_sink_0_win = sip.wrapinstance( self.qtgui_bercurve_sink_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_bercurve_sink_0_win) self.fec_bercurve_generator_1 = fec.bercurve_generator( enc_ldpc, #size dec_ldpc, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0_0_0 = fec.bercurve_generator( enc_dummy, #size dec_dummy, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0_0 = fec.bercurve_generator( enc_rep, #size dec_rep, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) self.fec_bercurve_generator_0 = fec.bercurve_generator( enc_ldpc_G, #size dec_ldpc_G, #name esno_0, #range of esnos samp_rate_0, #throttle "capillary", #threading mode '11', #puncture pattern -100 # noise gen. seed ) ################################################## # Connections ################################################## self.connect((self.fec_bercurve_generator_0, 0), (self.qtgui_bercurve_sink_0, 102)) self.connect((self.fec_bercurve_generator_0, 1), (self.qtgui_bercurve_sink_0, 103)) self.connect((self.fec_bercurve_generator_0, 2), (self.qtgui_bercurve_sink_0, 104)) self.connect((self.fec_bercurve_generator_0, 3), (self.qtgui_bercurve_sink_0, 105)) self.connect((self.fec_bercurve_generator_0, 4), (self.qtgui_bercurve_sink_0, 106)) self.connect((self.fec_bercurve_generator_0, 5), (self.qtgui_bercurve_sink_0, 107)) self.connect((self.fec_bercurve_generator_0, 6), (self.qtgui_bercurve_sink_0, 108)) self.connect((self.fec_bercurve_generator_0, 7), (self.qtgui_bercurve_sink_0, 109)) self.connect((self.fec_bercurve_generator_0, 8), (self.qtgui_bercurve_sink_0, 110)) self.connect((self.fec_bercurve_generator_0, 9), (self.qtgui_bercurve_sink_0, 111)) self.connect((self.fec_bercurve_generator_0, 10), (self.qtgui_bercurve_sink_0, 112)) self.connect((self.fec_bercurve_generator_0, 11), (self.qtgui_bercurve_sink_0, 113)) self.connect((self.fec_bercurve_generator_0, 12), (self.qtgui_bercurve_sink_0, 114)) self.connect((self.fec_bercurve_generator_0, 13), (self.qtgui_bercurve_sink_0, 115)) self.connect((self.fec_bercurve_generator_0, 14), (self.qtgui_bercurve_sink_0, 116)) self.connect((self.fec_bercurve_generator_0, 15), (self.qtgui_bercurve_sink_0, 117)) self.connect((self.fec_bercurve_generator_0, 16), (self.qtgui_bercurve_sink_0, 118)) self.connect((self.fec_bercurve_generator_0, 17), (self.qtgui_bercurve_sink_0, 119)) self.connect((self.fec_bercurve_generator_0, 18), (self.qtgui_bercurve_sink_0, 120)) self.connect((self.fec_bercurve_generator_0, 19), (self.qtgui_bercurve_sink_0, 121)) self.connect((self.fec_bercurve_generator_0, 20), (self.qtgui_bercurve_sink_0, 122)) self.connect((self.fec_bercurve_generator_0, 21), (self.qtgui_bercurve_sink_0, 123)) self.connect((self.fec_bercurve_generator_0, 22), (self.qtgui_bercurve_sink_0, 124)) self.connect((self.fec_bercurve_generator_0, 23), (self.qtgui_bercurve_sink_0, 125)) self.connect((self.fec_bercurve_generator_0, 24), (self.qtgui_bercurve_sink_0, 126)) self.connect((self.fec_bercurve_generator_0, 25), (self.qtgui_bercurve_sink_0, 127)) self.connect((self.fec_bercurve_generator_0, 26), (self.qtgui_bercurve_sink_0, 128)) self.connect((self.fec_bercurve_generator_0, 27), (self.qtgui_bercurve_sink_0, 129)) self.connect((self.fec_bercurve_generator_0, 28), (self.qtgui_bercurve_sink_0, 130)) self.connect((self.fec_bercurve_generator_0, 29), (self.qtgui_bercurve_sink_0, 131)) self.connect((self.fec_bercurve_generator_0, 30), (self.qtgui_bercurve_sink_0, 132)) self.connect((self.fec_bercurve_generator_0, 31), (self.qtgui_bercurve_sink_0, 133)) self.connect((self.fec_bercurve_generator_0, 32), (self.qtgui_bercurve_sink_0, 134)) self.connect((self.fec_bercurve_generator_0, 33), (self.qtgui_bercurve_sink_0, 135)) self.connect((self.fec_bercurve_generator_0_0, 0), (self.qtgui_bercurve_sink_0, 34)) self.connect((self.fec_bercurve_generator_0_0, 1), (self.qtgui_bercurve_sink_0, 35)) self.connect((self.fec_bercurve_generator_0_0, 2), (self.qtgui_bercurve_sink_0, 36)) self.connect((self.fec_bercurve_generator_0_0, 3), (self.qtgui_bercurve_sink_0, 37)) self.connect((self.fec_bercurve_generator_0_0, 4), (self.qtgui_bercurve_sink_0, 38)) self.connect((self.fec_bercurve_generator_0_0, 5), (self.qtgui_bercurve_sink_0, 39)) self.connect((self.fec_bercurve_generator_0_0, 6), (self.qtgui_bercurve_sink_0, 40)) self.connect((self.fec_bercurve_generator_0_0, 7), (self.qtgui_bercurve_sink_0, 41)) self.connect((self.fec_bercurve_generator_0_0, 8), (self.qtgui_bercurve_sink_0, 42)) self.connect((self.fec_bercurve_generator_0_0, 9), (self.qtgui_bercurve_sink_0, 43)) self.connect((self.fec_bercurve_generator_0_0, 10), (self.qtgui_bercurve_sink_0, 44)) self.connect((self.fec_bercurve_generator_0_0, 11), (self.qtgui_bercurve_sink_0, 45)) self.connect((self.fec_bercurve_generator_0_0, 12), (self.qtgui_bercurve_sink_0, 46)) self.connect((self.fec_bercurve_generator_0_0, 13), (self.qtgui_bercurve_sink_0, 47)) self.connect((self.fec_bercurve_generator_0_0, 14), (self.qtgui_bercurve_sink_0, 48)) self.connect((self.fec_bercurve_generator_0_0, 15), (self.qtgui_bercurve_sink_0, 49)) self.connect((self.fec_bercurve_generator_0_0, 16), (self.qtgui_bercurve_sink_0, 50)) self.connect((self.fec_bercurve_generator_0_0, 17), (self.qtgui_bercurve_sink_0, 51)) self.connect((self.fec_bercurve_generator_0_0, 18), (self.qtgui_bercurve_sink_0, 52)) self.connect((self.fec_bercurve_generator_0_0, 19), (self.qtgui_bercurve_sink_0, 53)) self.connect((self.fec_bercurve_generator_0_0, 20), (self.qtgui_bercurve_sink_0, 54)) self.connect((self.fec_bercurve_generator_0_0, 21), (self.qtgui_bercurve_sink_0, 55)) self.connect((self.fec_bercurve_generator_0_0, 22), (self.qtgui_bercurve_sink_0, 56)) self.connect((self.fec_bercurve_generator_0_0, 23), (self.qtgui_bercurve_sink_0, 57)) self.connect((self.fec_bercurve_generator_0_0, 24), (self.qtgui_bercurve_sink_0, 58)) self.connect((self.fec_bercurve_generator_0_0, 25), (self.qtgui_bercurve_sink_0, 59)) self.connect((self.fec_bercurve_generator_0_0, 26), (self.qtgui_bercurve_sink_0, 60)) self.connect((self.fec_bercurve_generator_0_0, 27), (self.qtgui_bercurve_sink_0, 61)) self.connect((self.fec_bercurve_generator_0_0, 28), (self.qtgui_bercurve_sink_0, 62)) self.connect((self.fec_bercurve_generator_0_0, 29), (self.qtgui_bercurve_sink_0, 63)) self.connect((self.fec_bercurve_generator_0_0, 30), (self.qtgui_bercurve_sink_0, 64)) self.connect((self.fec_bercurve_generator_0_0, 31), (self.qtgui_bercurve_sink_0, 65)) self.connect((self.fec_bercurve_generator_0_0, 32), (self.qtgui_bercurve_sink_0, 66)) self.connect((self.fec_bercurve_generator_0_0, 33), (self.qtgui_bercurve_sink_0, 67)) self.connect((self.fec_bercurve_generator_0_0_0, 0), (self.qtgui_bercurve_sink_0, 0)) self.connect((self.fec_bercurve_generator_0_0_0, 1), (self.qtgui_bercurve_sink_0, 1)) self.connect((self.fec_bercurve_generator_0_0_0, 2), (self.qtgui_bercurve_sink_0, 2)) self.connect((self.fec_bercurve_generator_0_0_0, 3), (self.qtgui_bercurve_sink_0, 3)) self.connect((self.fec_bercurve_generator_0_0_0, 4), (self.qtgui_bercurve_sink_0, 4)) self.connect((self.fec_bercurve_generator_0_0_0, 5), (self.qtgui_bercurve_sink_0, 5)) self.connect((self.fec_bercurve_generator_0_0_0, 6), (self.qtgui_bercurve_sink_0, 6)) self.connect((self.fec_bercurve_generator_0_0_0, 7), (self.qtgui_bercurve_sink_0, 7)) self.connect((self.fec_bercurve_generator_0_0_0, 8), (self.qtgui_bercurve_sink_0, 8)) self.connect((self.fec_bercurve_generator_0_0_0, 9), (self.qtgui_bercurve_sink_0, 9)) self.connect((self.fec_bercurve_generator_0_0_0, 10), (self.qtgui_bercurve_sink_0, 10)) self.connect((self.fec_bercurve_generator_0_0_0, 11), (self.qtgui_bercurve_sink_0, 11)) self.connect((self.fec_bercurve_generator_0_0_0, 12), (self.qtgui_bercurve_sink_0, 12)) self.connect((self.fec_bercurve_generator_0_0_0, 13), (self.qtgui_bercurve_sink_0, 13)) self.connect((self.fec_bercurve_generator_0_0_0, 14), (self.qtgui_bercurve_sink_0, 14)) self.connect((self.fec_bercurve_generator_0_0_0, 15), (self.qtgui_bercurve_sink_0, 15)) self.connect((self.fec_bercurve_generator_0_0_0, 16), (self.qtgui_bercurve_sink_0, 16)) self.connect((self.fec_bercurve_generator_0_0_0, 17), (self.qtgui_bercurve_sink_0, 17)) self.connect((self.fec_bercurve_generator_0_0_0, 18), (self.qtgui_bercurve_sink_0, 18)) self.connect((self.fec_bercurve_generator_0_0_0, 19), (self.qtgui_bercurve_sink_0, 19)) self.connect((self.fec_bercurve_generator_0_0_0, 20), (self.qtgui_bercurve_sink_0, 20)) self.connect((self.fec_bercurve_generator_0_0_0, 21), (self.qtgui_bercurve_sink_0, 21)) self.connect((self.fec_bercurve_generator_0_0_0, 22), (self.qtgui_bercurve_sink_0, 22)) self.connect((self.fec_bercurve_generator_0_0_0, 23), (self.qtgui_bercurve_sink_0, 23)) self.connect((self.fec_bercurve_generator_0_0_0, 24), (self.qtgui_bercurve_sink_0, 24)) self.connect((self.fec_bercurve_generator_0_0_0, 25), (self.qtgui_bercurve_sink_0, 25)) self.connect((self.fec_bercurve_generator_0_0_0, 26), (self.qtgui_bercurve_sink_0, 26)) self.connect((self.fec_bercurve_generator_0_0_0, 27), (self.qtgui_bercurve_sink_0, 27)) self.connect((self.fec_bercurve_generator_0_0_0, 28), (self.qtgui_bercurve_sink_0, 28)) self.connect((self.fec_bercurve_generator_0_0_0, 29), (self.qtgui_bercurve_sink_0, 29)) self.connect((self.fec_bercurve_generator_0_0_0, 30), (self.qtgui_bercurve_sink_0, 30)) self.connect((self.fec_bercurve_generator_0_0_0, 31), (self.qtgui_bercurve_sink_0, 31)) self.connect((self.fec_bercurve_generator_0_0_0, 32), (self.qtgui_bercurve_sink_0, 32)) self.connect((self.fec_bercurve_generator_0_0_0, 33), (self.qtgui_bercurve_sink_0, 33)) self.connect((self.fec_bercurve_generator_1, 0), (self.qtgui_bercurve_sink_0, 68)) self.connect((self.fec_bercurve_generator_1, 1), (self.qtgui_bercurve_sink_0, 69)) self.connect((self.fec_bercurve_generator_1, 2), (self.qtgui_bercurve_sink_0, 70)) self.connect((self.fec_bercurve_generator_1, 3), (self.qtgui_bercurve_sink_0, 71)) self.connect((self.fec_bercurve_generator_1, 4), (self.qtgui_bercurve_sink_0, 72)) self.connect((self.fec_bercurve_generator_1, 5), (self.qtgui_bercurve_sink_0, 73)) self.connect((self.fec_bercurve_generator_1, 6), (self.qtgui_bercurve_sink_0, 74)) self.connect((self.fec_bercurve_generator_1, 7), (self.qtgui_bercurve_sink_0, 75)) self.connect((self.fec_bercurve_generator_1, 8), (self.qtgui_bercurve_sink_0, 76)) self.connect((self.fec_bercurve_generator_1, 9), (self.qtgui_bercurve_sink_0, 77)) self.connect((self.fec_bercurve_generator_1, 10), (self.qtgui_bercurve_sink_0, 78)) self.connect((self.fec_bercurve_generator_1, 11), (self.qtgui_bercurve_sink_0, 79)) self.connect((self.fec_bercurve_generator_1, 12), (self.qtgui_bercurve_sink_0, 80)) self.connect((self.fec_bercurve_generator_1, 13), (self.qtgui_bercurve_sink_0, 81)) self.connect((self.fec_bercurve_generator_1, 14), (self.qtgui_bercurve_sink_0, 82)) self.connect((self.fec_bercurve_generator_1, 15), (self.qtgui_bercurve_sink_0, 83)) self.connect((self.fec_bercurve_generator_1, 16), (self.qtgui_bercurve_sink_0, 84)) self.connect((self.fec_bercurve_generator_1, 17), (self.qtgui_bercurve_sink_0, 85)) self.connect((self.fec_bercurve_generator_1, 18), (self.qtgui_bercurve_sink_0, 86)) self.connect((self.fec_bercurve_generator_1, 19), (self.qtgui_bercurve_sink_0, 87)) self.connect((self.fec_bercurve_generator_1, 20), (self.qtgui_bercurve_sink_0, 88)) self.connect((self.fec_bercurve_generator_1, 21), (self.qtgui_bercurve_sink_0, 89)) self.connect((self.fec_bercurve_generator_1, 22), (self.qtgui_bercurve_sink_0, 90)) self.connect((self.fec_bercurve_generator_1, 23), (self.qtgui_bercurve_sink_0, 91)) self.connect((self.fec_bercurve_generator_1, 24), (self.qtgui_bercurve_sink_0, 92)) self.connect((self.fec_bercurve_generator_1, 25), (self.qtgui_bercurve_sink_0, 93)) self.connect((self.fec_bercurve_generator_1, 26), (self.qtgui_bercurve_sink_0, 94)) self.connect((self.fec_bercurve_generator_1, 27), (self.qtgui_bercurve_sink_0, 95)) self.connect((self.fec_bercurve_generator_1, 28), (self.qtgui_bercurve_sink_0, 96)) self.connect((self.fec_bercurve_generator_1, 29), (self.qtgui_bercurve_sink_0, 97)) self.connect((self.fec_bercurve_generator_1, 30), (self.qtgui_bercurve_sink_0, 98)) self.connect((self.fec_bercurve_generator_1, 31), (self.qtgui_bercurve_sink_0, 99)) self.connect((self.fec_bercurve_generator_1, 32), (self.qtgui_bercurve_sink_0, 100)) self.connect((self.fec_bercurve_generator_1, 33), (self.qtgui_bercurve_sink_0, 101))
def __init__(self, frame_size=int(152 * 10), puncpat='11'): gr.top_block.__init__(self, "LDPC Bit-Flipping Decoder") Qt.QWidget.__init__(self) self.setWindowTitle("LDPC Bit-Flipping Decoder") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "lab5_ldpc") try: if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): self.restoreGeometry( self.settings.value("geometry").toByteArray()) else: self.restoreGeometry(self.settings.value("geometry")) except: pass ################################################## # Parameters ################################################## self.frame_size = frame_size self.puncpat = puncpat ################################################## # Variables ################################################## self.nIterations = nIterations = 5 self.H = H = fec.ldpc_H_matrix( '/usr/share/gnuradio/fec/ldpc/n_0300_k_0152_gap_03.alist', 3) self.G = G = fec.ldpc_G_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0058_gen_matrix.alist") self.samp_rate = samp_rate = 32e3 self.reset_ber = reset_ber = 0 self.ldpc_enc_H = ldpc_enc_H = fec.ldpc_par_mtrx_encoder_make_H(H) self.ldpc_enc_G = ldpc_enc_G = fec.ldpc_gen_mtrx_encoder_make(G) self.ldpc_dec_H = ldpc_dec_H = fec.ldpc_bit_flip_decoder.make( H.get_base_sptr(), nIterations) self.ldpc_dec_G = ldpc_dec_G = fec.ldpc_bit_flip_decoder.make( G.get_base_sptr(), nIterations) self.eb_no_db = eb_no_db = 10 self.R_ldpc = R_ldpc = 152 / 300 ################################################## # Blocks ################################################## _reset_ber_push_button = Qt.QPushButton('Reset BER') _reset_ber_push_button = Qt.QPushButton('Reset BER') self._reset_ber_choices = {'Pressed': 1, 'Released': 0} _reset_ber_push_button.pressed.connect( lambda: self.set_reset_ber(self._reset_ber_choices['Pressed'])) _reset_ber_push_button.released.connect( lambda: self.set_reset_ber(self._reset_ber_choices['Released'])) self.top_grid_layout.addWidget(_reset_ber_push_button) self._eb_no_db_range = Range(0, 20, 0.5, 10, 200) self._eb_no_db_win = RangeWidget(self._eb_no_db_range, self.set_eb_no_db, 'Eb/No (dB)', "counter_slider", float) self.top_grid_layout.addWidget(self._eb_no_db_win) self.wes_ber_0_0_0_0 = wes.ber(1, reset_ber) self.wes_ber_0_0 = wes.ber(1, reset_ber) self.qtgui_number_sink_0_0_0_0 = qtgui.number_sink( gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 2) self.qtgui_number_sink_0_0_0_0.set_update_time(0.10) self.qtgui_number_sink_0_0_0_0.set_title("Uncoded") labels = ['BER', '# Errors', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in range(2): self.qtgui_number_sink_0_0_0_0.set_min(i, -1) self.qtgui_number_sink_0_0_0_0.set_max(i, 1) self.qtgui_number_sink_0_0_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0_0_0.set_label( i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_0_0_win) self.qtgui_number_sink_0_0 = qtgui.number_sink(gr.sizeof_float, 0, qtgui.NUM_GRAPH_NONE, 2) self.qtgui_number_sink_0_0.set_update_time(0.10) self.qtgui_number_sink_0_0.set_title("LDPC (Bit-Flip)") labels = ['BER', '# Errors', '', '', '', '', '', '', '', ''] units = ['', '', '', '', '', '', '', '', '', ''] colors = [("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black"), ("black", "black")] factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] for i in range(2): self.qtgui_number_sink_0_0.set_min(i, -1) self.qtgui_number_sink_0_0.set_max(i, 1) self.qtgui_number_sink_0_0.set_color(i, colors[i][0], colors[i][1]) if len(labels[i]) == 0: self.qtgui_number_sink_0_0.set_label(i, "Data {0}".format(i)) else: self.qtgui_number_sink_0_0.set_label(i, labels[i]) self.qtgui_number_sink_0_0.set_unit(i, units[i]) self.qtgui_number_sink_0_0.set_factor(i, factor[i]) self.qtgui_number_sink_0_0.enable_autoscale(False) self._qtgui_number_sink_0_0_win = sip.wrapinstance( self.qtgui_number_sink_0_0.pyqwidget(), Qt.QWidget) self.top_grid_layout.addWidget(self._qtgui_number_sink_0_0_win) self.fec_extended_encoder_1_0 = fec.extended_encoder( encoder_obj_list=ldpc_enc_H, threading=None, puncpat=puncpat) self.fec_extended_decoder_0_1 = fec.extended_decoder( decoder_obj_list=ldpc_dec_H, threading=None, ann=None, puncpat=puncpat, integration_period=10000) self.digital_map_bb_0_0_1_1_0 = digital.map_bb([-1, 1]) self.digital_map_bb_0_0_0 = digital.map_bb([-1, 1]) self.digital_map_bb_0_0 = digital.map_bb([-1, 1]) self.digital_binary_slicer_fb_0_0_0_0 = digital.binary_slicer_fb() self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb() self.blocks_char_to_float_0_2_0_0_0_0_1_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_2_0_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0_2 = blocks.char_to_float(1, 1) self.blocks_add_xx_0_0_0_0 = blocks.add_vff(1) self.blocks_add_xx_0_0 = blocks.add_vff(1) self.analog_random_source_x_0 = blocks.vector_source_b( list(map(int, numpy.random.randint(0, 2, frame_size))), True) self.analog_noise_source_x_0_0_0_0 = analog.noise_source_f( analog.GR_GAUSSIAN, math.sqrt(0.5 / (1 * math.pow(10, eb_no_db / 10))), 0) self.analog_noise_source_x_0_0 = analog.noise_source_f( analog.GR_GAUSSIAN, math.sqrt(0.5 / (R_ldpc * math.pow(10, eb_no_db / 10))), 0) ################################################## # Connections ################################################## self.connect((self.analog_noise_source_x_0_0, 0), (self.blocks_add_xx_0_0, 1)) self.connect((self.analog_noise_source_x_0_0_0_0, 0), (self.blocks_add_xx_0_0_0_0, 1)) self.connect((self.analog_random_source_x_0, 0), (self.digital_map_bb_0_0_1_1_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.fec_extended_encoder_1_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.wes_ber_0_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.wes_ber_0_0_0_0, 0)) self.connect((self.blocks_add_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0)) self.connect((self.blocks_add_xx_0_0_0_0, 0), (self.digital_binary_slicer_fb_0_0_0_0, 0)) self.connect((self.blocks_char_to_float_0_2, 0), (self.blocks_add_xx_0_0, 0)) self.connect((self.blocks_char_to_float_0_2_0_0_0, 0), (self.fec_extended_decoder_0_1, 0)) self.connect((self.blocks_char_to_float_0_2_0_0_0_0_1_0, 0), (self.blocks_add_xx_0_0_0_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.digital_map_bb_0_0, 0)) self.connect((self.digital_binary_slicer_fb_0_0_0_0, 0), (self.wes_ber_0_0_0_0, 1)) self.connect((self.digital_map_bb_0_0, 0), (self.blocks_char_to_float_0_2_0_0_0, 0)) self.connect((self.digital_map_bb_0_0_0, 0), (self.blocks_char_to_float_0_2, 0)) self.connect((self.digital_map_bb_0_0_1_1_0, 0), (self.blocks_char_to_float_0_2_0_0_0_0_1_0, 0)) self.connect((self.fec_extended_decoder_0_1, 0), (self.wes_ber_0_0, 1)) self.connect((self.fec_extended_encoder_1_0, 0), (self.digital_map_bb_0_0_0, 0)) self.connect((self.wes_ber_0_0, 0), (self.qtgui_number_sink_0_0, 0)) self.connect((self.wes_ber_0_0, 1), (self.qtgui_number_sink_0_0, 1)) self.connect((self.wes_ber_0_0_0_0, 0), (self.qtgui_number_sink_0_0_0_0, 0)) self.connect((self.wes_ber_0_0_0_0, 1), (self.qtgui_number_sink_0_0_0_0, 1))
def __init__(self, frame_size=60, puncpat='11'): gr.top_block.__init__(self, "Fecapi Ldpc Encoders") Qt.QWidget.__init__(self) self.setWindowTitle("Fecapi Ldpc Encoders") qtgui.util.check_set_qss() try: self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) except: pass self.top_scroll_layout = Qt.QVBoxLayout() self.setLayout(self.top_scroll_layout) self.top_scroll = Qt.QScrollArea() self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) self.top_scroll_layout.addWidget(self.top_scroll) self.top_scroll.setWidgetResizable(True) self.top_widget = Qt.QWidget() self.top_scroll.setWidget(self.top_widget) self.top_layout = Qt.QVBoxLayout(self.top_widget) self.top_grid_layout = Qt.QGridLayout() self.top_layout.addLayout(self.top_grid_layout) self.settings = Qt.QSettings("GNU Radio", "fecapi_ldpc_encoders") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Parameters ################################################## self.frame_size = frame_size self.puncpat = puncpat ################################################## # Variables ################################################## self.H = H = fec.ldpc_H_matrix( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist", 2) self.G = G = fec.ldpc_G_matrix(gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0058_gen_matrix.alist") self.samp_rate = samp_rate = 50000 self.ldpc_enc_H = ldpc_enc_H = fec.ldpc_par_mtrx_encoder_make_H(H) self.ldpc_enc_G = ldpc_enc_G = fec.ldpc_gen_mtrx_encoder_make(G) self.ldpc_enc = ldpc_enc = fec.ldpc_encoder_make( gr.prefix() + "/share/gnuradio/fec/ldpc/" + "n_0100_k_0042_gap_02.alist") self.H_0 = H_0 = fec.ldpc_H_matrix( '/home/mbkitine/Dropbox/Lulea/GRC/DeepSpace/gr-ccsds/examples/LDPC/sim_matlab/AR4JA/python/AR4JA_r45_k1024n.a', 3) ################################################## # Blocks ################################################## self.qtgui_time_sink_x_0_0_1 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate '', #name 1 #number of inputs ) self.qtgui_time_sink_x_0_0_1.set_update_time(0.05) self.qtgui_time_sink_x_0_0_1.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0_0_1.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0_0_1.enable_tags(-1, True) self.qtgui_time_sink_x_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, 'packet_len') self.qtgui_time_sink_x_0_0_1.enable_autoscale(False) self.qtgui_time_sink_x_0_0_1.enable_grid(False) self.qtgui_time_sink_x_0_0_1.enable_axis_labels(True) self.qtgui_time_sink_x_0_0_1.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0_0_1.disable_legend() labels = ['LDPC (G)', 'CC', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 0.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(1): if len(labels[i]) == 0: self.qtgui_time_sink_x_0_0_1.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0_0_1.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0_0_1.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0_0_1.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0_0_1.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0_0_1.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0_0_1.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_0_1_win = sip.wrapinstance( self.qtgui_time_sink_x_0_0_1.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_1_win) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 2048, #size samp_rate, #samp_rate '', #name 2 #number of inputs ) self.qtgui_time_sink_x_0.set_update_time(0.05) self.qtgui_time_sink_x_0.set_y_axis(-0.5, 1.5) self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") self.qtgui_time_sink_x_0.enable_tags(-1, True) self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") self.qtgui_time_sink_x_0.enable_autoscale(False) self.qtgui_time_sink_x_0.enable_grid(False) self.qtgui_time_sink_x_0.enable_axis_labels(True) self.qtgui_time_sink_x_0.enable_control_panel(False) if not True: self.qtgui_time_sink_x_0.disable_legend() labels = ['LDPC (alist)', 'LDPC (H)', '', '', '', '', '', '', '', ''] widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] colors = [ "blue", "red", "green", "black", "cyan", "magenta", "yellow", "dark red", "dark green", "blue" ] styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1] alphas = [1.0, 0.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] for i in xrange(2): if len(labels[i]) == 0: self.qtgui_time_sink_x_0.set_line_label( i, "Data {0}".format(i)) else: self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) self._qtgui_time_sink_x_0_win = sip.wrapinstance( self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) self.fec_extended_encoder_1 = fec.extended_encoder( encoder_obj_list=ldpc_enc_H, threading=None, puncpat=puncpat) self.fec_extended_encoder_0_0_0 = fec.extended_encoder( encoder_obj_list=ldpc_enc, threading=None, puncpat=puncpat) self.fec_extended_encoder_0 = fec.extended_encoder( encoder_obj_list=ldpc_enc_G, threading=None, puncpat=puncpat) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate, True) self.blocks_char_to_float_1_0_0 = blocks.char_to_float(1, 1) self.blocks_char_to_float_1 = blocks.char_to_float(1, 1) self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.analog_random_source_x_0 = blocks.vector_source_b( map(int, numpy.random.randint(0, 256, 1000)), True) ################################################## # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_char_to_float_1, 0), (self.qtgui_time_sink_x_0_0_1, 0)) self.connect((self.blocks_char_to_float_1_0_0, 0), (self.qtgui_time_sink_x_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_unpack_k_bits_bb_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0_0_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_1, 0)) self.connect((self.fec_extended_encoder_0, 0), (self.blocks_char_to_float_1, 0)) self.connect((self.fec_extended_encoder_0_0_0, 0), (self.blocks_char_to_float_1_0_0, 0)) self.connect((self.fec_extended_encoder_1, 0), (self.blocks_char_to_float_0, 0))