Example #1
0
    def __init__(self):
        gr.top_block.__init__(self)

        self.qapp = QtWidgets.QApplication(sys.argv)

        data0  = 10*[0,] + 40*[1,0] + 10*[0,]
        data0 += 10*[0,] + 40*[0,1] + 10*[0,]
        data1 = 20*[0,] + [0,0,0,1,1,1,0,0,0,0] + 70*[0,]

        # Adjust these to change the layout of the plot.
        # Can be set to fractions.
        ncols = 100.25
        nrows = 100

        fs = 200
        src0 = blocks.vector_source_f(data0, True)
        src1 = blocks.vector_source_f(data1, True)
        thr = blocks.throttle(gr.sizeof_float, 50000)
        hed = blocks.head(gr.sizeof_float, 10000000)
        self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [],
                                             "Float Time Raster Example", 2, None)

        self.connect(src0, thr, (self.snk1, 0))
        self.connect(src1, (self.snk1, 1))

        # Get the reference pointer to the SpectrumDisplayForm QWidget
        pyQt = self.snk1.qwidget()

        # Wrap the pointer as a PyQt SIP object
        # This can now be manipulated as a PyQt5.QtWidgets.QWidget
        pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget)

        self.main_box = dialog_box(pyWin)
        self.main_box.show()
    def __init__(self):
        gr.top_block.__init__(self)

        self.qapp = QtGui.QApplication(sys.argv)

        data0  = 10*[0,] + 40*[1,0] + 10*[0,]
        data0 += 10*[0,] + 40*[0,1] + 10*[0,]
        data1 = 20*[0,] + [0,0,0,1,1,1,0,0,0,0] + 70*[0,]

        # Adjust these to change the layout of the plot.
        # Can be set to fractions.
        ncols = 100.25
        nrows = 100

        fs = 200
        src0 = blocks.vector_source_f(data0, True)
        src1 = blocks.vector_source_f(data1, True)
        thr = blocks.throttle(gr.sizeof_float, 50000)
        hed = blocks.head(gr.sizeof_float, 10000000)
        self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [],
                                             "Float Time Raster Example", 2)

        self.connect(src0, thr, (self.snk1, 0))
        self.connect(src1, (self.snk1, 1))

        # Get the reference pointer to the SpectrumDisplayForm QWidget
        pyQt = self.snk1.pyqwidget()

        # Wrap the pointer as a PyQt SIP object
        # This can now be manipulated as a PyQt4.QtGui.QWidget
        pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)

        self.main_box = dialog_box(pyWin)
        self.main_box.show()
    def __init__(self, parameter_0=149):
        gr.top_block.__init__(self, "Radar Data Client")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Radar Data Client")
        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", "Radar_Data_Client")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Parameters
        ##################################################
        self.parameter_0 = parameter_0

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1500000
        self.blocks_per_tag = blocks_per_tag = 2**17
        self.samp_per_freq = samp_per_freq = 1
        self.freq_res = freq_res = samp_rate/2/blocks_per_tag
        self.delta_freq = delta_freq = samp_rate/4
        self.center_freq = center_freq = 1000000000
        self.C = C = 299792458
        self.v_res = v_res = freq_res*3e8/2/center_freq
        self.samp_discard = samp_discard = 0
        self.min_output_buffer = min_output_buffer = 2*(blocks_per_tag*samp_per_freq*2)
        self.lo = lo = 2033000000
        self.fft_size = fft_size = 512
        self.decimator_fac = decimator_fac = 2**7
        self.decim = decim = 512
        self.WL = WL = C/samp_rate
        self.R_max = R_max = 3e8/2/delta_freq

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	fft_size, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate/decim, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
          self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_raster_sink_x_0_0 = qtgui.time_raster_sink_f(
        	samp_rate,
        	64,
        	fft_size,
        	([]),
        	([]),
        	"Mag",
        	1,
        	)

        self.qtgui_time_raster_sink_x_0_0.set_update_time(0.01)
        self.qtgui_time_raster_sink_x_0_0.set_intensity_range(-1, 1)
        self.qtgui_time_raster_sink_x_0_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0_0.enable_axis_labels(True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_raster_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_0_win)
        self.fft_vxx_0_0_0_1 = fft.fft_vcc(fft_size, False, (window.blackmanharris(fft_size)), False, 8)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_size)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex*1, 'localhost', 3333, 1472, True)
        self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, 'c:\\kandar\\RadarData\\radar.bin', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(fft_size)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0_0, 0), (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1, 0), (self.fft_vxx_0_0_0_1, 0))
        self.connect((self.blocks_udp_source_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_udp_source_0, 0), (self.blocks_stream_to_vector_0_1, 0))
        self.connect((self.blocks_udp_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0, 0), (self.qtgui_time_raster_sink_x_0_0, 0))
        self.connect((self.fft_vxx_0_0_0_1, 0), (self.blocks_complex_to_mag_0_0, 0))
Example #4
0
 def test11(self):
     self.qtsnk = qtgui.time_raster_sink_f(1024, 100, 100.5, [], [], "Test",
                                           1, None)
Example #5
0
 def get_qtsink(self):
     snk = qtgui.time_raster_sink_f(1.0, self._npts, self._rows,
                                    [], [], self._name,
                                    self._ncons)
     return snk
Example #6
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        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", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.factor_of_baud = factor_of_baud = 8
        self.baud_rate = baud_rate = 4160
        self.signal_gain = signal_gain = 5
        self.samp_rate = samp_rate = 11025
        self.demod_rate = demod_rate = baud_rate * factor_of_baud

        ##################################################
        # Blocks
        ##################################################
        self._signal_gain_range = Range(0, 800, 1, 5, 200)
        self._signal_gain_win = RangeWidget(self._signal_gain_range, self.set_signal_gain, "Signal Gain", "counter_slider", float)
        self.top_layout.addWidget(self._signal_gain_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	baud_rate / 2, #size
        	baud_rate, #samp_rate
        	'APT Full Line', #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-0.5, 0.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.01, 0, 'SyncA')
        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_control_panel(False)
        
        if not False:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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, 1.0, 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.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.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
        	baud_rate,
        	128,
        	int(baud_rate / 2),
        	([]),
        	([]),
        	"",
        	1,
        	)
        
        self.qtgui_time_raster_sink_x_0.set_update_time(0.5)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(-0.5, 0.75)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [1, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_raster_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_win)
        self.fm_demodulated_source = blocks.wavfile_source("/home/brian/stem_station/sample_files/N18_4827.wav", False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_float*1, "/home/brian/stem_station/raw_meta1.dat", baud_rate, 1, blocks.GR_FILE_FLOAT, False, baud_rate * (60 * 20), "", True)
        self.blocks_file_meta_sink_0.set_unbuffered(False)
        self.apt_am_demod_0 = apt_am_demod(
            parameter_apt_gain=signal_gain,
            parameter_samp_rate=samp_rate,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.apt_am_demod_0, 0), (self.blocks_file_meta_sink_0, 0))    
        self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_raster_sink_x_0, 0))    
        self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.apt_am_demod_0, 0))    
        self.connect((self.fm_demodulated_source, 0), (self.blocks_throttle_0, 0))    
    def __init__(self):
        gr.top_block.__init__(self, "twodimension_simulation")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("twodimension_simulation")
        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", "twodimension_simulation")

        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

        ##################################################
        # Variables
        ##################################################
        self.maxtheta = maxtheta = 120
        self.columns = columns = 100
        self.shiftarrL = shiftarrL = np.radians(
            np.linspace(start=maxtheta,
                        stop=0,
                        num=int(columns / 2),
                        endpoint=False))
        self.left = left = np.pad(shiftarrL, (0, int(columns / 2)), 'constant')
        self.right = right = np.flip(left, axis=0)
        self.degreesTXT = degreesTXT = 0
        self.degreesTXR = degreesTXR = 0
        self.degreesTXL = degreesTXL = 0
        self.degreesTXB = degreesTXB = 0
        self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = left
        self.variable_qtgui_label_0 = variable_qtgui_label_0 = right
        self.scale = scale = 15
        self.samp_rate = samp_rate = 32000
        self.keep = keep = 32
        self.displayscale = displayscale = 8
        self.angle_radiansStartT = angle_radiansStartT = (math.pi /
                                                          180) * degreesTXT
        self.angle_radiansStartR = angle_radiansStartR = (math.pi /
                                                          180) * degreesTXR
        self.angle_radiansStartL = angle_radiansStartL = (math.pi /
                                                          180) * degreesTXL
        self.angle_radiansStartB = angle_radiansStartB = (math.pi /
                                                          180) * degreesTXB

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Time rasters')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Steering vectors')
        self.top_grid_layout.addWidget(self.tab)
        self._scale_range = Range(0, 100, 5, 15, 200)
        self._scale_win = RangeWidget(self._scale_range, self.set_scale,
                                      'scale', "counter_slider", float)
        self.top_grid_layout.addWidget(self._scale_win)
        self.video_sdl_sink_1_1_0 = video_sdl.sink_s(0, columns, columns, 0,
                                                     columns * displayscale,
                                                     columns * displayscale)
        self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_formatter = lambda x: repr(x)

        self._variable_qtgui_label_0_0_tool_bar.addWidget(
            Qt.QLabel('Left' + ": "))
        self._variable_qtgui_label_0_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_0_formatter(
                    self.variable_qtgui_label_0_0)))
        self._variable_qtgui_label_0_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_0_label)
        self.tab_layout_1.addWidget(self._variable_qtgui_label_0_0_tool_bar)
        self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_formatter = None
        else:
            self._variable_qtgui_label_0_formatter = lambda x: repr(x)

        self._variable_qtgui_label_0_tool_bar.addWidget(
            Qt.QLabel('Right' + ": "))
        self._variable_qtgui_label_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_formatter(
                    self.variable_qtgui_label_0)))
        self._variable_qtgui_label_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_label)
        self.tab_layout_1.addWidget(self._variable_qtgui_label_0_tool_bar)
        self.qtgui_time_raster_sink_x_0_0 = qtgui.time_raster_sink_f(
            samp_rate / keep, columns, columns, [], [], "Elevation", 1)

        self.qtgui_time_raster_sink_x_0_0.set_update_time(0.01)
        self.qtgui_time_raster_sink_x_0_0.set_intensity_range(0, 5)
        self.qtgui_time_raster_sink_x_0_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_raster_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_raster_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_0_win)
        self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
            samp_rate / keep, columns, columns, [], [], "Azimuth", 1)

        self.qtgui_time_raster_sink_x_0.set_update_time(0.01)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(0, 5)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_raster_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_win)
        self._degreesTXT_range = Range(0, maxtheta, 5, 0, 200)
        self._degreesTXT_win = RangeWidget(self._degreesTXT_range,
                                           self.set_degreesTXT, 'degreesTXT',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._degreesTXT_win)
        self._degreesTXR_range = Range(0, maxtheta, 5, 0, 200)
        self._degreesTXR_win = RangeWidget(self._degreesTXR_range,
                                           self.set_degreesTXR, 'degreesTXR',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._degreesTXR_win)
        self._degreesTXL_range = Range(0, maxtheta, 5, 0, 200)
        self._degreesTXL_win = RangeWidget(self._degreesTXL_range,
                                           self.set_degreesTXL, 'degreesTXL',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._degreesTXL_win)
        self._degreesTXB_range = Range(0, maxtheta, 5, 0, 200)
        self._degreesTXB_win = RangeWidget(self._degreesTXB_range,
                                           self.set_degreesTXB, 'degreesTXB',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._degreesTXB_win)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, columns)
        self.blocks_vector_source_x_0_0_0_1 = blocks.vector_source_f(
            left, True, 1, [])
        self.blocks_vector_source_x_0_0_0_0_0 = blocks.vector_source_f(
            right, True, 1, [])
        self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_f(
            right, True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(
            left, True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_sub_xx_0_0_1 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0 = blocks.sub_ff(1)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, columns)
        self.blocks_repeat_0_0_0_0_2 = blocks.repeat(gr.sizeof_float * 1,
                                                     columns)
        self.blocks_repeat_0_0_0_0_1_0 = blocks.repeat(gr.sizeof_float * 1,
                                                       columns)
        self.blocks_repeat_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1,
                                                     columns)
        self.blocks_repeat_0_0_0_0_0_1_0 = blocks.repeat(
            gr.sizeof_float * 1, columns)
        self.blocks_repeat_0_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1,
                                                       columns)
        self.blocks_repeat_0_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1,
                                                       columns)
        self.blocks_repeat_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1,
                                                     columns)
        self.blocks_repeat_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1,
                                                   columns)
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex * columns,
                                               columns)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, columns)
        self.blocks_multiply_const_vxx_0_0_1_0 = blocks.multiply_const_cc(
            complex(math.cos(angle_radiansStartT),
                    math.sin(angle_radiansStartT)))
        self.blocks_multiply_const_vxx_0_0_1 = blocks.multiply_const_cc(
            complex(math.cos(angle_radiansStartR),
                    math.sin(angle_radiansStartR)))
        self.blocks_multiply_const_vxx_0_0_0_0_0 = blocks.multiply_const_cc(
            complex(math.cos(angle_radiansStartB),
                    math.sin(angle_radiansStartB)))
        self.blocks_multiply_const_vxx_0_0_0_0 = blocks.multiply_const_cc(
            complex(math.cos(angle_radiansStartL),
                    math.sin(angle_radiansStartL)))
        self.blocks_magphase_to_complex_0_0_0_0_1 = blocks.magphase_to_complex(
            1)
        self.blocks_magphase_to_complex_0_0_0_0_0_0 = blocks.magphase_to_complex(
            1)
        self.blocks_magphase_to_complex_0_0_0_0_0 = blocks.magphase_to_complex(
            1)
        self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1)
        self.blocks_keep_one_in_n_0_2 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_keep_one_in_n_0_1 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_float_to_short_0_1_0 = blocks.float_to_short(1, scale)
        self.blocks_complex_to_magphase_0_0_0_1 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_magphase_0_0_0_0_0 = blocks.complex_to_magphase(
            1)
        self.blocks_complex_to_magphase_0_0_0_0 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_magphase_0_0_0 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_mag_squared_0_1_0 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 400, 1, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.blocks_complex_to_mag_squared_0_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.blocks_complex_to_mag_squared_0_1_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.qtgui_time_raster_sink_x_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_0, 0),
                     (self.qtgui_time_raster_sink_x_0_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_1_0, 0),
                     (self.blocks_float_to_short_0_1_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0, 0),
                     (self.blocks_repeat_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0, 1),
                     (self.blocks_repeat_0_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0, 1),
                     (self.blocks_repeat_0_0_0_0_0_1, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0, 0),
                     (self.blocks_repeat_0_0_0_0_1, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 1),
                     (self.blocks_repeat_0_0_0_0_0_1_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 0),
                     (self.blocks_repeat_0_0_0_0_1_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_1, 1),
                     (self.blocks_repeat_0_0_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_1, 0),
                     (self.blocks_repeat_0_0_0_0_2, 0))
        self.connect((self.blocks_float_to_short_0_1_0, 0),
                     (self.video_sdl_sink_1_1_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_1, 0))
        self.connect((self.blocks_keep_one_in_n_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0_0, 0))
        self.connect((self.blocks_keep_one_in_n_0_1, 0),
                     (self.blocks_multiply_const_vxx_0_0_1_0, 0))
        self.connect((self.blocks_keep_one_in_n_0_2, 0),
                     (self.blocks_multiply_const_vxx_0_0_0_0_0, 0))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_0_0, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_1, 0),
                     (self.blocks_add_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0_0, 0),
                     (self.blocks_complex_to_magphase_0_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0_0_0, 0),
                     (self.blocks_complex_to_magphase_0_0_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_1, 0),
                     (self.blocks_complex_to_magphase_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_1_0, 0),
                     (self.blocks_complex_to_magphase_0_0_0_1, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_1, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_1, 0),
                     (self.blocks_sub_xx_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_1_0, 0),
                     (self.blocks_sub_xx_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_1, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_1_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_2, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_1, 0))
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.blocks_sub_xx_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_1, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_1, 1))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_keep_one_in_n_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_keep_one_in_n_0_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_keep_one_in_n_0_2, 0))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_sub_xx_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_1, 0),
                     (self.blocks_sub_xx_0_0_1, 1))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_add_xx_1, 0))
Example #8
0
    def __init__(self):
        gr.top_block.__init__(self, "NOAA APT Satellite Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NOAA APT Satellite Receiver")
        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", "apt_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        self._lock = threading.RLock()

        ##################################################
        # Variables
        ##################################################
        self.satellite_select = satellite_select = 137.62
        self.valid_gains = valid_gains = [
            0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7,
            20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2,
            42.1, 43.4, 43.9, 44.5, 48.0, 49.6
        ]
        self.satellite_frequency = satellite_frequency = satellite_select * 1e6
        self.rf_samp_rate = rf_samp_rate = 2.048e6
        self.max_doppler = max_doppler = 3000
        self.fsk_deviation_hz = fsk_deviation_hz = 17000
        self.am_carrier = am_carrier = 2400
        self.tuner_frequency = tuner_frequency = satellite_frequency - (
            rf_samp_rate / 4)
        self.rf_gain = rf_gain = valid_gains[-1]
        self.rail_level = rail_level = 0.5
        self.processing_rate = processing_rate = 256000
        self.fm_bandwidth = fm_bandwidth = (
            2 * (fsk_deviation_hz + am_carrier)) + max_doppler
        self.baud_rate = baud_rate = 4160

        ##################################################
        # Blocks
        ##################################################
        self.tabs_top = Qt.QTabWidget()
        self.tabs_top_widget_0 = Qt.QWidget()
        self.tabs_top_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tabs_top_widget_0)
        self.tabs_top_grid_layout_0 = Qt.QGridLayout()
        self.tabs_top_layout_0.addLayout(self.tabs_top_grid_layout_0)
        self.tabs_top.addTab(self.tabs_top_widget_0, "RF Recieve")
        self.tabs_top_widget_1 = Qt.QWidget()
        self.tabs_top_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tabs_top_widget_1)
        self.tabs_top_grid_layout_1 = Qt.QGridLayout()
        self.tabs_top_layout_1.addLayout(self.tabs_top_grid_layout_1)
        self.tabs_top.addTab(self.tabs_top_widget_1, "APT Signal")
        self.tabs_top_widget_2 = Qt.QWidget()
        self.tabs_top_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.tabs_top_widget_2)
        self.tabs_top_grid_layout_2 = Qt.QGridLayout()
        self.tabs_top_layout_2.addLayout(self.tabs_top_grid_layout_2)
        self.tabs_top.addTab(self.tabs_top_widget_2, "APT Baseband")
        self.top_grid_layout.addWidget(self.tabs_top, 2, 0, 1, 4)
        self.tabs_rf = Qt.QTabWidget()
        self.tabs_rf_widget_0 = Qt.QWidget()
        self.tabs_rf_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabs_rf_widget_0)
        self.tabs_rf_grid_layout_0 = Qt.QGridLayout()
        self.tabs_rf_layout_0.addLayout(self.tabs_rf_grid_layout_0)
        self.tabs_rf.addTab(self.tabs_rf_widget_0, "Spectrum")
        self.tabs_rf_widget_1 = Qt.QWidget()
        self.tabs_rf_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabs_rf_widget_1)
        self.tabs_rf_grid_layout_1 = Qt.QGridLayout()
        self.tabs_rf_layout_1.addLayout(self.tabs_rf_grid_layout_1)
        self.tabs_rf.addTab(self.tabs_rf_widget_1, "Waterfall")
        self.tabs_rf_widget_2 = Qt.QWidget()
        self.tabs_rf_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabs_rf_widget_2)
        self.tabs_rf_grid_layout_2 = Qt.QGridLayout()
        self.tabs_rf_layout_2.addLayout(self.tabs_rf_grid_layout_2)
        self.tabs_rf.addTab(self.tabs_rf_widget_2, "Scope")
        self.tabs_top_layout_0.addWidget(self.tabs_rf)
        self.tabs_apt_data = Qt.QTabWidget()
        self.tabs_apt_data_widget_0 = Qt.QWidget()
        self.tabs_apt_data_layout_0 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_0)
        self.tabs_apt_data_grid_layout_0 = Qt.QGridLayout()
        self.tabs_apt_data_layout_0.addLayout(self.tabs_apt_data_grid_layout_0)
        self.tabs_apt_data.addTab(self.tabs_apt_data_widget_0, "Scope")
        self.tabs_apt_data_widget_1 = Qt.QWidget()
        self.tabs_apt_data_layout_1 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_1)
        self.tabs_apt_data_grid_layout_1 = Qt.QGridLayout()
        self.tabs_apt_data_layout_1.addLayout(self.tabs_apt_data_grid_layout_1)
        self.tabs_apt_data.addTab(self.tabs_apt_data_widget_1, "Raster")
        self.tabs_top_layout_1.addWidget(self.tabs_apt_data)
        self._satellite_select_options = [137.62, 137.9125, 137.1]
        self._satellite_select_labels = [
            'NOAA 15 (137.62 MHz)', 'NOAA 18 (137.9125 MHz)',
            'NOAA 19 (137.1 MHz)'
        ]
        self._satellite_select_tool_bar = Qt.QToolBar(self)
        self._satellite_select_tool_bar.addWidget(
            Qt.QLabel("Satellite Select" + ": "))
        self._satellite_select_combo_box = Qt.QComboBox()
        self._satellite_select_tool_bar.addWidget(
            self._satellite_select_combo_box)
        for label in self._satellite_select_labels:
            self._satellite_select_combo_box.addItem(label)
        self._satellite_select_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._satellite_select_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._satellite_select_options.index(i)))
        self._satellite_select_callback(self.satellite_select)
        self._satellite_select_combo_box.currentIndexChanged.connect(
            lambda i: self.set_satellite_select(self._satellite_select_options[
                i]))
        self.top_grid_layout.addWidget(self._satellite_select_tool_bar, 0, 0,
                                       1, 1)
        self._rf_gain_options = valid_gains
        self._rf_gain_labels = map(str, self._rf_gain_options)
        self._rf_gain_tool_bar = Qt.QToolBar(self)
        self._rf_gain_tool_bar.addWidget(Qt.QLabel("RF Gain" + ": "))
        self._rf_gain_combo_box = Qt.QComboBox()
        self._rf_gain_tool_bar.addWidget(self._rf_gain_combo_box)
        for label in self._rf_gain_labels:
            self._rf_gain_combo_box.addItem(label)
        self._rf_gain_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._rf_gain_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._rf_gain_options.index(i)))
        self._rf_gain_callback(self.rf_gain)
        self._rf_gain_combo_box.currentIndexChanged.connect(
            lambda i: self.set_rf_gain(self._rf_gain_options[i]))
        self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 1, 1, 1)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            satellite_frequency,  #fc
            processing_rate // 2,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.50)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)

        if not False:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-40, 0)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_rf_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            baud_rate / 2,  #size
            baud_rate,  #samp_rate
            'APT Full Line',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-0.5, 1.5)

        self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0.01, 0, 'SyncA')
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)

        if not False:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        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, 1.0, 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.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tabs_apt_data_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024,  #size
            processing_rate // 2,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        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_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        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, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            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.tabs_rf_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
            baud_rate,
            120 * 3,
            baud_rate // 2,
            ([]),
            ([]),
            "",
            1,
        )

        self.qtgui_time_raster_sink_x_0.set_update_time(0.10)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(-0.5, 1.5)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)

        labels = ["", "", "", "", "", "", "", "", "", ""]
        colors = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_raster_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_apt_data_layout_1.addWidget(
            self._qtgui_time_raster_sink_x_0_win)
        self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            16.64e3,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_1_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_1_0.set_y_axis(-40, 0)
        self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_1_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_1_0.enable_grid(False)
        self.qtgui_freq_sink_x_1_0.set_fft_average(0.2)
        self.qtgui_freq_sink_x_1_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True)

        labels = ["Raw", "AGC Output", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 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_freq_sink_x_1_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.tabs_top_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            satellite_frequency,  #fc
            processing_rate // 2,  #bw
            "",  #name
            2  #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-100, 0)
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(0.2)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_1.set_plot_pos_half(not True)

        labels = ["Raw", "AGC Output", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 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_freq_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tabs_rf_layout_0.addWidget(self._qtgui_freq_sink_x_1_win)
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, processing_rate // 2, fm_bandwidth + 1e3, 1e3,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            2,
            firdes.low_pass(1, processing_rate, 60e3, 15e3, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 processing_rate, True)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/Users/bjmclaug/Downloads/noaa-12_256k.dat", False)
        self.blocks_file_meta_sink_0 = blocks.file_meta_sink(
            gr.sizeof_float * 1,
            "/Users/bjmclaug/source/stem_station/noaa12_sample.dat", baud_rate,
            1, blocks.GR_FILE_FLOAT, False, baud_rate * (60 * 20), "", True)
        self.blocks_file_meta_sink_0.set_unbuffered(False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.apt_am_demod_0 = apt_am_demod(
            parameter_apt_gain=1,
            parameter_samp_rate=processing_rate / 2,
        )
        self.analog_rail_ff_0_0 = analog.rail_ff(-rail_level, rail_level)
        self.analog_rail_ff_0 = analog.rail_ff(-rail_level, rail_level)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            (processing_rate // 2) / (2 * math.pi * fsk_deviation_hz / 8.0))
        self.analog_agc3_xx_0 = analog.agc3_cc(0.25, 0.5, 0.9, 1.0, 1)
        self.analog_agc3_xx_0.set_max_gain(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc3_xx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.apt_am_demod_0, 0))
        self.connect((self.analog_rail_ff_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_rail_ff_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.apt_am_demod_0, 0),
                     (self.blocks_file_meta_sink_0, 0))
        self.connect((self.apt_am_demod_0, 0),
                     (self.qtgui_time_raster_sink_x_0, 0))
        self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.analog_rail_ff_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.analog_rail_ff_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_agc3_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.qtgui_freq_sink_x_1, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
Example #9
0
    def __init__(self):
        gr.top_block.__init__(self, "NOAA APT Satellite Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NOAA APT Satellite Receiver")
        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", "apt_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        self._lock = threading.RLock()

        ##################################################
        # Variables
        ##################################################
        self.satellite_select = satellite_select = 137.62
        self.valid_gains = valid_gains = [0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6]
        self.satellite_frequency = satellite_frequency = satellite_select * 1e6
        self.rf_samp_rate = rf_samp_rate = 2.048e6
        self.max_doppler = max_doppler = 3000
        self.fsk_deviation_hz = fsk_deviation_hz = 17000
        self.am_carrier = am_carrier = 2400
        self.tuner_frequency = tuner_frequency = satellite_frequency - (rf_samp_rate / 4)
        self.rf_gain = rf_gain = valid_gains[-1]
        self.rail_level = rail_level = 0.5
        self.processing_rate = processing_rate = 256000
        self.fm_bandwidth = fm_bandwidth = (2 * (fsk_deviation_hz + am_carrier)) + max_doppler
        self.baud_rate = baud_rate = 4160

        ##################################################
        # Blocks
        ##################################################
        self.tabs_top = Qt.QTabWidget()
        self.tabs_top_widget_0 = Qt.QWidget()
        self.tabs_top_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_0)
        self.tabs_top_grid_layout_0 = Qt.QGridLayout()
        self.tabs_top_layout_0.addLayout(self.tabs_top_grid_layout_0)
        self.tabs_top.addTab(self.tabs_top_widget_0, "RF Recieve")
        self.tabs_top_widget_1 = Qt.QWidget()
        self.tabs_top_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_1)
        self.tabs_top_grid_layout_1 = Qt.QGridLayout()
        self.tabs_top_layout_1.addLayout(self.tabs_top_grid_layout_1)
        self.tabs_top.addTab(self.tabs_top_widget_1, "APT Signal")
        self.tabs_top_widget_2 = Qt.QWidget()
        self.tabs_top_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_top_widget_2)
        self.tabs_top_grid_layout_2 = Qt.QGridLayout()
        self.tabs_top_layout_2.addLayout(self.tabs_top_grid_layout_2)
        self.tabs_top.addTab(self.tabs_top_widget_2, "APT Baseband")
        self.top_grid_layout.addWidget(self.tabs_top, 2, 0, 1, 4)
        self.tabs_rf = Qt.QTabWidget()
        self.tabs_rf_widget_0 = Qt.QWidget()
        self.tabs_rf_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_0)
        self.tabs_rf_grid_layout_0 = Qt.QGridLayout()
        self.tabs_rf_layout_0.addLayout(self.tabs_rf_grid_layout_0)
        self.tabs_rf.addTab(self.tabs_rf_widget_0, "Spectrum")
        self.tabs_rf_widget_1 = Qt.QWidget()
        self.tabs_rf_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_1)
        self.tabs_rf_grid_layout_1 = Qt.QGridLayout()
        self.tabs_rf_layout_1.addLayout(self.tabs_rf_grid_layout_1)
        self.tabs_rf.addTab(self.tabs_rf_widget_1, "Waterfall")
        self.tabs_rf_widget_2 = Qt.QWidget()
        self.tabs_rf_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_rf_widget_2)
        self.tabs_rf_grid_layout_2 = Qt.QGridLayout()
        self.tabs_rf_layout_2.addLayout(self.tabs_rf_grid_layout_2)
        self.tabs_rf.addTab(self.tabs_rf_widget_2, "Scope")
        self.tabs_top_layout_0.addWidget(self.tabs_rf)
        self.tabs_apt_data = Qt.QTabWidget()
        self.tabs_apt_data_widget_0 = Qt.QWidget()
        self.tabs_apt_data_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_0)
        self.tabs_apt_data_grid_layout_0 = Qt.QGridLayout()
        self.tabs_apt_data_layout_0.addLayout(self.tabs_apt_data_grid_layout_0)
        self.tabs_apt_data.addTab(self.tabs_apt_data_widget_0, "Scope")
        self.tabs_apt_data_widget_1 = Qt.QWidget()
        self.tabs_apt_data_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabs_apt_data_widget_1)
        self.tabs_apt_data_grid_layout_1 = Qt.QGridLayout()
        self.tabs_apt_data_layout_1.addLayout(self.tabs_apt_data_grid_layout_1)
        self.tabs_apt_data.addTab(self.tabs_apt_data_widget_1, "Raster")
        self.tabs_top_layout_1.addWidget(self.tabs_apt_data)
        self._satellite_select_options = [137.62, 137.9125, 137.1]
        self._satellite_select_labels = ['NOAA 15 (137.62 MHz)', 'NOAA 18 (137.9125 MHz)', 'NOAA 19 (137.1 MHz)']
        self._satellite_select_tool_bar = Qt.QToolBar(self)
        self._satellite_select_tool_bar.addWidget(Qt.QLabel("Satellite Select"+": "))
        self._satellite_select_combo_box = Qt.QComboBox()
        self._satellite_select_tool_bar.addWidget(self._satellite_select_combo_box)
        for label in self._satellite_select_labels: self._satellite_select_combo_box.addItem(label)
        self._satellite_select_callback = lambda i: Qt.QMetaObject.invokeMethod(self._satellite_select_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._satellite_select_options.index(i)))
        self._satellite_select_callback(self.satellite_select)
        self._satellite_select_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_satellite_select(self._satellite_select_options[i]))
        self.top_grid_layout.addWidget(self._satellite_select_tool_bar, 0, 0, 1, 1)
        self._rf_gain_options = valid_gains
        self._rf_gain_labels = map(str, self._rf_gain_options)
        self._rf_gain_tool_bar = Qt.QToolBar(self)
        self._rf_gain_tool_bar.addWidget(Qt.QLabel("RF Gain"+": "))
        self._rf_gain_combo_box = Qt.QComboBox()
        self._rf_gain_tool_bar.addWidget(self._rf_gain_combo_box)
        for label in self._rf_gain_labels: self._rf_gain_combo_box.addItem(label)
        self._rf_gain_callback = lambda i: Qt.QMetaObject.invokeMethod(self._rf_gain_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rf_gain_options.index(i)))
        self._rf_gain_callback(self.rf_gain)
        self._rf_gain_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_rf_gain(self._rf_gain_options[i]))
        self.top_grid_layout.addWidget(self._rf_gain_tool_bar, 0, 1 , 1, 1)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	satellite_frequency, #fc
        	processing_rate // 2, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.50)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        
        if not False:
          self.qtgui_waterfall_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_x_0.set_intensity_range(-40, 0)
        
        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_rf_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	baud_rate / 2, #size
        	baud_rate, #samp_rate
        	'APT Full Line', #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-0.5, 1.5)
        
        self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0.01, 0, 'SyncA')
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_time_sink_x_0_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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, 1.0, 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.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tabs_apt_data_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
        	1024, #size
        	processing_rate // 2, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
        
        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_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2*1):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            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.tabs_rf_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
        	baud_rate,
        	120*3,
        	baud_rate // 2,
        	([]),
        	([]),
        	"",
        	1,
        	)
        
        self.qtgui_time_raster_sink_x_0.set_update_time(0.10)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(-0.5, 1.5)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [1, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_raster_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabs_apt_data_layout_1.addWidget(self._qtgui_time_raster_sink_x_0_win)
        self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	16.64e3, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_1_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_1_0.set_y_axis(-40, 0)
        self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_1_0.enable_grid(False)
        self.qtgui_freq_sink_x_1_0.set_fft_average(0.2)
        self.qtgui_freq_sink_x_1_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_1_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_1_0.set_plot_pos_half(not True)
        
        labels = ["Raw", "AGC Output", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 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_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.tabs_top_layout_2.addWidget(self._qtgui_freq_sink_x_1_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	satellite_frequency, #fc
        	processing_rate // 2, #bw
        	"", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-100, 0)
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(0.2)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_1.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_1.set_plot_pos_half(not True)
        
        labels = ["Raw", "AGC Output", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 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_freq_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tabs_rf_layout_0.addWidget(self._qtgui_freq_sink_x_1_win)
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, processing_rate // 2, fm_bandwidth + 1e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(2, firdes.low_pass(
        	1, processing_rate, 60e3, 15e3, firdes.WIN_HAMMING, 6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, processing_rate,True)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/Users/bjmclaug/Downloads/noaa-12_256k.dat", False)
        self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_float*1, "/Users/bjmclaug/source/stem_station/noaa12_sample.dat", baud_rate, 1, blocks.GR_FILE_FLOAT, False, baud_rate * (60 * 20), "", True)
        self.blocks_file_meta_sink_0.set_unbuffered(False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.apt_am_demod_0 = apt_am_demod(
            parameter_apt_gain=1,
            parameter_samp_rate=processing_rate / 2,
        )
        self.analog_rail_ff_0_0 = analog.rail_ff(-rail_level, rail_level)
        self.analog_rail_ff_0 = analog.rail_ff(-rail_level, rail_level)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf((processing_rate // 2)/(2*math.pi*fsk_deviation_hz/8.0))
        self.analog_agc3_xx_0 = analog.agc3_cc(0.25, 0.5, 0.9, 1.0, 1)
        self.analog_agc3_xx_0.set_max_gain(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.apt_am_demod_0, 0))    
        self.connect((self.analog_rail_ff_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.analog_rail_ff_0_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.apt_am_demod_0, 0), (self.blocks_file_meta_sink_0, 0))    
        self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_raster_sink_x_0, 0))    
        self.connect((self.apt_am_demod_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.analog_rail_ff_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.analog_rail_ff_0_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_agc3_xx_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1, 0))    
        self.connect((self.low_pass_filter_0_0, 0), (self.analog_quadrature_demod_cf_0, 0))    
        self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_1, 1))    
        self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_waterfall_sink_x_0, 0))    
Example #10
0
 def test11(self):
     self.qtsnk = qtgui.time_raster_sink_f(1024, 100, 100.5,
                                           [], [], "Test", 1)
Example #11
0
    def __init__(self):
        gr.top_block.__init__(self, "mpsk_stage6.grc")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("mpsk_stage6.grc")
        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", "mpsk_stage6")

        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

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.timing_loop_bw = timing_loop_bw = 6.28 / 100.0
        self.time_offset = time_offset = 1.00
        self.taps = taps = [1.0, 0.25 - 0.25j, 0.50 + 0.10j, -0.3 + 0.2j]
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts)
        self.qpsk = qpsk = digital.constellation_rect(
            [0.707 + 0.707j, -0.707 + 0.707j, -0.707 - 0.707j, 0.707 - 0.707j],
            [0, 1, 2, 3], 4, 2, 2, 1, 1).base()
        self.phase_bw = phase_bw = 6.28 / 100.0
        self.noise_volt = noise_volt = 0.0001
        self.freq_offset = freq_offset = 0
        self.excess_bw = excess_bw = 0.35
        self.eq_gain = eq_gain = 0.01
        self.delay = delay = 58
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self.controls = Qt.QTabWidget()
        self.controls_widget_0 = Qt.QWidget()
        self.controls_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.controls_widget_0)
        self.controls_grid_layout_0 = Qt.QGridLayout()
        self.controls_layout_0.addLayout(self.controls_grid_layout_0)
        self.controls.addTab(self.controls_widget_0, 'Channel')
        self.controls_widget_1 = Qt.QWidget()
        self.controls_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.controls_widget_1)
        self.controls_grid_layout_1 = Qt.QGridLayout()
        self.controls_layout_1.addLayout(self.controls_grid_layout_1)
        self.controls.addTab(self.controls_widget_1, 'Receiver')
        self.top_grid_layout.addWidget(self.controls, 0, 0, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._timing_loop_bw_range = Range(0.0, 0.2, 0.01, 6.28 / 100.0, 200)
        self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range,
                                               self.set_timing_loop_bw,
                                               'Time: BW', "slider", float)
        self.controls_grid_layout_1.addWidget(self._timing_loop_bw_win, 0, 0,
                                              1, 1)
        for r in range(0, 1):
            self.controls_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.controls_grid_layout_1.setColumnStretch(c, 1)
        self._time_offset_range = Range(0.999, 1.001, 0.0001, 1.00, 200)
        self._time_offset_win = RangeWidget(self._time_offset_range,
                                            self.set_time_offset,
                                            'Timing Offset', "counter_slider",
                                            float)
        self.controls_grid_layout_0.addWidget(self._time_offset_win, 0, 2, 1,
                                              1)
        for r in range(0, 1):
            self.controls_grid_layout_0.setRowStretch(r, 1)
        for c in range(2, 3):
            self.controls_grid_layout_0.setColumnStretch(c, 1)
        self.signals = Qt.QTabWidget()
        self.signals_widget_0 = Qt.QWidget()
        self.signals_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.signals_widget_0)
        self.signals_grid_layout_0 = Qt.QGridLayout()
        self.signals_layout_0.addLayout(self.signals_grid_layout_0)
        self.signals.addTab(self.signals_widget_0, 'Bits')
        self.signals_widget_1 = Qt.QWidget()
        self.signals_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.signals_widget_1)
        self.signals_grid_layout_1 = Qt.QGridLayout()
        self.signals_layout_1.addLayout(self.signals_grid_layout_1)
        self.signals.addTab(self.signals_widget_1, 'Subtract')
        self.top_grid_layout.addWidget(self.signals, 2, 1, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.received = Qt.QTabWidget()
        self.received_widget_0 = Qt.QWidget()
        self.received_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.received_widget_0)
        self.received_grid_layout_0 = Qt.QGridLayout()
        self.received_layout_0.addLayout(self.received_grid_layout_0)
        self.received.addTab(self.received_widget_0, 'Constellation')
        self.received_widget_1 = Qt.QWidget()
        self.received_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.received_widget_1)
        self.received_grid_layout_1 = Qt.QGridLayout()
        self.received_layout_1.addLayout(self.received_grid_layout_1)
        self.received.addTab(self.received_widget_1, 'Symbols')
        self.received_widget_2 = Qt.QWidget()
        self.received_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                               self.received_widget_2)
        self.received_grid_layout_2 = Qt.QGridLayout()
        self.received_layout_2.addLayout(self.received_grid_layout_2)
        self.received.addTab(self.received_widget_2, 'Pattern')
        self.top_grid_layout.addWidget(self.received, 2, 0, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._phase_bw_range = Range(0.0, 1.0, 0.01, 6.28 / 100.0, 200)
        self._phase_bw_win = RangeWidget(self._phase_bw_range,
                                         self.set_phase_bw, 'Phase: Bandwidth',
                                         "slider", float)
        self.controls_grid_layout_1.addWidget(self._phase_bw_win, 0, 2, 1, 1)
        for r in range(0, 1):
            self.controls_grid_layout_1.setRowStretch(r, 1)
        for c in range(2, 3):
            self.controls_grid_layout_1.setColumnStretch(c, 1)
        self._noise_volt_range = Range(0, 1, 0.01, 0.0001, 200)
        self._noise_volt_win = RangeWidget(self._noise_volt_range,
                                           self.set_noise_volt,
                                           'Noise Voltage', "counter_slider",
                                           float)
        self.controls_grid_layout_0.addWidget(self._noise_volt_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.controls_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 1):
            self.controls_grid_layout_0.setColumnStretch(c, 1)
        self._freq_offset_range = Range(-0.1, 0.1, 0.001, 0, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range,
                                            self.set_freq_offset,
                                            'Frequency Offset',
                                            "counter_slider", float)
        self.controls_grid_layout_0.addWidget(self._freq_offset_win, 0, 1, 1,
                                              1)
        for r in range(0, 1):
            self.controls_grid_layout_0.setRowStretch(r, 1)
        for c in range(1, 2):
            self.controls_grid_layout_0.setColumnStretch(c, 1)
        self._eq_gain_range = Range(0.0, 0.1, 0.001, 0.01, 200)
        self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain,
                                        'Equalizer: rate', "slider", float)
        self.controls_grid_layout_1.addWidget(self._eq_gain_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.controls_grid_layout_1.setRowStretch(r, 1)
        for c in range(1, 2):
            self.controls_grid_layout_1.setColumnStretch(c, 1)
        self._delay_range = Range(0, 200, 1, 58, 200)
        self._delay_win = RangeWidget(self._delay_range, self.set_delay,
                                      'Delay', "counter_slider", float)
        self.top_grid_layout.addWidget(self._delay_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            128,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1.enable_tags(False)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        labels = [
            'Rx_Bits - Tx_Bits', 'Signal 2', 'Signal 3', 'Signal 4',
            'Signal 5', 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9',
            'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'magenta', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.signals_grid_layout_1.addWidget(self._qtgui_time_sink_x_1_win, 0,
                                             0, 1, 1)
        for r in range(0, 1):
            self.signals_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.signals_grid_layout_1.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            128,  #size
            samp_rate,  #samp_rate
            '',  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 2)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_AUTO,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        labels = ['Rx Bits', 'Tx Bits', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.signals_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win,
                                             0, 0, 1, 1)
        for r in range(0, 1):
            self.signals_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 1):
            self.signals_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            500,  #size
            samp_rate,  #samp_rate
            '',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 4)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(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)

        labels = ['Symbols', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            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.received_grid_layout_1.addWidget(self._qtgui_time_sink_x_0_win, 0,
                                              0, 1, 1)
        for r in range(0, 1):
            self.received_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.received_grid_layout_1.setColumnStretch(c, 1)
        self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
            samp_rate, 256, 256, [], [], "", 1)

        self.qtgui_time_raster_sink_x_0.set_update_time(0.10)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_raster_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.received_grid_layout_2.addWidget(
            self._qtgui_time_raster_sink_x_0_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.received_grid_layout_2.setRowStretch(r, 1)
        for c in range(0, 1):
            self.received_grid_layout_2.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.received_grid_layout_0.addWidget(self._qtgui_const_sink_x_0_win,
                                              0, 0, 1, 1)
        for r in range(0, 1):
            self.received_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 1):
            self.received_grid_layout_0.setColumnStretch(c, 1)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, timing_loop_bw, rrc_taps, nfilts, nfilts / 2, 1.5, 2)
        self.digital_map_bb_0 = digital.map_bb([0, 1, 2, 3])
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            phase_bw, arity, False)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=qpsk,
            differential=True,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=excess_bw,
            verbose=False,
            log=False)
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(
            qpsk)
        self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(
            15, 1, eq_gain, 2)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=noise_volt,
            frequency_offset=freq_offset,
            epsilon=time_offset,
            taps=taps,
            noise_seed=0,
            block_tags=False)
        self.blocks_unpack_k_bits_bb_0_0 = blocks.unpack_k_bits_bb(8)
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, int(delay))
        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)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            list(map(int, numpy.random.randint(0, 255, 1000))), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_unpack_k_bits_bb_0_0, 0))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.qtgui_time_raster_sink_x_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_char_to_float_0_0_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.blocks_sub_xx_0, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_char_to_float_0_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0_0, 0),
                     (self.blocks_char_to_float_0_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.digital_map_bb_0, 0))
        self.connect((self.digital_map_bb_0, 0),
                     (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_cma_equalizer_cc_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "KAN-DAR RADAR TX/RX INSTRUMENTATION SERVER")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("KAN-DAR RADAR TX/RX INSTRUMENTATION SERVER")
        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", "RADAR_TX_INSTRUMENTATION")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2000000
        self.C = C = 299792458
        self.WL = WL = C/samp_rate
        self.variable_qtgui_label_0 = variable_qtgui_label_0 = WL
        self.q = q = 10000
        self.lo = lo = 2000000000
        self.gain = gain = 30
        self.fft_size = fft_size = 512
        self.decim = decim = 512*4

        ##################################################
        # Blocks
        ##################################################
        self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self)

        if None:
          self._variable_qtgui_label_0_formatter = None
        else:
          self._variable_qtgui_label_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_tool_bar.addWidget(Qt.QLabel('Pulse wavelength in meters calculated to be:'+": "))
        self._variable_qtgui_label_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_formatter(self.variable_qtgui_label_0)))
        self._variable_qtgui_label_0_tool_bar.addWidget(self._variable_qtgui_label_0_label)
        self.top_layout.addWidget(self._variable_qtgui_label_0_tool_bar)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	fft_size, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate/decim, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
          self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        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_AUTO, 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 = ['', '', '', '', '',
                  '', '', '', '', '']
        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, 1.0, 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.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
        	samp_rate,
        	256,
        	fft_size,
        	([]),
        	([]),
        	"Mag",
        	1,
        	)

        self.qtgui_time_raster_sink_x_0.set_update_time(0.10)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 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_raster_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_raster_sink_x_0_win)
        self.pluto_source_0 = iio.pluto_source('ip:pluto.local', int(lo), int(samp_rate), int(q), 0x8000, False, False, True, "manual", 60, '', True)
        self.pluto_sink_0 = iio.pluto_sink('ip:pluto.local', int(lo), int(samp_rate), int(q), 0x8000, False, 0, '', True)
        self.low_pass_filter_0 = filter.fir_filter_ccf(decim, firdes.low_pass(
        	1, samp_rate, 1e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self._gain_range = Range(0, 62, 1, 30, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "counter_slider", float)
        self.top_layout.addWidget(self._gain_win)
        self.fft_vxx_0_0_0 = fft.fft_vcc(fft_size, False, (window.blackmanharris(fft_size)), True, 8)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_size)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(fft_size)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 10e3, 1, 0)
        self.analog_agc_xx_0_0 = analog.agc_cc(1e-4, 1.0, 1.0)
        self.analog_agc_xx_0_0.set_max_gain(65536)
        self.analog_agc_xx_0 = analog.agc_cc(1e-4, 1.0, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc_xx_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.analog_agc_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.analog_agc_xx_0_0, 0), (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.analog_agc_xx_0_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.analog_sig_source_x_0, 0), (self.analog_agc_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.pluto_sink_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0), (self.qtgui_time_sink_x_0, 1))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0), (self.qtgui_time_raster_sink_x_0, 0))
        self.connect((self.fft_vxx_0_0_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.pluto_source_0, 0), (self.analog_agc_xx_0_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "onedimension_simulation")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("onedimension_simulation")
        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", "onedimension_simulation")

        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

        ##################################################
        # Variables
        ##################################################
        self.maxtheta = maxtheta = 150
        self.columns = columns = 100
        self.shiftarrL = shiftarrL = np.radians(np.linspace(start=maxtheta, stop=0, num=int(columns/2), endpoint=False))
        self.variable_function_probe_0_0 = variable_function_probe_0_0 = 0
        self.variable_function_probe_0 = variable_function_probe_0 = 1
        self.left = left = np.pad(shiftarrL, (0, int(columns/2)), 'constant')
        self.degreesTXR = degreesTXR = 0
        self.degreesTXL = degreesTXL = 0
        self.variable_qtgui_label_0_0_0 = variable_qtgui_label_0_0_0 = variable_function_probe_0_0
        self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = variable_function_probe_0
        self.scale = scale = 55
        self.samp_rate = samp_rate = 64000
        self.rows = rows = 100
        self.right = right = np.flip(left, axis=0)
        self.angle_radiansStartR = angle_radiansStartR = (math.pi/180) * degreesTXR
        self.angle_radiansStartL = angle_radiansStartL = (math.pi/180) * degreesTXL

        ##################################################
        # Blocks
        ##################################################
        self._scale_range = Range(0, 100, 5, 55, 200)
        self._scale_win = RangeWidget(self._scale_range, self.set_scale, 'scale', "counter_slider", float)
        self.top_grid_layout.addWidget(self._scale_win)
        self.blocks_probe_signal_x_0_0 = blocks.probe_signal_f()
        self.blocks_probe_signal_x_0 = blocks.probe_signal_f()
        self.video_sdl_sink_1 = video_sdl.sink_s(0, columns, rows, 0, columns*6, rows*6)
        self._variable_qtgui_label_0_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_0_0_tool_bar.addWidget(Qt.QLabel('Probe Signal Min' + ": "))
        self._variable_qtgui_label_0_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_0_formatter(self.variable_qtgui_label_0_0_0)))
        self._variable_qtgui_label_0_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_0_label)
        self.top_grid_layout.addWidget(self._variable_qtgui_label_0_0_0_tool_bar)
        self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_0_tool_bar.addWidget(Qt.QLabel('Probe Signal Max' + ": "))
        self._variable_qtgui_label_0_0_label = Qt.QLabel(str(self._variable_qtgui_label_0_0_formatter(self.variable_qtgui_label_0_0)))
        self._variable_qtgui_label_0_0_tool_bar.addWidget(self._variable_qtgui_label_0_0_label)
        self.top_grid_layout.addWidget(self._variable_qtgui_label_0_0_tool_bar)
        def _variable_function_probe_0_0_probe():
            while True:

                val = self.blocks_probe_signal_x_0_0.level()
                try:
                    self.set_variable_function_probe_0_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))
        _variable_function_probe_0_0_thread = threading.Thread(target=_variable_function_probe_0_0_probe)
        _variable_function_probe_0_0_thread.daemon = True
        _variable_function_probe_0_0_thread.start()

        def _variable_function_probe_0_probe():
            while True:

                val = self.blocks_probe_signal_x_0.level()
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))
        _variable_function_probe_0_thread = threading.Thread(target=_variable_function_probe_0_probe)
        _variable_function_probe_0_thread.daemon = True
        _variable_function_probe_0_thread.start()

        self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
            samp_rate,
            columns,
            rows,
            [],
            [],
            "",
            1
        )

        self.qtgui_time_raster_sink_x_0.set_update_time(0.01)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(0, 5)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '',
            '', '', '', '', '']
        colors = [1, 1, 0, 0, 0,
            0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
            1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_raster_sink_x_0_win)
        self._degreesTXR_range = Range(0, maxtheta/2, 5, 0, 200)
        self._degreesTXR_win = RangeWidget(self._degreesTXR_range, self.set_degreesTXR, 'degreesTXR', "counter_slider", float)
        self.top_grid_layout.addWidget(self._degreesTXR_win)
        self._degreesTXL_range = Range(0, maxtheta/2, 5, 0, 200)
        self._degreesTXL_win = RangeWidget(self._degreesTXL_range, self.set_degreesTXL, 'degreesTXL', "counter_slider", float)
        self.top_grid_layout.addWidget(self._degreesTXL_win)
        self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_f(right, True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(left, True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0 = blocks.sub_ff(1)
        self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(gr.sizeof_float*1, samp_rate)
        self.blocks_repeat_0_0_0_0_1 = blocks.repeat(gr.sizeof_float*1, columns)
        self.blocks_repeat_0_0_0_0_0_1 = blocks.repeat(gr.sizeof_float*1, columns)
        self.blocks_repeat_0_0_0_0_0 = blocks.repeat(gr.sizeof_float*1, columns)
        self.blocks_repeat_0_0_0_0 = blocks.repeat(gr.sizeof_float*1, columns)
        self.blocks_multiply_const_vxx_0_0_1 = blocks.multiply_const_cc(complex(math.cos(angle_radiansStartR),math.sin(angle_radiansStartR)))
        self.blocks_multiply_const_vxx_0_0_0_0 = blocks.multiply_const_cc(complex(math.cos(angle_radiansStartL),math.sin(angle_radiansStartL)))
        self.blocks_min_xx_0 = blocks.min_ff(samp_rate,1)
        self.blocks_max_xx_0 = blocks.max_ff(samp_rate, 1)
        self.blocks_magphase_to_complex_0_0_0_0_0 = blocks.magphase_to_complex(1)
        self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1)
        self.blocks_float_to_short_0 = blocks.float_to_short(1, scale)
        self.blocks_complex_to_magphase_0_0_0_0 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_magphase_0_0_0 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 1e3, 1, 0, 0)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_float_to_short_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_stream_to_vector_0_1, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.qtgui_time_raster_sink_x_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0, 0), (self.blocks_repeat_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0, 1), (self.blocks_repeat_0_0_0_0_0_1, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0, 0), (self.blocks_repeat_0_0_0_0_1, 0))
        self.connect((self.blocks_float_to_short_0, 0), (self.video_sdl_sink_1, 0))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_max_xx_0, 0), (self.blocks_probe_signal_x_0, 0))
        self.connect((self.blocks_min_xx_0, 0), (self.blocks_probe_signal_x_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0_0, 0), (self.blocks_complex_to_magphase_0_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_1, 0), (self.blocks_complex_to_magphase_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0, 0), (self.blocks_sub_xx_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_1, 0), (self.blocks_sub_xx_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_1, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_max_xx_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_min_xx_0, 0))
        self.connect((self.blocks_sub_xx_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_0, 0), (self.blocks_magphase_to_complex_0_0_0_0_0, 1))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0_0_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0_0_1, 0))
        self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_sub_xx_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_0, 0), (self.blocks_sub_xx_0_0_0, 1))
Example #14
0
    def __init__(self):
        gr.top_block.__init__(self, "twodimension_usrp_b210s")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("twodimension_usrp_b210s")
        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", "twodimension_usrp_b210s")

        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

        ##################################################
        # Variables
        ##################################################
        self.maxtheta = maxtheta = 150
        self.columns = columns = 100
        self.shiftarrL = shiftarrL = np.radians(
            np.linspace(start=maxtheta,
                        stop=0,
                        num=int(columns / 2),
                        endpoint=False))
        self.left = left = np.pad(shiftarrL, (0, int(columns / 2)), 'constant')
        self.variable_function_probe_0_0 = variable_function_probe_0_0 = 0
        self.variable_function_probe_0 = variable_function_probe_0 = 1
        self.right = right = np.flip(left, axis=0)
        self.variable_qtgui_label_0_0_0_0 = variable_qtgui_label_0_0_0_0 = variable_function_probe_0_0
        self.variable_qtgui_label_0_0_0 = variable_qtgui_label_0_0_0 = variable_function_probe_0
        self.variable_qtgui_label_0_0 = variable_qtgui_label_0_0 = left
        self.variable_qtgui_label_0 = variable_qtgui_label_0 = right
        self.threshold = threshold = -60
        self.scale = scale = 20000
        self.samp_rate = samp_rate = 100e3
        self.minmag = minmag = 0
        self.maxmag = maxmag = .0035
        self.keep = keep = 50
        self.gain = gain = 20
        self.freq = freq = 422e6
        self.displayscale = displayscale = 5

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Time rasters')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Steering vectors')
        self.top_grid_layout.addWidget(self.tab)
        self._scale_range = Range(0, 60000, 1000, 20000, 200)
        self._scale_win = RangeWidget(self._scale_range, self.set_scale,
                                      'scale', "counter_slider", float)
        self.top_grid_layout.addWidget(self._scale_win)
        self.blocks_probe_signal_x_0_0 = blocks.probe_signal_f()
        self.blocks_probe_signal_x_0 = blocks.probe_signal_f()
        self.video_sdl_sink_1_1_0 = video_sdl.sink_s(0, columns, columns, 0,
                                                     columns * displayscale,
                                                     columns * displayscale)
        self._variable_qtgui_label_0_0_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_0_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_0_0_0_tool_bar.addWidget(
            Qt.QLabel('Probe Signal Min' + ": "))
        self._variable_qtgui_label_0_0_0_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_0_0_0_formatter(
                    self.variable_qtgui_label_0_0_0_0)))
        self._variable_qtgui_label_0_0_0_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_0_0_0_label)
        self.top_grid_layout.addWidget(
            self._variable_qtgui_label_0_0_0_0_tool_bar)
        self._variable_qtgui_label_0_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_0_formatter = lambda x: str(x)

        self._variable_qtgui_label_0_0_0_tool_bar.addWidget(
            Qt.QLabel('Probe Signal Max' + ": "))
        self._variable_qtgui_label_0_0_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_0_0_formatter(
                    self.variable_qtgui_label_0_0_0)))
        self._variable_qtgui_label_0_0_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_0_0_label)
        self.top_grid_layout.addWidget(
            self._variable_qtgui_label_0_0_0_tool_bar)
        self._variable_qtgui_label_0_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_0_formatter = None
        else:
            self._variable_qtgui_label_0_0_formatter = lambda x: repr(x)

        self._variable_qtgui_label_0_0_tool_bar.addWidget(
            Qt.QLabel('variable_qtgui_label_0_0' + ": "))
        self._variable_qtgui_label_0_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_0_formatter(
                    self.variable_qtgui_label_0_0)))
        self._variable_qtgui_label_0_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_0_label)
        self.tab_layout_1.addWidget(self._variable_qtgui_label_0_0_tool_bar)
        self._variable_qtgui_label_0_tool_bar = Qt.QToolBar(self)

        if None:
            self._variable_qtgui_label_0_formatter = None
        else:
            self._variable_qtgui_label_0_formatter = lambda x: repr(x)

        self._variable_qtgui_label_0_tool_bar.addWidget(
            Qt.QLabel('variable_qtgui_label_0' + ": "))
        self._variable_qtgui_label_0_label = Qt.QLabel(
            str(
                self._variable_qtgui_label_0_formatter(
                    self.variable_qtgui_label_0)))
        self._variable_qtgui_label_0_tool_bar.addWidget(
            self._variable_qtgui_label_0_label)
        self.tab_layout_1.addWidget(self._variable_qtgui_label_0_tool_bar)

        def _variable_function_probe_0_0_probe():
            while True:

                val = self.blocks_probe_signal_x_0_0.level()
                try:
                    self.set_variable_function_probe_0_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))

        _variable_function_probe_0_0_thread = threading.Thread(
            target=_variable_function_probe_0_0_probe)
        _variable_function_probe_0_0_thread.daemon = True
        _variable_function_probe_0_0_thread.start()

        def _variable_function_probe_0_probe():
            while True:

                val = self.blocks_probe_signal_x_0.level()
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))

        _variable_function_probe_0_thread = threading.Thread(
            target=_variable_function_probe_0_probe)
        _variable_function_probe_0_thread.daemon = True
        _variable_function_probe_0_thread.start()

        self.uhd_usrp_source_0_0 = uhd.usrp_source(
            ",".join(("", "type=b200, name=origb210")),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=list(range(0, 2)),
            ),
        )
        self.uhd_usrp_source_0_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0_0.set_gain(gain, 0)
        self.uhd_usrp_source_0_0.set_antenna('RX2', 0)
        self.uhd_usrp_source_0_0.set_center_freq(freq, 1)
        self.uhd_usrp_source_0_0.set_gain(gain, 1)
        self.uhd_usrp_source_0_0.set_antenna('RX2', 1)
        self.uhd_usrp_source_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0_0.set_time_unknown_pps(uhd.time_spec())
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "type=b200, name=newb210")),
            uhd.stream_args(
                cpu_format="fc32",
                args='',
                channels=list(range(0, 2)),
            ),
        )
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.uhd_usrp_source_0.set_antenna('RX2', 0)
        self.uhd_usrp_source_0.set_center_freq(freq, 1)
        self.uhd_usrp_source_0.set_gain(gain, 1)
        self.uhd_usrp_source_0.set_antenna('RX2', 1)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec())
        self._threshold_range = Range(-160, -10, 5, -60, 200)
        self._threshold_win = RangeWidget(self._threshold_range,
                                          self.set_threshold,
                                          'squelch threshold',
                                          "counter_slider", int)
        self.top_grid_layout.addWidget(self._threshold_win)
        self.qtgui_time_raster_sink_x_0_0 = qtgui.time_raster_sink_f(
            samp_rate / keep, columns, columns, [], [], "Elevation", 1)

        self.qtgui_time_raster_sink_x_0_0.set_update_time(0.01)
        self.qtgui_time_raster_sink_x_0_0.set_intensity_range(minmag, maxmag)
        self.qtgui_time_raster_sink_x_0_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_raster_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_raster_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_0_win)
        self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_f(
            samp_rate / keep, columns, columns, [], [], "Azimuth", 1)

        self.qtgui_time_raster_sink_x_0.set_update_time(0.01)
        self.qtgui_time_raster_sink_x_0.set_intensity_range(minmag, maxmag)
        self.qtgui_time_raster_sink_x_0.enable_grid(False)
        self.qtgui_time_raster_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_raster_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_time_raster_sink_x_0_win)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, columns)
        self.blocks_vector_source_x_0_0_0_1 = blocks.vector_source_f(
            left, True, 1, [])
        self.blocks_vector_source_x_0_0_0_0_0 = blocks.vector_source_f(
            right, True, 1, [])
        self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_f(
            right, True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(
            left, True, 1, [])
        self.blocks_sub_xx_0_0_1 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0_0 = blocks.sub_ff(1)
        self.blocks_sub_xx_0_0 = blocks.sub_ff(1)
        self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, int(samp_rate / keep))
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, columns)
        self.blocks_repeat_0_0_0_0_2 = blocks.repeat(gr.sizeof_float * 1,
                                                     columns)
        self.blocks_repeat_0_0_0_0_1_0 = blocks.repeat(gr.sizeof_float * 1,
                                                       columns)
        self.blocks_repeat_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1,
                                                     columns)
        self.blocks_repeat_0_0_0_0_0_1_0 = blocks.repeat(
            gr.sizeof_float * 1, columns)
        self.blocks_repeat_0_0_0_0_0_1 = blocks.repeat(gr.sizeof_float * 1,
                                                       columns)
        self.blocks_repeat_0_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1,
                                                       columns)
        self.blocks_repeat_0_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1,
                                                     columns)
        self.blocks_repeat_0_0_0_0 = blocks.repeat(gr.sizeof_float * 1,
                                                   columns)
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex * columns,
                                               columns)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, columns)
        self.blocks_min_xx_0 = blocks.min_ff(int(samp_rate / keep), 1)
        self.blocks_max_xx_0 = blocks.max_ff(int(samp_rate / keep), 1)
        self.blocks_magphase_to_complex_0_0_0_0_1 = blocks.magphase_to_complex(
            1)
        self.blocks_magphase_to_complex_0_0_0_0_0_0 = blocks.magphase_to_complex(
            1)
        self.blocks_magphase_to_complex_0_0_0_0_0 = blocks.magphase_to_complex(
            1)
        self.blocks_magphase_to_complex_0_0_0_0 = blocks.magphase_to_complex(1)
        self.blocks_keep_one_in_n_0_2 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_keep_one_in_n_0_1 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * 1, keep)
        self.blocks_float_to_short_0_1_0 = blocks.float_to_short(1, scale)
        self.blocks_complex_to_magphase_0_0_0_1 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_magphase_0_0_0_0_0 = blocks.complex_to_magphase(
            1)
        self.blocks_complex_to_magphase_0_0_0_0 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_magphase_0_0_0 = blocks.complex_to_magphase(1)
        self.blocks_complex_to_mag_squared_0_1 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_pwr_squelch_xx_0_1 = analog.pwr_squelch_cc(
            -60, 1e-4, 0, False)
        self.analog_pwr_squelch_xx_0_0_0 = analog.pwr_squelch_cc(
            -60, 1e-4, 0, False)
        self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_cc(
            -60, 1e-4, 0, False)
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(
            -60, 1e-4, 0, False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_pwr_squelch_xx_0, 0),
                     (self.blocks_keep_one_in_n_0_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0_0_0, 0),
                     (self.blocks_keep_one_in_n_0_1, 0))
        self.connect((self.analog_pwr_squelch_xx_0_1, 0),
                     (self.blocks_keep_one_in_n_0_2, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.blocks_complex_to_mag_squared_0_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.blocks_complex_to_mag_squared_0_1, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.qtgui_time_raster_sink_x_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_0, 0),
                     (self.qtgui_time_raster_sink_x_0_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_1, 0),
                     (self.blocks_float_to_short_0_1_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_1, 0),
                     (self.blocks_stream_to_vector_0_1, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0, 0),
                     (self.blocks_repeat_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0, 1),
                     (self.blocks_repeat_0_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0, 1),
                     (self.blocks_repeat_0_0_0_0_0_1, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0, 0),
                     (self.blocks_repeat_0_0_0_0_1, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 1),
                     (self.blocks_repeat_0_0_0_0_0_1_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_0_0, 0),
                     (self.blocks_repeat_0_0_0_0_1_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_1, 1),
                     (self.blocks_repeat_0_0_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_magphase_0_0_0_1, 0),
                     (self.blocks_repeat_0_0_0_0_2, 0))
        self.connect((self.blocks_float_to_short_0_1_0, 0),
                     (self.video_sdl_sink_1_1_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.blocks_complex_to_magphase_0_0_0, 0))
        self.connect((self.blocks_keep_one_in_n_0_0, 0),
                     (self.blocks_complex_to_magphase_0_0_0_0, 0))
        self.connect((self.blocks_keep_one_in_n_0_1, 0),
                     (self.blocks_complex_to_magphase_0_0_0_1, 0))
        self.connect((self.blocks_keep_one_in_n_0_2, 0),
                     (self.blocks_complex_to_magphase_0_0_0_0_0, 0))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_0_0, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_magphase_to_complex_0_0_0_0_1, 0),
                     (self.blocks_add_xx_0_0, 0))
        self.connect((self.blocks_max_xx_0, 0),
                     (self.blocks_probe_signal_x_0, 0))
        self.connect((self.blocks_min_xx_0, 0),
                     (self.blocks_probe_signal_x_0_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_1, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_1, 0),
                     (self.blocks_sub_xx_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_0_1_0, 0),
                     (self.blocks_sub_xx_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_1, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_1_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0_0, 0))
        self.connect((self.blocks_repeat_0_0_0_0_2, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_1, 0))
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1, 0),
                     (self.blocks_max_xx_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1, 0),
                     (self.blocks_min_xx_0, 0))
        self.connect((self.blocks_sub_xx_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_0_0, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_0_0, 1))
        self.connect((self.blocks_sub_xx_0_0_1, 0),
                     (self.blocks_magphase_to_complex_0_0_0_0_1, 1))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_sub_xx_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_0_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0_1, 0),
                     (self.blocks_sub_xx_0_0_1, 1))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_add_xx_1, 0))
        self.connect((self.uhd_usrp_source_0, 1),
                     (self.analog_pwr_squelch_xx_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.analog_pwr_squelch_xx_0_0, 0))
        self.connect((self.uhd_usrp_source_0_0, 0),
                     (self.analog_pwr_squelch_xx_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0_0, 1),
                     (self.analog_pwr_squelch_xx_0_1, 0))