Exemplo n.º 1
0
    def __init__(self, parent=None):
        qt.QGroupBox.__init__(self, parent)
        self.setTitle('Object Scaling')
        self.l = qt.QGridLayout(self)
        self.__disconnect = False
        self.__oldScale = [1.0, 1.0, 1.0]

        self.lineEditList = []
        self.validatorList = []
        i = 0
        self._lineSlotList = [
            self._xLineSlot, self._yLineSlot, self._zLineSlot
        ]
        for axis in ['x', 'y', 'z']:
            label = qt.QLabel("%s Scale" % axis)
            lineEdit = qt.QLineEdit(self)
            v = qt.QDoubleValidator(lineEdit)
            lineEdit.setValidator(v)

            self.validatorList.append(v)
            self.l.addWidget(label, i, 0)
            self.l.addWidget(lineEdit, i, 1)
            self.lineEditList.append(lineEdit)
            lineEdit.setText('1.0')
            lineEdit.setFixedWidth(
                lineEdit.fontMetrics().width('######.#####'))
            self.connect(lineEdit, qt.SIGNAL('editingFinished()'),
                         self._lineSlotList[i])
            i += 1

        # xScaling
        i = 0
        self.xScaleSlider = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
        self.xScaleSlider.setScale(-10.0, 10.0, 0.001)
        self.xScaleSlider.setValue(1.0)
        self.l.addWidget(self.xScaleSlider, i, 2)
        self.connect(self.xScaleSlider, qt.SIGNAL("valueChanged(double)"),
                     self._xSliderSlot)

        # yScaling
        i += 1
        self.yScaleSlider = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
        self.yScaleSlider.setRange(-100.0, 100.0, 0.01)
        self.yScaleSlider.setValue(1.0)
        self.l.addWidget(self.yScaleSlider, i, 2)
        self.connect(self.yScaleSlider, qt.SIGNAL("valueChanged(double)"),
                     self._ySliderSlot)

        # zScaling
        i += 1
        self.zScaleSlider = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
        self.zScaleSlider.setRange(-100.0, 100.0, 0.01)
        self.zScaleSlider.setValue(1.0)
        self.l.addWidget(self.zScaleSlider, i, 2)
        self.connect(self.zScaleSlider, qt.SIGNAL("valueChanged(double)"),
                     self._zSliderSlot)
Exemplo n.º 2
0
    def build(self):
        self.l = qt.QGridLayout(self)

        i = 0
        # point size
        label = qt.QLabel('Point size')
        self.pointSize = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
        self.pointSize.setRange(1.0, 1.0, 1.0)
        self.pointSize.setValue(1.0)
        self.l.addWidget(label, i, 0)
        self.l.addWidget(self.pointSize, i, 1)
        self.connect(self.pointSize, qt.SIGNAL("valueChanged(double)"),
                     self._slot)

        # line width
        i += 1
        label = qt.QLabel('Line width')
        self.lineWidth = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
        self.lineWidth.setRange(1.0, 1.0, 1.0)
        self.lineWidth.setValue(1.0)
        self.l.addWidget(label, i, 0)
        self.l.addWidget(self.lineWidth, i, 1)
        self.connect(self.lineWidth, qt.SIGNAL("valueChanged(double)"),
                     self._slot)

        # transparency
        i += 1
        label = qt.QLabel('Transparency')
        self.transparency = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
        self.transparency.setRange(0.0, 1.0, 0.01)
        self.transparency.setValue(0.0)
        self.l.addWidget(label, i, 0)
        self.l.addWidget(self.transparency, i, 1)
        self.connect(self.transparency, qt.SIGNAL("valueChanged(double)"),
                     self._slot)

        # bounding box
        self.boundingBoxCheckBox = qt.QCheckBox(self)
        self.boundingBoxCheckBox.setText("Show bounding box")
        self.connect(self.boundingBoxCheckBox, qt.SIGNAL("stateChanged(int)"),
                     self._signal)
        i = 0
        j = 2
        self.l.addWidget(self.boundingBoxCheckBox, i, j)
        self.showLimitsCheckBoxes = []
        for t in ['X', 'Y', 'Z']:
            i += 1
            checkBox = qt.QCheckBox(self)
            checkBox.setText('Show bbox %s limit' % t)
            self.l.addWidget(checkBox, i, j)
            self.connect(checkBox, qt.SIGNAL("stateChanged(int)"), self._slot)
            self.showLimitsCheckBoxes.append(checkBox)
Exemplo n.º 3
0
	def __init__(self, rx, grwidgets, parent = None):
		QtGui.QWidget.__init__(self, parent)
		self.setWindowTitle('TinyHAN Radio Monitor')
		
		self.rx = rx
		
		self.tune = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
		self.tune.setRange(-200000, 200000, 100)
		self.tune.setValue(0)
		self.tune.valueChanged.connect(self.do_tune)
		
		self.output = QtGui.QPlainTextEdit()
		self.output.setReadOnly(True)
				
		llayout = QtGui.QVBoxLayout()
		llayout.addWidget(self.tune)
		llayout.addWidget(grwidgets[0])
		
		grwidgets[0].setMaximumSize(400,400)
		grwidgets[1].setMaximumHeight(250)
		grwidgets[2].setMaximumHeight(250)
		
		mainlayout = QtGui.QGridLayout()
		mainlayout.addLayout(llayout,0,0,2,1)
		mainlayout.addWidget(grwidgets[1],0,1,1,1)
		mainlayout.addWidget(grwidgets[2],1,1,1,1)
		mainlayout.addWidget(self.output,2,0,1,2)
		mainlayout.setColumnStretch(1,3)
		mainlayout.setRowStretch(2,3)
		
		self.setLayout(mainlayout)
		self.resize(800,600)
Exemplo n.º 4
0
    def __init__(self, *args):
        Qt.QFrame.__init__(self, *args)

        self.frequencySlider = Qwt.QwtSlider(self, Qt.Qt.Horizontal,
                                             Qwt.QwtSlider.TopScale)
        self.frequencySlider.setScaleMaxMinor(5)
        self.frequencySlider.setScaleMaxMajor(12)
        self.frequencySlider.setThumbLength(80)
        self.frequencySlider.setBorderWidth(1)
        self.frequencySlider.setRange(87.5, 108, 0.01, 10)

        self.tuningThermo = TuningThermo(self)

        self.frequencyWheel = Qwt.QwtWheel(self)
        self.frequencyWheel.setMass(0.5)
        self.frequencyWheel.setRange(87.5, 108, 0.01)
        self.frequencyWheel.setTotalAngle(3600.0)

        self.connect(self.frequencyWheel, Qt.SIGNAL("valueChanged(double)"),
                     self.adjustFreq)
        self.connect(self.frequencySlider, Qt.SIGNAL("valueChanged(double)"),
                     self.adjustFreq)

        mainLayout = Qt.QVBoxLayout(self)
        mainLayout.setMargin(10)
        mainLayout.setSpacing(5)
        mainLayout.addWidget(self.frequencySlider)

        hLayout = Qt.QHBoxLayout()
        hLayout.setMargin(0)
        hLayout.addWidget(self.tuningThermo, 0)
        hLayout.addStretch(5)
        hLayout.addWidget(self.frequencyWheel, 2)

        mainLayout.addLayout(hLayout)
Exemplo n.º 5
0
    def _setup_filter_by_max_ui(self):
        """Setup ui for filtering by maximum"""

        # Visual separator for components
        frame = QtGui.QFrame()
        frame.setFrameShape(QtGui.QFrame.HLine)
        self._main_layout.addWidget(frame)

        # NOTE: PyQwt has some nice built-in widgets that matplotlib doesn't,
        # of course matplotlib has some nice plots PyQwt doesn't :)
        self._slider = Qwt.QwtSlider(self, Qt.Qt.Horizontal,
                                     Qwt.QwtSlider.BottomScale)
        self._slider.valueChanged.connect(self._slider_changed)

        self._main_layout.addWidget(self._filter_by_max_label)
        self._main_layout.addWidget(self._slider)
Exemplo n.º 6
0
    def createSlider(self, parent, sliderType):

        if sliderType == 0:
            slider = Qwt.QwtSlider(parent, Qt.Qt.Horizontal,
                                   Qwt.QwtSlider.TopScale,
                                   Qwt.QwtSlider.BgTrough)
            slider.setThumbWidth(10)
            slider.setRange(-10.0, 10.0, 1.0, 0)  # paging disabled
            return slider

        if sliderType == 1:
            slider = Qwt.QwtSlider(parent, Qt.Qt.Horizontal,
                                   Qwt.QwtSlider.NoScale, Qwt.QwtSlider.BgBoth)
            slider.setRange(0.0, 1.0, 0.01, 5)
            return slider

        if sliderType == 2:
            slider = Qwt.QwtSlider(parent, Qt.Qt.Horizontal,
                                   Qwt.QwtSlider.BottomScale,
                                   Qwt.QwtSlider.BgSlot)
            slider.setThumbWidth(25)
            slider.setThumbLength(12)
            slider.setRange(1000.0, 3000.0, 10.0, 10)
            return slider

        if sliderType == 3:
            slider = Qwt.QwtSlider(parent, Qt.Qt.Vertical,
                                   Qwt.QwtSlider.LeftScale,
                                   Qwt.QwtSlider.BgSlot)
            slider.setRange(0.0, 100.0, 1.0, 5)
            slider.setScaleMaxMinor(5)
            return slider

        if sliderType == 4:
            slider = Qwt.QwtSlider(parent, Qt.Qt.Vertical,
                                   Qwt.QwtSlider.NoScale,
                                   Qwt.QwtSlider.BgTrough)
            slider.setRange(0.0, 100.0, 1.0, 10)
            return slider

        if sliderType == 5:
            slider = Qwt.QwtSlider(parent, Qt.Qt.Vertical,
                                   Qwt.QwtSlider.RightScale,
                                   Qwt.QwtSlider.BgBoth)
            slider.setScaleEngine(Qwt.QwtLog10ScaleEngine())
            slider.setThumbWidth(20)
            slider.setBorderWidth(1)
            slider.setRange(0.0, 4.0, 0.01)
            slider.setScale(1.0, 1.0e4)
            slider.setScaleMaxMinor(10)
            return slider

        return None
Exemplo n.º 7
0
    def __init__(self, parent=None, orientation=qt.Qt.Horizontal):
        qt.QWidget.__init__(self, parent)
        if orientation == qt.Qt.Horizontal:
            self.mainLayout = qt.QHBoxLayout(self)
        else:
            orientation = qt.Qt.Vertical
            self.mainLayout = qt.QVBoxLayout(self)
        self.mainLayout.setMargin(0)
        self.wheel = Qwt5.QwtWheel(self)
        self.wheel.setOrientation(orientation)
        self.slider = Qwt5.QwtSlider(self, orientation, Qwt5.QwtSlider.NoScale,
                                     Qwt5.QwtSlider.BgSlot)

        if orientation == qt.Qt.Horizontal:
            self.mainLayout.addWidget(self.wheel)
            self.mainLayout.addWidget(self.slider)
        else:
            self.mainLayout.addWidget(self.slider)
            self.mainLayout.addWidget(self.wheel)
Exemplo n.º 8
0
 def __init__(self,
              parent,
              tracking=False,
              minimum=0.0,
              maximum=1.0,
              step=0.0,
              scale_step=0.1,
              orientation='horizontal',
              scale_position=None,
              style='trough',
              **kwargs):
     #signals = ['valueChanged']
     pythics.libcontrol.Control.__init__(self, parent, **kwargs)
     # orientation selection
     if orientation == 'horizontal':
         orient = QtCore.Qt.Horizontal
     else:
         orient = QtCore.Qt.Vertical
     # scale position selection
     if scale_position == 'top':
         scalePos = Qwt.QwtSlider.TopScale
     elif scale_position == 'bottom':
         scalePos = Qwt.QwtSlider.BottomScale
     elif scale_position == 'left':
         scalePos = Qwt.QwtSlider.LeftScale
     elif scale_position == 'right':
         scalePos = Qwt.QwtSlider.RightScale
     else:
         scalePos = Qwt.QwtSlider.NoScale
     # background style selection
     if style == 'trough':
         bgStyle = Qwt.QwtSlider.BgTrough
     elif style == 'slot':
         bgStyle = Qwt.QwtSlider.BgSlot
     else:
         bgStyle = Qwt.QwtSlider.BgTrough | Qwt.QwtSlider.BgSlot
     self._widget = Qwt.QwtSlider(parent, orient, scalePos, bgStyle)
     self._widget.setTracking(tracking)
     self._widget.setScale(float(minimum), float(maximum),
                           float(scale_step))
     self._widget.setRange(float(minimum), float(maximum), float(step))
    def __init__(self):
        gr.top_block.__init__(self, "Uhd Snr Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Uhd Snr Receiver")
        self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        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", "uhd_snr_receiver")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.samp_rate = samp_rate = 1e6
        self.rrc_taps = rrc_taps = filter.firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts)
        self.gain = gain = 15
        self.freq = freq = 520e6
        self.fine_freq = fine_freq = -28400

        ##################################################
        # Blocks
        ##################################################
        self._gain_layout = Qt.QVBoxLayout()
        self._gain_tool_bar = Qt.QToolBar(self)
        self._gain_layout.addWidget(self._gain_tool_bar)
        self._gain_tool_bar.addWidget(Qt.QLabel("RX Gain" + ": "))
        self._gain_counter = Qwt.QwtCounter()
        self._gain_counter.setRange(0, 31.5, 0.5)
        self._gain_counter.setNumButtons(2)
        self._gain_counter.setValue(self.gain)
        self._gain_tool_bar.addWidget(self._gain_counter)
        self._gain_counter.valueChanged.connect(self.set_gain)
        self._gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._gain_slider.setRange(0, 31.5, 0.5)
        self._gain_slider.setValue(self.gain)
        self._gain_slider.setMinimumWidth(200)
        self._gain_slider.valueChanged.connect(self.set_gain)
        self._gain_layout.addWidget(self._gain_slider)
        self.top_layout.addLayout(self._gain_layout)
        self._freq_layout = Qt.QVBoxLayout()
        self._freq_tool_bar = Qt.QToolBar(self)
        self._freq_layout.addWidget(self._freq_tool_bar)
        self._freq_tool_bar.addWidget(Qt.QLabel("Frequency" + ": "))
        self._freq_counter = Qwt.QwtCounter()
        self._freq_counter.setRange(514e6, 526e6, 1e6)
        self._freq_counter.setNumButtons(2)
        self._freq_counter.setValue(self.freq)
        self._freq_tool_bar.addWidget(self._freq_counter)
        self._freq_counter.valueChanged.connect(self.set_freq)
        self._freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._freq_slider.setRange(514e6, 526e6, 1e6)
        self._freq_slider.setValue(self.freq)
        self._freq_slider.setMinimumWidth(200)
        self._freq_slider.valueChanged.connect(self.set_freq)
        self._freq_layout.addWidget(self._freq_slider)
        self.top_grid_layout.addLayout(self._freq_layout, 2, 0, 1, 1)
        self._fine_freq_layout = Qt.QVBoxLayout()
        self._fine_freq_tool_bar = Qt.QToolBar(self)
        self._fine_freq_layout.addWidget(self._fine_freq_tool_bar)
        self._fine_freq_tool_bar.addWidget(Qt.QLabel("Fine Frequency" + ": "))
        self._fine_freq_counter = Qwt.QwtCounter()
        self._fine_freq_counter.setRange(-50e3, 50e3, 100)
        self._fine_freq_counter.setNumButtons(2)
        self._fine_freq_counter.setValue(self.fine_freq)
        self._fine_freq_tool_bar.addWidget(self._fine_freq_counter)
        self._fine_freq_counter.valueChanged.connect(self.set_fine_freq)
        self._fine_freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                               Qwt.QwtSlider.BottomScale,
                                               Qwt.QwtSlider.BgSlot)
        self._fine_freq_slider.setRange(-50e3, 50e3, 100)
        self._fine_freq_slider.setValue(self.fine_freq)
        self._fine_freq_slider.setMinimumWidth(200)
        self._fine_freq_slider.valueChanged.connect(self.set_fine_freq)
        self._fine_freq_layout.addWidget(self._fine_freq_slider)
        self.top_grid_layout.addLayout(self._fine_freq_layout, 2, 1, 1, 1)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq + fine_freq, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
            500,  #size
            samp_rate,  #bw
            "QT GUI Plot",  #name
            3  #number of inputs
        )
        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 0, 0,
                                       1, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            1  #number of inputs
        )
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 1, 0, 1,
                                       2)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "QT GUI Plot",  #name
            2  #number of inputs
        )
        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0, 1, 1,
                                       1)
        self.gr_multiply_xx_0 = gr.multiply_vcc(1)
        self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 1e-2, 1.0, 1.0, 0.0)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, 2 * 3.14 / 100.0, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_mpsk_snr_est_cc_0_1 = digital.mpsk_snr_est_cc(
            3, 10000, 0.001)
        self.digital_mpsk_snr_est_cc_0_0 = digital.mpsk_snr_est_cc(
            2, 10000, 0.001)
        self.digital_mpsk_snr_est_cc_0 = digital.mpsk_snr_est_cc(
            0, 10000, 0.001)
        self.digital_lms_dd_equalizer_cc_0 = digital.lms_dd_equalizer_cc(
            15, 0.010, 1,
            digital.constellation_qpsk().base())
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            2 * 3.14 / 100.0, 4)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_mpsk_snr_est_cc_0, 0))
        self.connect((self.gr_multiply_xx_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.digital_lms_dd_equalizer_cc_0, 0),
                     (self.qtgui_const_sink_x_0, 1))
        self.connect((self.gr_agc2_xx_0, 0), (self.gr_multiply_xx_0, 3))
        self.connect((self.gr_agc2_xx_0, 0), (self.gr_multiply_xx_0, 2))
        self.connect((self.gr_agc2_xx_0, 0), (self.gr_multiply_xx_0, 1))
        self.connect((self.gr_agc2_xx_0, 0), (self.gr_multiply_xx_0, 0))
        self.connect((self.gr_agc2_xx_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_lms_dd_equalizer_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.gr_agc2_xx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_mpsk_snr_est_cc_0_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_mpsk_snr_est_cc_0_1, 0))
        self.connect((self.digital_mpsk_snr_est_cc_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.digital_mpsk_snr_est_cc_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.digital_mpsk_snr_est_cc_0_1, 0),
                     (self.qtgui_time_sink_x_0_0, 2))
Exemplo n.º 10
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.dect_symbol_rate = dect_symbol_rate = 1152000
        self.dect_occupied_bandwidth = dect_occupied_bandwidth = 1.2*dect_symbol_rate
        self.dect_channel_bandwidth = dect_channel_bandwidth = 1.728e6
        self.baseband_sampling_rate = baseband_sampling_rate = 100000000/32
        self.rx_gain = rx_gain = 0
        self.rx_freq = rx_freq = 1897344000
        self.resampler_filter_taps = resampler_filter_taps = firdes.low_pass_2(1, 3*baseband_sampling_rate, dect_occupied_bandwidth/2, (dect_channel_bandwidth - dect_occupied_bandwidth)/2, 30)
        self.part_id = part_id = 0

        ##################################################
        # Blocks
        ##################################################
        self._rx_gain_layout = Qt.QVBoxLayout()
        self._rx_gain_tool_bar = Qt.QToolBar(self)
        self._rx_gain_layout.addWidget(self._rx_gain_tool_bar)
        self._rx_gain_tool_bar.addWidget(Qt.QLabel("RX Gain"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._rx_gain_counter = qwt_counter_pyslot()
        self._rx_gain_counter.setRange(0, 30, 1)
        self._rx_gain_counter.setNumButtons(2)
        self._rx_gain_counter.setValue(self.rx_gain)
        self._rx_gain_tool_bar.addWidget(self._rx_gain_counter)
        self._rx_gain_counter.valueChanged.connect(self.set_rx_gain)
        self._rx_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._rx_gain_slider.setRange(0, 30, 1)
        self._rx_gain_slider.setValue(self.rx_gain)
        self._rx_gain_slider.setMinimumWidth(200)
        self._rx_gain_slider.valueChanged.connect(self.set_rx_gain)
        self._rx_gain_layout.addWidget(self._rx_gain_slider)
        self.top_layout.addLayout(self._rx_gain_layout)
        self._rx_freq_options = [1897344000, 1881792000, 1883520000, 1885248000, 1886876000, 1888704000, 1890432000, 1892160000, 1893888000, 1895616000,]
        self._rx_freq_labels = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
        self._rx_freq_tool_bar = Qt.QToolBar(self)
        self._rx_freq_tool_bar.addWidget(Qt.QLabel("Carrier Number"+": "))
        self._rx_freq_combo_box = Qt.QComboBox()
        self._rx_freq_tool_bar.addWidget(self._rx_freq_combo_box)
        for label in self._rx_freq_labels: self._rx_freq_combo_box.addItem(label)
        self._rx_freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._rx_freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._rx_freq_options.index(i)))
        self._rx_freq_callback(self.rx_freq)
        self._rx_freq_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_rx_freq(self._rx_freq_options[i]))
        self.top_layout.addWidget(self._rx_freq_tool_bar)
        self.vocoder_g721_decode_bs_0 = vocoder.g721_decode_bs()
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(3125000)
        self.uhd_usrp_source_0.set_center_freq(rx_freq, 0)
        self.uhd_usrp_source_0.set_gain(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=6,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler = filter.rational_resampler_base_ccc(3, 2, (resampler_filter_taps))
        self._part_id_options = [0, 1, 2, 3, 4, 5, 6, 7, 8]
        self._part_id_labels = ["0", "1", "2", "3", "4", "5", "6", "7", "8"]
        self._part_id_tool_bar = Qt.QToolBar(self)
        self._part_id_tool_bar.addWidget(Qt.QLabel("Select Part"+": "))
        self._part_id_combo_box = Qt.QComboBox()
        self._part_id_tool_bar.addWidget(self._part_id_combo_box)
        for label in self._part_id_labels: self._part_id_combo_box.addItem(label)
        self._part_id_callback = lambda i: Qt.QMetaObject.invokeMethod(self._part_id_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._part_id_options.index(i)))
        self._part_id_callback(self.part_id)
        self._part_id_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_part_id(self._part_id_options[i]))
        self.top_layout.addWidget(self._part_id_tool_bar)
        self.fractional_resampler = filter.fractional_resampler_cc(0, (3.0*baseband_sampling_rate/2.0)/dect_symbol_rate/4.0)
        self.dect2_phase_diff_0 = dect2.phase_diff()
        self.dect2_packet_receiver_0 = dect2.packet_receiver()
        self.dect2_packet_decoder_0 = dect2.packet_decoder()
        self.console_0 = dect2.console()
        self.top_layout.addWidget(self.console_0)
          
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32768)
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rational_resampler, 0), (self.fractional_resampler, 0))
        self.connect((self.fractional_resampler, 0), (self.dect2_phase_diff_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.vocoder_g721_decode_bs_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.rational_resampler, 0))
        self.connect((self.dect2_packet_decoder_0, 0), (self.vocoder_g721_decode_bs_0, 0))
        self.connect((self.dect2_phase_diff_0, 0), (self.dect2_packet_receiver_0, 0))
        self.connect((self.dect2_packet_receiver_0, 0), (self.dect2_packet_decoder_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.rational_resampler_xxx_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.dect2_packet_decoder_0, "log_out", self.console_0, "in")
        self.msg_connect(self.dect2_packet_receiver_0, "rcvr_msg_out", self.dect2_packet_decoder_0, "rcvr_msg_in")
Exemplo n.º 11
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.sub_carrier_freq = sub_carrier_freq = 1000
        self.send_gain = send_gain = 40
        self.samp_rate = samp_rate = 10000
        self.recieve_gain = recieve_gain = 1
        self._carrier_freq_config = ConfigParser.ConfigParser()
        self._carrier_freq_config.read("default")
        try:
            carrier_freq = self._carrier_freq_config.getfloat("main", "key")
        except:
            carrier_freq = 915000000
        self.carrier_freq = carrier_freq
        self._USRP_IP_config = ConfigParser.ConfigParser()
        self._USRP_IP_config.read("default")
        try:
            USRP_IP = self._USRP_IP_config.get("main", "key")
        except:
            USRP_IP = "addr=192.168.10.14"
        self.USRP_IP = USRP_IP

        ##################################################
        # Blocks
        ##################################################
        self.tabs = Qt.QTabWidget()
        self.tabs_widget_0 = Qt.QWidget()
        self.tabs_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tabs_widget_0)
        self.tabs_grid_layout_0 = Qt.QGridLayout()
        self.tabs_layout_0.addLayout(self.tabs_grid_layout_0)
        self.tabs.addTab(self.tabs_widget_0, "Plots")
        self.tabs_widget_1 = Qt.QWidget()
        self.tabs_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.tabs_widget_1)
        self.tabs_grid_layout_1 = Qt.QGridLayout()
        self.tabs_layout_1.addLayout(self.tabs_grid_layout_1)
        self.tabs.addTab(self.tabs_widget_1, "Settings")
        self.top_layout.addWidget(self.tabs)
        self._sub_carrier_freq_layout = Qt.QVBoxLayout()
        self._sub_carrier_freq_tool_bar = Qt.QToolBar(self)
        self._sub_carrier_freq_layout.addWidget(
            self._sub_carrier_freq_tool_bar)
        self._sub_carrier_freq_tool_bar.addWidget(
            Qt.QLabel("Sub-Carrier Freq (Hz)" + ": "))
        self._sub_carrier_freq_counter = Qwt.QwtCounter()
        self._sub_carrier_freq_counter.setRange(0, 50000, 1000)
        self._sub_carrier_freq_counter.setNumButtons(2)
        self._sub_carrier_freq_counter.setValue(self.sub_carrier_freq)
        self._sub_carrier_freq_tool_bar.addWidget(
            self._sub_carrier_freq_counter)
        self._sub_carrier_freq_counter.valueChanged.connect(
            self.set_sub_carrier_freq)
        self._sub_carrier_freq_slider = Qwt.QwtSlider(
            None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale,
            Qwt.QwtSlider.BgSlot)
        self._sub_carrier_freq_slider.setRange(0, 50000, 1000)
        self._sub_carrier_freq_slider.setValue(self.sub_carrier_freq)
        self._sub_carrier_freq_slider.setMinimumWidth(200)
        self._sub_carrier_freq_slider.valueChanged.connect(
            self.set_sub_carrier_freq)
        self._sub_carrier_freq_layout.addWidget(self._sub_carrier_freq_slider)
        self.tabs_layout_1.addLayout(self._sub_carrier_freq_layout)
        self._send_gain_layout = Qt.QVBoxLayout()
        self._send_gain_tool_bar = Qt.QToolBar(self)
        self._send_gain_layout.addWidget(self._send_gain_tool_bar)
        self._send_gain_tool_bar.addWidget(Qt.QLabel("Send Gain (dB)" + ": "))
        self._send_gain_counter = Qwt.QwtCounter()
        self._send_gain_counter.setRange(0, 100, 1)
        self._send_gain_counter.setNumButtons(2)
        self._send_gain_counter.setValue(self.send_gain)
        self._send_gain_tool_bar.addWidget(self._send_gain_counter)
        self._send_gain_counter.valueChanged.connect(self.set_send_gain)
        self._send_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                               Qwt.QwtSlider.BottomScale,
                                               Qwt.QwtSlider.BgSlot)
        self._send_gain_slider.setRange(0, 100, 1)
        self._send_gain_slider.setValue(self.send_gain)
        self._send_gain_slider.setMinimumWidth(200)
        self._send_gain_slider.valueChanged.connect(self.set_send_gain)
        self._send_gain_layout.addWidget(self._send_gain_slider)
        self.tabs_layout_1.addLayout(self._send_gain_layout)
        self._recieve_gain_layout = Qt.QVBoxLayout()
        self._recieve_gain_tool_bar = Qt.QToolBar(self)
        self._recieve_gain_layout.addWidget(self._recieve_gain_tool_bar)
        self._recieve_gain_tool_bar.addWidget(
            Qt.QLabel("Recieve Gain (dB)" + ": "))
        self._recieve_gain_counter = Qwt.QwtCounter()
        self._recieve_gain_counter.setRange(0, 100, 1)
        self._recieve_gain_counter.setNumButtons(2)
        self._recieve_gain_counter.setValue(self.recieve_gain)
        self._recieve_gain_tool_bar.addWidget(self._recieve_gain_counter)
        self._recieve_gain_counter.valueChanged.connect(self.set_recieve_gain)
        self._recieve_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                                  Qwt.QwtSlider.BottomScale,
                                                  Qwt.QwtSlider.BgSlot)
        self._recieve_gain_slider.setRange(0, 100, 1)
        self._recieve_gain_slider.setValue(self.recieve_gain)
        self._recieve_gain_slider.setMinimumWidth(200)
        self._recieve_gain_slider.valueChanged.connect(self.set_recieve_gain)
        self._recieve_gain_layout.addWidget(self._recieve_gain_slider)
        self.tabs_layout_1.addLayout(self._recieve_gain_layout)
        self.uhd_usrp_source_0_0 = uhd.usrp_source(
            device_addr=USRP_IP,
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0_0.set_center_freq(carrier_freq, 0)
        self.uhd_usrp_source_0_0.set_gain(recieve_gain, 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr=USRP_IP,
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(carrier_freq, 0)
        self.uhd_usrp_sink_0.set_gain(send_gain, 0)
        self.uhd_usrp_sink_0.set_bandwidth(samp_rate, 0)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "QT GUI Plot",  #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_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, sub_carrier_freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.uhd_usrp_source_0_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
Exemplo n.º 12
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.sr_rf = sr_rf = 2500000
        self.decimate = decimate = 400
        self.sr_lo = sr_lo = sr_rf / decimate
        self.f_rf = f_rf = 434645000
        self.f_lo = f_lo = 455.2

        ##################################################
        # 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, "Tuning")
        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, "IQ Display")
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, "PSK Output")
        self.top_layout.addWidget(self.tab)
        self._f_rf_layout = Qt.QVBoxLayout()
        self._f_rf_tool_bar = Qt.QToolBar(self)
        self._f_rf_layout.addWidget(self._f_rf_tool_bar)
        self._f_rf_tool_bar.addWidget(Qt.QLabel("RF Freq" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._f_rf_counter = qwt_counter_pyslot()
        self._f_rf_counter.setRange(434644000, 434646000, 1)
        self._f_rf_counter.setNumButtons(2)
        self._f_rf_counter.setValue(self.f_rf)
        self._f_rf_tool_bar.addWidget(self._f_rf_counter)
        self._f_rf_counter.valueChanged.connect(self.set_f_rf)
        self._f_rf_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._f_rf_slider.setRange(434644000, 434646000, 1)
        self._f_rf_slider.setValue(self.f_rf)
        self._f_rf_slider.setMinimumWidth(200)
        self._f_rf_slider.valueChanged.connect(self.set_f_rf)
        self._f_rf_layout.addWidget(self._f_rf_slider)
        self.tab_layout_0.addLayout(self._f_rf_layout)
        self._f_lo_layout = Qt.QVBoxLayout()
        self._f_lo_tool_bar = Qt.QToolBar(self)
        self._f_lo_layout.addWidget(self._f_lo_tool_bar)
        self._f_lo_tool_bar.addWidget(Qt.QLabel("LO Freq" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._f_lo_counter = qwt_counter_pyslot()
        self._f_lo_counter.setRange(0, 2000, .1)
        self._f_lo_counter.setNumButtons(2)
        self._f_lo_counter.setValue(self.f_lo)
        self._f_lo_tool_bar.addWidget(self._f_lo_counter)
        self._f_lo_counter.valueChanged.connect(self.set_f_lo)
        self._f_lo_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._f_lo_slider.setRange(0, 2000, .1)
        self._f_lo_slider.setValue(self.f_lo)
        self._f_lo_slider.setMinimumWidth(200)
        self._f_lo_slider.valueChanged.connect(self.set_f_lo)
        self._f_lo_layout.addWidget(self._f_lo_slider)
        self.tab_layout_0.addLayout(self._f_lo_layout)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            sr_lo,  #size
            sr_lo,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(.03)
        self.qtgui_time_sink_x_0.set_y_axis(-.02, .02)

        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(True)

        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.tab_layout_0.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_number_sink_1 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_NONE, 1)
        self.qtgui_number_sink_1.set_update_time(0.10)
        self.qtgui_number_sink_1.set_title("")

        labels = ["Signal RMS", "", "", "", "", "", "", "", "", ""]
        units = ["", "", "", "", "", "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_1.set_min(i, -1)
            self.qtgui_number_sink_1.set_max(i, 1)
            self.qtgui_number_sink_1.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_1.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_1.set_label(i, labels[i])
            self.qtgui_number_sink_1.set_unit(i, units[i])
            self.qtgui_number_sink_1.set_factor(i, factor[i])

        self.qtgui_number_sink_1.enable_autoscale(False)
        self._qtgui_number_sink_1_win = sip.wrapinstance(
            self.qtgui_number_sink_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_1_win)
        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0.set_update_time(0.03)
        self.qtgui_number_sink_0.set_title("")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        units = ["", "", "", "", "", "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, -1)
            self.qtgui_number_sink_0.set_max(i, 1)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_number_sink_0_win)
        self.qtgui_const_sink_x_1 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_1.set_update_time(0.10)
        self.qtgui_const_sink_x_1.set_y_axis(-.02, .02)
        self.qtgui_const_sink_x_1.set_x_axis(-.02, .02)
        self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_1.enable_autoscale(False)
        self.qtgui_const_sink_x_1.enable_grid(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 xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_1_win = sip.wrapinstance(
            self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_const_sink_x_1_win)
        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(-.02, .02)
        self.qtgui_const_sink_x_0.set_x_axis(-.02, .02)
        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(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 = [1, 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 xrange(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.tab_layout_0.addWidget(self._qtgui_const_sink_x_0_win)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "airspy=0")
        self.osmosdr_source_0.set_sample_rate(sr_rf)
        self.osmosdr_source_0.set_center_freq(f_rf, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(3, 0)
        self.osmosdr_source_0.set_if_gain(0, 0)
        self.osmosdr_source_0.set_bb_gain(0, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            100, (firdes.low_pass(1, sr_rf, 2000, 100)), f_lo, sr_rf)
        self.digital_mpsk_receiver_cc_0 = digital.mpsk_receiver_cc(
            2, 0, cmath.pi / 100.0, -0.5, 0.5, 0.25, 0.01, 2, 0.001, 0.001)
        self.blocks_rms_xx_0 = blocks.rms_cf(0.0001)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (sr_lo / (2 * 3.14159), ))
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(.06, 0.6, -.6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.digital_mpsk_receiver_cc_0, 0))
        self.connect((self.digital_mpsk_receiver_cc_0, 0),
                     (self.qtgui_const_sink_x_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blocks_rms_xx_0, 0))
        self.connect((self.blocks_rms_xx_0, 0), (self.qtgui_number_sink_1, 0))
Exemplo n.º 13
0
    def __init__(self):
        gr.top_block.__init__(self, "MPSK Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("MPSK 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", "mpsk_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.eb = eb = 0.35
        self.usrp_gain = usrp_gain = 40
        self.timing_loop_bw = timing_loop_bw = 0.01
        self.samp_rate = samp_rate = 1e6
        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.preamble = preamble = [
            1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1,
            -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1,
            -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1,
            1, 1, 1, 1, 1, -1, -1
        ]
        self.phase_bw = phase_bw = 0.1
        self.n = n = 4
        self.matched_filter = matched_filter = firdes.root_raised_cosine(
            nfilts, nfilts, 1, eb, int(11 * sps * nfilts))
        self.eq_gain = eq_gain = 0.01
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self._usrp_gain_layout = Qt.QVBoxLayout()
        self._usrp_gain_tool_bar = Qt.QToolBar(self)
        self._usrp_gain_layout.addWidget(self._usrp_gain_tool_bar)
        self._usrp_gain_tool_bar.addWidget(Qt.QLabel("USRP Gain" + ": "))
        self._usrp_gain_counter = Qwt.QwtCounter()
        self._usrp_gain_counter.setRange(0, 100, 1)
        self._usrp_gain_counter.setNumButtons(2)
        self._usrp_gain_counter.setValue(self.usrp_gain)
        self._usrp_gain_tool_bar.addWidget(self._usrp_gain_counter)
        self._usrp_gain_counter.valueChanged.connect(self.set_usrp_gain)
        self._usrp_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                               Qwt.QwtSlider.BottomScale,
                                               Qwt.QwtSlider.BgSlot)
        self._usrp_gain_slider.setRange(0, 100, 1)
        self._usrp_gain_slider.setValue(self.usrp_gain)
        self._usrp_gain_slider.setMinimumWidth(200)
        self._usrp_gain_slider.valueChanged.connect(self.set_usrp_gain)
        self._usrp_gain_layout.addWidget(self._usrp_gain_slider)
        self.top_layout.addLayout(self._usrp_gain_layout)
        self._timing_loop_bw_layout = Qt.QVBoxLayout()
        self._timing_loop_bw_label = Qt.QLabel("Time: BW")
        self._timing_loop_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                                    Qwt.QwtSlider.BottomScale,
                                                    Qwt.QwtSlider.BgSlot)
        self._timing_loop_bw_slider.setRange(0.0, 0.2, 0.005)
        self._timing_loop_bw_slider.setValue(self.timing_loop_bw)
        self._timing_loop_bw_slider.setMinimumWidth(200)
        self._timing_loop_bw_slider.valueChanged.connect(
            self.set_timing_loop_bw)
        self._timing_loop_bw_label.setAlignment(Qt.Qt.AlignBottom
                                                | Qt.Qt.AlignHCenter)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_label)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_slider)
        self.top_grid_layout.addLayout(self._timing_loop_bw_layout, 0, 0, 1, 1)
        self._phase_bw_layout = Qt.QVBoxLayout()
        self._phase_bw_label = Qt.QLabel("Phase: Bandwidth")
        self._phase_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                              Qwt.QwtSlider.BottomScale,
                                              Qwt.QwtSlider.BgSlot)
        self._phase_bw_slider.setRange(0.0, 1.0, 0.01)
        self._phase_bw_slider.setValue(self.phase_bw)
        self._phase_bw_slider.setMinimumWidth(200)
        self._phase_bw_slider.valueChanged.connect(self.set_phase_bw)
        self._phase_bw_label.setAlignment(Qt.Qt.AlignBottom
                                          | Qt.Qt.AlignHCenter)
        self._phase_bw_layout.addWidget(self._phase_bw_label)
        self._phase_bw_layout.addWidget(self._phase_bw_slider)
        self.top_grid_layout.addLayout(self._phase_bw_layout, 0, 2, 1, 1)
        self._eq_gain_layout = Qt.QVBoxLayout()
        self._eq_gain_label = Qt.QLabel("Equalizer: rate")
        self._eq_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                             Qwt.QwtSlider.BottomScale,
                                             Qwt.QwtSlider.BgSlot)
        self._eq_gain_slider.setRange(0.0, 0.1, 0.001)
        self._eq_gain_slider.setValue(self.eq_gain)
        self._eq_gain_slider.setMinimumWidth(200)
        self._eq_gain_slider.valueChanged.connect(self.set_eq_gain)
        self._eq_gain_label.setAlignment(Qt.Qt.AlignBottom
                                         | Qt.Qt.AlignHCenter)
        self._eq_gain_layout.addWidget(self._eq_gain_label)
        self._eq_gain_layout.addWidget(self._eq_gain_slider)
        self.top_grid_layout.addLayout(self._eq_gain_layout, 0, 1, 1, 1)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(2.4e9, 0)
        self.uhd_usrp_source_0.set_gain(usrp_gain, 0)
        self.qtgui_sink_x_1 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_win)

        self.frame_detection_deinterleaver_bb_0 = frame_detection.deinterleaver_bb(
            n, n)
        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_diff_decoder_bb_0 = digital.diff_decoder_bb(4)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, arity)
        self.digital_correlate_and_sync_cc_0 = digital.correlate_and_sync_cc(
            (preamble), (matched_filter), sps)
        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.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        self.blocks_pack_k_bits_bb_1 = blocks.pack_k_bits_bb(8)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/home/ubuntu/rx_message",
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 1),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_pack_k_bits_bb_1, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.digital_correlate_and_sync_cc_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_cma_equalizer_cc_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_pack_k_bits_bb_1, 0),
                     (self.frame_detection_deinterleaver_bb_0, 0))
        self.connect((self.frame_detection_deinterleaver_bb_0, 0),
                     (self.blocks_file_sink_0, 0))
Exemplo n.º 14
0
    def __init__(self):
        gr.top_block.__init__(self, "Evm Simulation")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Evm Simulation")
        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", "evm_simulation")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.vlen = vlen = 64
        self.samp_rate = samp_rate = 1e6
        self.noise_amp = noise_amp = 0

        ##################################################
        # Blocks
        ##################################################
        self._noise_amp_layout = Qt.QVBoxLayout()
        self._noise_amp_tool_bar = Qt.QToolBar(self)
        self._noise_amp_layout.addWidget(self._noise_amp_tool_bar)
        self._noise_amp_tool_bar.addWidget(Qt.QLabel("Noise Amplitude" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._noise_amp_counter = qwt_counter_pyslot()
        self._noise_amp_counter.setRange(0, 1, 0.01)
        self._noise_amp_counter.setNumButtons(2)
        self._noise_amp_counter.setValue(self.noise_amp)
        self._noise_amp_tool_bar.addWidget(self._noise_amp_counter)
        self._noise_amp_counter.valueChanged.connect(self.set_noise_amp)
        self._noise_amp_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                               Qwt.QwtSlider.BottomScale,
                                               Qwt.QwtSlider.BgSlot)
        self._noise_amp_slider.setRange(0, 1, 0.01)
        self._noise_amp_slider.setValue(self.noise_amp)
        self._noise_amp_slider.setMinimumWidth(200)
        self._noise_amp_slider.valueChanged.connect(self.set_noise_amp)
        self._noise_amp_layout.addWidget(self._noise_amp_slider)
        self.top_layout.addLayout(self._noise_amp_layout)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            2  #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(True)

        labels = [
            "Reference Points", "Received Points", "", "", "", "", "", "", "",
            ""
        ]
        widths = [2, 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 = [2.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_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.top_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self.cs436_constellation_source_0 = cs436.constellation_source(64, 2)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, vlen)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, vlen)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * vlen,
                                                 samp_rate, True)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, vlen)
        self.blocks_add_xx_0 = blocks.add_vcc(vlen)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(
            analog.GR_GAUSSIAN, noise_amp, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.cs436_constellation_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.qtgui_const_sink_x_0, 1))
Exemplo n.º 15
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.volume = volume = 2
        self.samp_rate = samp_rate = 2.88e6
        self.freq = freq = 93.7e6

        ##################################################
        # Blocks
        ##################################################
        self._volume_layout = Qt.QVBoxLayout()
        self._volume_tool_bar = Qt.QToolBar(self)
        self._volume_layout.addWidget(self._volume_tool_bar)
        self._volume_tool_bar.addWidget(Qt.QLabel("volume" + ": "))
        self._volume_counter = Qwt.QwtCounter()
        self._volume_counter.setRange(0, 20, 1)
        self._volume_counter.setNumButtons(2)
        self._volume_counter.setValue(self.volume)
        self._volume_tool_bar.addWidget(self._volume_counter)
        self._volume_counter.valueChanged.connect(self.set_volume)
        self._volume_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                            Qwt.QwtSlider.BottomScale,
                                            Qwt.QwtSlider.BgSlot)
        self._volume_slider.setRange(0, 20, 1)
        self._volume_slider.setValue(self.volume)
        self._volume_slider.setMinimumWidth(200)
        self._volume_slider.valueChanged.connect(self.set_volume)
        self._volume_layout.addWidget(self._volume_slider)
        self.top_layout.addLayout(self._volume_layout)
        self._freq_layout = Qt.QVBoxLayout()
        self._freq_tool_bar = Qt.QToolBar(self)
        self._freq_layout.addWidget(self._freq_tool_bar)
        self._freq_tool_bar.addWidget(Qt.QLabel("freq" + ": "))
        self._freq_counter = Qwt.QwtCounter()
        self._freq_counter.setRange(76e6, 108e6, 200e3)
        self._freq_counter.setNumButtons(2)
        self._freq_counter.setValue(self.freq)
        self._freq_tool_bar.addWidget(self._freq_counter)
        self._freq_counter.valueChanged.connect(self.set_freq)
        self._freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._freq_slider.setRange(76e6, 108e6, 200e3)
        self._freq_slider.setValue(self.freq)
        self._freq_slider.setMinimumWidth(200)
        self._freq_slider.valueChanged.connect(self.set_freq)
        self._freq_layout.addWidget(self._freq_slider)
        self.top_layout.addLayout(self._freq_layout)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "")
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(0, 0)
        self.rtlsdr_source_0.set_gain(10, 0)
        self.rtlsdr_source_0.set_if_gain(30, 0)
        self.rtlsdr_source_0.set_bb_gain(30, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_win)

        self.low_pass_filter_1 = filter.interp_fir_filter_fff(
            1, firdes.low_pass(1, 48e3, 15e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            10,
            firdes.low_pass(1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume, ))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate / 10,
            audio_decimation=6,
        )
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=samp_rate / 10,
                                                   tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.analog_fm_deemph_0, 0))
        self.connect((self.analog_fm_deemph_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_sink_x_0, 0))
Exemplo n.º 16
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.sps = sps = 4
        self.nfilts = nfilts = 32
        self.ntaps = ntaps = 11 * nfilts * sps
        self.excess_bw = excess_bw = 0.4
        self.tx_taps = tx_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.1, excess_bw, ntaps)
        self.timing_bw = timing_bw = 2 * pi / 100
        self.samp_rate = samp_rate = 80000
        self.rx_taps = rx_taps = firdes.root_raised_cosine(
            nfilts, nfilts * sps, 1.1, excess_bw, ntaps)
        self.gain2 = gain2 = 0
        self.gain = gain = 0.22
        self.freq_bw = freq_bw = 2 * pi / 100
        self.const_points = const_points = 8

        ##################################################
        # Blocks
        ##################################################
        self._gain2_layout = Qt.QVBoxLayout()
        self._gain2_tool_bar = Qt.QToolBar(self)
        self._gain2_layout.addWidget(self._gain2_tool_bar)
        self._gain2_tool_bar.addWidget(Qt.QLabel("gain2" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._gain2_counter = qwt_counter_pyslot()
        self._gain2_counter.setRange(-100e6, 100e6, 100e3)
        self._gain2_counter.setNumButtons(2)
        self._gain2_counter.setValue(self.gain2)
        self._gain2_tool_bar.addWidget(self._gain2_counter)
        self._gain2_counter.valueChanged.connect(self.set_gain2)
        self._gain2_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                           Qwt.QwtSlider.BottomScale,
                                           Qwt.QwtSlider.BgSlot)
        self._gain2_slider.setRange(-100e6, 100e6, 100e3)
        self._gain2_slider.setValue(self.gain2)
        self._gain2_slider.setMinimumWidth(200)
        self._gain2_slider.valueChanged.connect(self.set_gain2)
        self._gain2_layout.addWidget(self._gain2_slider)
        self.top_layout.addLayout(self._gain2_layout)
        self._gain_layout = Qt.QVBoxLayout()
        self._gain_tool_bar = Qt.QToolBar(self)
        self._gain_layout.addWidget(self._gain_tool_bar)
        self._gain_tool_bar.addWidget(Qt.QLabel("gain" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._gain_counter = qwt_counter_pyslot()
        self._gain_counter.setRange(0, 1, 0.001)
        self._gain_counter.setNumButtons(2)
        self._gain_counter.setValue(self.gain)
        self._gain_tool_bar.addWidget(self._gain_counter)
        self._gain_counter.valueChanged.connect(self.set_gain)
        self._gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._gain_slider.setRange(0, 1, 0.001)
        self._gain_slider.setValue(self.gain)
        self._gain_slider.setMinimumWidth(200)
        self._gain_slider.valueChanged.connect(self.set_gain)
        self._gain_layout.addWidget(self._gain_slider)
        self.top_layout.addLayout(self._gain_layout)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "")
        self.rtlsdr_source_0.set_sample_rate(1600e3)
        self.rtlsdr_source_0.set_center_freq(1.2e9 + gain2, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(50, 0)
        self.rtlsdr_source_0.set_if_gain(50, 0)
        self.rtlsdr_source_0.set_bb_gain(50, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "QT GUI Plot",  #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)

        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 xrange(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.top_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, timing_bw, (rx_taps), nfilts, 16, 1.5, 1)
        self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(
            4, 0.4, 55, freq_bw)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(freq_bw, 8)
        self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(
            10, 1, gain, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_cma_equalizer_cc_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.digital_fll_band_edge_cc_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
Exemplo n.º 17
0
    def __init__(self):
        gr.top_block.__init__(self, "SDR Simulation")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("SDR Simulation")
        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", "sdrSim")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.time_offset = time_offset = 1
        self.taps = taps = [1.0, 0.25-0.25j, 0.50 + 0.10j, -0.3 + 0.2j]
        self.samp_rate = samp_rate = 32000
        self.noise_volt = noise_volt = 0.0001
        self.freq_offset = freq_offset = 0

        ##################################################
        # Blocks
        ##################################################
        self._time_offset_layout = Qt.QVBoxLayout()
        self._time_offset_tool_bar = Qt.QToolBar(self)
        self._time_offset_layout.addWidget(self._time_offset_tool_bar)
        self._time_offset_tool_bar.addWidget(Qt.QLabel("Channel Timing Offset"+": "))
        self._time_offset_counter = Qwt.QwtCounter()
        self._time_offset_counter.setRange(0.999, 1.001, 0.0001)
        self._time_offset_counter.setNumButtons(2)
        self._time_offset_counter.setValue(self.time_offset)
        self._time_offset_tool_bar.addWidget(self._time_offset_counter)
        self._time_offset_counter.valueChanged.connect(self.set_time_offset)
        self._time_offset_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._time_offset_slider.setRange(0.999, 1.001, 0.0001)
        self._time_offset_slider.setValue(self.time_offset)
        self._time_offset_slider.setMinimumWidth(200)
        self._time_offset_slider.valueChanged.connect(self.set_time_offset)
        self._time_offset_layout.addWidget(self._time_offset_slider)
        self.top_layout.addLayout(self._time_offset_layout)
        self._noise_volt_layout = Qt.QVBoxLayout()
        self._noise_volt_tool_bar = Qt.QToolBar(self)
        self._noise_volt_layout.addWidget(self._noise_volt_tool_bar)
        self._noise_volt_tool_bar.addWidget(Qt.QLabel("Channel Noise Voltage"+": "))
        self._noise_volt_counter = Qwt.QwtCounter()
        self._noise_volt_counter.setRange(0, 1, 0.01)
        self._noise_volt_counter.setNumButtons(2)
        self._noise_volt_counter.setValue(self.noise_volt)
        self._noise_volt_tool_bar.addWidget(self._noise_volt_counter)
        self._noise_volt_counter.valueChanged.connect(self.set_noise_volt)
        self._noise_volt_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._noise_volt_slider.setRange(0, 1, 0.01)
        self._noise_volt_slider.setValue(self.noise_volt)
        self._noise_volt_slider.setMinimumWidth(200)
        self._noise_volt_slider.valueChanged.connect(self.set_noise_volt)
        self._noise_volt_layout.addWidget(self._noise_volt_slider)
        self.top_layout.addLayout(self._noise_volt_layout)
        self._freq_offset_layout = Qt.QVBoxLayout()
        self._freq_offset_tool_bar = Qt.QToolBar(self)
        self._freq_offset_layout.addWidget(self._freq_offset_tool_bar)
        self._freq_offset_tool_bar.addWidget(Qt.QLabel("Channel Frequency Offset"+": "))
        self._freq_offset_counter = Qwt.QwtCounter()
        self._freq_offset_counter.setRange(-0.1, 0.1, 0.001)
        self._freq_offset_counter.setNumButtons(2)
        self._freq_offset_counter.setValue(self.freq_offset)
        self._freq_offset_tool_bar.addWidget(self._freq_offset_counter)
        self._freq_offset_counter.valueChanged.connect(self.set_freq_offset)
        self._freq_offset_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._freq_offset_slider.setRange(-0.1, 0.1, 0.001)
        self._freq_offset_slider.setValue(self.freq_offset)
        self._freq_offset_slider.setMinimumWidth(200)
        self._freq_offset_slider.valueChanged.connect(self.set_freq_offset)
        self._freq_offset_layout.addWidget(self._freq_offset_slider)
        self.top_layout.addLayout(self._freq_offset_layout)
        self.sdrTX_0 = sdrTX()
        self.sdrRX_0 = sdrRX()
Exemplo n.º 18
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.used_id_bits = used_id_bits = 8
        self.subcarriers = subcarriers = 208
        self.id_blocks = id_blocks = 1
        self.fft_length = fft_length = 256
        self.fbmc = fbmc = 1
        self.estimation_preamble = estimation_preamble = 0
        self.data_blocks = data_blocks = 10
        self.training_data = training_data = default_block_header(subcarriers,fft_length,fbmc,estimation_preamble,[])
        self.repeated_id_bits = repeated_id_bits = subcarriers/used_id_bits
        self.data_part = data_part = data_blocks + id_blocks
        self.whitener_seed = whitener_seed = seed(1)
        self.whitener_pn = whitener_pn = [randint(0,1) for i in range(used_id_bits*repeated_id_bits)]
        self.variable_function_probe_2 = variable_function_probe_2 = 0
        self.variable_function_probe_1 = variable_function_probe_1 = 0
        self.variable_function_probe_0 = variable_function_probe_0 = 0
        self.tx_hostname = tx_hostname = "localhost"
        self.samp_rate = samp_rate = 4*250000
        self.interleaver = interleaver = trellis.interleaver(2000,666)
        self.frame_length = frame_length = 2*data_part + training_data.fbmc_no_preambles
        self.filter_length = filter_length = 4
        self.disable_freq_sync = disable_freq_sync = 1
        self.coding = coding = 1
        self.chunkdivisor = chunkdivisor = int(numpy.ceil(data_blocks/5.0))
        self.ber_window = ber_window = 100000
        self.amplitude = amplitude = 1
        self.SNR = SNR = 40

        ##################################################
        # Blocks
        ##################################################
        self._amplitude_layout = Qt.QVBoxLayout()
        self._amplitude_tool_bar = Qt.QToolBar(self)
        self._amplitude_layout.addWidget(self._amplitude_tool_bar)
        self._amplitude_tool_bar.addWidget(Qt.QLabel("amplitude"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._amplitude_counter = qwt_counter_pyslot()
        self._amplitude_counter.setRange(0, 1, 0.02)
        self._amplitude_counter.setNumButtons(2)
        self._amplitude_counter.setValue(self.amplitude)
        self._amplitude_tool_bar.addWidget(self._amplitude_counter)
        self._amplitude_counter.valueChanged.connect(self.set_amplitude)
        self._amplitude_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._amplitude_slider.setRange(0, 1, 0.02)
        self._amplitude_slider.setValue(self.amplitude)
        self._amplitude_slider.setMinimumWidth(200)
        self._amplitude_slider.valueChanged.connect(self.set_amplitude)
        self._amplitude_layout.addWidget(self._amplitude_slider)
        self.top_layout.addLayout(self._amplitude_layout)
        self.tx_rpc_manager_0 = tx_rpc_manager(fft_length, subcarriers, data_blocks, frame_length, 0, 0.0, samp_rate)
        self.tigr_transmit_control_0 = tigr_transmit_control(
            subcarriers=subcarriers,
            fft_length=fft_length,
            used_id_bits=used_id_bits,
            estimation_preamble=estimation_preamble,
            filter_length=filter_length,
            fbmc=fbmc,
            data_blocks=data_blocks,
            data_part=data_part,
            repeated_id_bits=repeated_id_bits,
            coding=coding,
        )
        self.tigr_scatterplot_0 = tigr_scatterplot(
            subcarriers=subcarriers,
            fbmc=fbmc,
            fft_length=fft_length,
            estimation_preamble=estimation_preamble,
            data_blocks=data_blocks,
            data_part=11,
            frame_length=frame_length,
        )
        self.rx_rpc_manager_0 = rx_rpc_manager()
        self.rms = fbmc_rms_amplifier(amplitude, subcarriers)
        self.zeromq_pub_sink_1 = zeromq.pub_sink(gr.sizeof_float, subcarriers, "tcp://*:5559", 100)
        self.zeromq_pub_sink_0 = zeromq.pub_sink(gr.sizeof_float, 1, "tcp://*:5557", 100)
        def _variable_function_probe_2_probe():
            while True:
                val = self.rx_rpc_manager_0.add_set_scatter_subcarrier_interface(self.tigr_scatterplot_0.ofdm_vector_element_0.set_element)
                try:
                    self.set_variable_function_probe_2(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.000000001))
        _variable_function_probe_2_thread = threading.Thread(target=_variable_function_probe_2_probe)
        _variable_function_probe_2_thread.daemon = True
        _variable_function_probe_2_thread.start()
        def _variable_function_probe_1_probe():
            while True:
                val = self.tx_rpc_manager_0.add_tx_modulation_interface(self.tigr_transmit_control_0.ofdm_allocation_src_0.set_allocation)
                try:
                    self.set_variable_function_probe_1(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.000000001))
        _variable_function_probe_1_thread = threading.Thread(target=_variable_function_probe_1_probe)
        _variable_function_probe_1_thread.daemon = True
        _variable_function_probe_1_thread.start()
        def _variable_function_probe_0_probe():
            while True:
                val = self.tx_rpc_manager_0.add_tx_ampl_interface(self.rms.set_rms_amplitude)
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.000000001))
        _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.trellis_permutation_0 = trellis.permutation(interleaver.K(), (interleaver.DEINTER()), 1, gr.sizeof_float*1)
        self.tigr_fbmc_snr_estimator_0 = tigr_fbmc_snr_estimator(
            subcarriers=subcarriers,
            fbmc=fbmc,
            fft_length=fft_length,
            estimation_preamble=estimation_preamble,
            frame_length=frame_length,
        )
        self.tigr_fbmc_inner_receiver_0 = tigr_fbmc_inner_receiver(
            subcarriers=subcarriers,
            fft_length=fft_length,
            data_blocks=data_blocks,
            estimation_preamble=estimation_preamble,
            filter_length=filter_length,
            frame_length=frame_length,
            disable_freq_sync=disable_freq_sync,
        )
        self.tigr_ber_measurement_0 = tigr_ber_measurement(
            subcarriers=subcarriers,
            fbmc=fbmc,
            fft_length=fft_length,
            estimation_preamble=estimation_preamble,
            ber_window=ber_window,
            data_blocks=data_blocks,
        )
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(0.1, subcarriers)
        self.ofdm_viterbi_combined_fb_0 = ofdm.viterbi_combined_fb(ofdm.fsm(ofdm.fsm(1,2,[91,121])), subcarriers, -1, -1, 2, chunkdivisor, ([-1,-1,-1,1,1,-1,1,1]), ofdm.TRELLIS_EUCLIDEAN)
        self.ofdm_vector_sampler_0 = ofdm.vector_sampler(gr.sizeof_gr_complex*subcarriers, 1)
        self.ofdm_vector_padding_0 = ofdm.vector_padding(subcarriers, fft_length,  -1)
        self.ofdm_multiply_frame_fc_0 = ofdm.multiply_frame_fc(data_part, subcarriers)
        self.ofdm_multiply_const_ii_0 = ofdm.multiply_const_ii(1./int(numpy.ceil(data_blocks/5.0)))
        self.ofdm_generic_softdemapper_vcf_0 = ofdm.generic_softdemapper_vcf(subcarriers, data_part, 1)
        self.ofdm_fbmc_separate_vcvc_1 = ofdm.fbmc_separate_vcvc(fft_length, 2)
        self.ofdm_fbmc_polyphase_network_vcvc_1 = ofdm.fbmc_polyphase_network_vcvc(fft_length, filter_length, filter_length*fft_length-1, False)
        self.ofdm_fbmc_polyphase_network_vcvc_0 = ofdm.fbmc_polyphase_network_vcvc(fft_length, filter_length, filter_length*fft_length-1, False)
        self.ofdm_fbmc_pilot_block_inserter_0 = fbmc_pilot_block_inserter(subcarriers, data_part, training_data, 5)
        self.ofdm_fbmc_pilot_block_filter_0 = fbmc_pilot_block_filter(subcarriers, frame_length, data_part, training_data)
        self.ofdm_fbmc_overlapping_parallel_to_serial_vcc_0 = ofdm.fbmc_overlapping_parallel_to_serial_vcc(fft_length)
        self.ofdm_fbmc_oqam_preprocessing_vcvc_0 = ofdm.fbmc_oqam_preprocessing_vcvc(subcarriers, 0, 0)
        self.ofdm_fbmc_frame_sampler_0 = fbmc_frame_sampler(subcarriers, frame_length, data_part, training_data)
        self.ofdm_fbmc_beta_multiplier_vcvc_0 = ofdm.fbmc_beta_multiplier_vcvc(fft_length, filter_length, fft_length*fft_length-1, 0)
        self.ofdm_dynamic_trigger_ib_0 = ofdm.dynamic_trigger_ib(0)
        self.ofdm_depuncture_ff_0 = ofdm.depuncture_ff(subcarriers, 0)
        self.ofdm_coded_bpsk_soft_decoder_0 = ofdm.coded_bpsk_soft_decoder(subcarriers, used_id_bits, (whitener_pn))
        self.ofdm_allocation_buffer_0 = ofdm.allocation_buffer(subcarriers, data_blocks, "tcp://"+tx_hostname+":3333", 1)
        self.fft_vxx_1 = fft.fft_vcc(fft_length, False, ([]), True, 1)
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=math.sqrt(1.0*fft_length/subcarriers)*math.sqrt(0.5)*10**(-SNR/20.0),
        	frequency_offset=0.0/fft_length,
        	epsilon=1,
        	taps=((1.0 ), ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_b([1] + [0]*(data_blocks/2-1), True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*subcarriers, 20)
        self.blks2_selector_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=0,
        	output_index=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.ofdm_fbmc_polyphase_network_vcvc_0, 0), (self.ofdm_fbmc_overlapping_parallel_to_serial_vcc_0, 0))
        self.connect((self.ofdm_fbmc_polyphase_network_vcvc_1, 0), (self.ofdm_fbmc_overlapping_parallel_to_serial_vcc_0, 1))
        self.connect((self.ofdm_fbmc_separate_vcvc_1, 1), (self.ofdm_fbmc_polyphase_network_vcvc_1, 0))
        self.connect((self.ofdm_fbmc_oqam_preprocessing_vcvc_0, 0), (self.ofdm_fbmc_pilot_block_inserter_0, 0))
        self.connect((self.ofdm_fbmc_pilot_block_inserter_0, 0), (self.ofdm_vector_padding_0, 0))
        self.connect((self.ofdm_fbmc_beta_multiplier_vcvc_0, 0), (self.fft_vxx_1, 0))
        self.connect((self.fft_vxx_1, 0), (self.ofdm_fbmc_separate_vcvc_1, 0))
        self.connect((self.tigr_transmit_control_0, 0), (self.ofdm_fbmc_oqam_preprocessing_vcvc_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_1, 0))
        self.connect((self.ofdm_fbmc_frame_sampler_0, 1), (self.ofdm_fbmc_pilot_block_filter_0, 1))
        self.connect((self.ofdm_fbmc_frame_sampler_0, 0), (self.ofdm_fbmc_pilot_block_filter_0, 0))
        self.connect((self.ofdm_fbmc_pilot_block_filter_0, 1), (self.ofdm_vector_sampler_0, 1))
        self.connect((self.ofdm_vector_sampler_0, 0), (self.ofdm_coded_bpsk_soft_decoder_0, 0))
        self.connect((self.ofdm_coded_bpsk_soft_decoder_0, 0), (self.ofdm_allocation_buffer_0, 0))
        self.connect((self.ofdm_allocation_buffer_0, 1), (self.ofdm_generic_softdemapper_vcf_0, 1))
        self.connect((self.single_pole_iir_filter_xx_0, 0), (self.ofdm_generic_softdemapper_vcf_0, 2))
        self.connect((self.ofdm_generic_softdemapper_vcf_0, 0), (self.trellis_permutation_0, 0))
        self.connect((self.ofdm_depuncture_ff_0, 0), (self.ofdm_viterbi_combined_fb_0, 0))
        self.connect((self.ofdm_allocation_buffer_0, 1), (self.ofdm_depuncture_ff_0, 1))
        self.connect((self.blocks_vector_source_x_0, 0), (self.ofdm_depuncture_ff_0, 2))
        self.connect((self.ofdm_allocation_buffer_0, 0), (self.ofdm_multiply_const_ii_0, 0))
        self.connect((self.ofdm_multiply_const_ii_0, 0), (self.ofdm_viterbi_combined_fb_0, 1))
        self.connect((self.ofdm_fbmc_separate_vcvc_1, 0), (self.ofdm_fbmc_polyphase_network_vcvc_0, 0))
        self.connect((self.ofdm_viterbi_combined_fb_0, 0), (self.tigr_ber_measurement_0, 2))
        self.connect((self.ofdm_dynamic_trigger_ib_0, 0), (self.tigr_ber_measurement_0, 3))
        self.connect((self.ofdm_fbmc_frame_sampler_0, 0), (self.tigr_fbmc_snr_estimator_0, 0))
        self.connect((self.ofdm_fbmc_frame_sampler_0, 1), (self.tigr_fbmc_snr_estimator_0, 1))
        self.connect((self.tigr_fbmc_inner_receiver_0, 1), (self.ofdm_fbmc_frame_sampler_0, 1))
        self.connect((self.tigr_fbmc_inner_receiver_0, 2), (self.ofdm_fbmc_frame_sampler_0, 0))
        self.connect((self.rms, 0), (self.blocks_throttle_0, 0))
        self.connect((self.tigr_fbmc_inner_receiver_0, 3), (self.zeromq_pub_sink_0, 0))
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.zeromq_pub_sink_1, 0))
        self.connect((self.ofdm_vector_padding_0, 0), (self.ofdm_fbmc_beta_multiplier_vcvc_0, 0))
        self.connect((self.tigr_fbmc_inner_receiver_0, 0), (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.ofdm_fbmc_overlapping_parallel_to_serial_vcc_0, 0), (self.rms, 0))
        self.connect((self.ofdm_allocation_buffer_0, 0), (self.ofdm_dynamic_trigger_ib_0, 0))
        self.connect((self.ofdm_coded_bpsk_soft_decoder_0, 0), (self.tigr_ber_measurement_0, 0))
        self.connect((self.ofdm_allocation_buffer_0, 0), (self.tigr_ber_measurement_0, 1))
        self.connect((self.blks2_selector_0, 0), (self.ofdm_depuncture_ff_0, 0))
        self.connect((self.trellis_permutation_0, 0), (self.blks2_selector_0, 1))
        self.connect((self.ofdm_generic_softdemapper_vcf_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.tigr_fbmc_inner_receiver_0, 0))
        self.connect((self.ofdm_fbmc_pilot_block_filter_0, 0), (self.ofdm_vector_sampler_0, 0))
        self.connect((self.ofdm_allocation_buffer_0, 2), (self.ofdm_multiply_frame_fc_0, 1))
        self.connect((self.ofdm_fbmc_pilot_block_filter_0, 0), (self.ofdm_multiply_frame_fc_0, 0))
        self.connect((self.ofdm_multiply_frame_fc_0, 0), (self.tigr_scatterplot_0, 0))
        self.connect((self.ofdm_multiply_frame_fc_0, 0), (self.ofdm_generic_softdemapper_vcf_0, 0))
Exemplo n.º 19
0
def qwtHSlider(widget,
               master,
               value,
               box=None,
               label=None,
               labelWidth=None,
               minValue=1,
               maxValue=10,
               step=0.1,
               precision=1,
               callback=None,
               logarithmic=0,
               ticks=0,
               maxWidth=80,
               tooltip=None,
               showValueLabel=1,
               debuggingEnabled=1,
               addSpace=False,
               orientation=0):
    import PyQt4.Qwt5 as qwt

    if label:
        hb = widgetBox(widget, box, orientation)
        lbl = widgetLabel(hb, label)
        if labelWidth:
            lbl.setFixedSize(labelWidth, lbl.sizeHint().height())
        if orientation and orientation != "horizontal":
            separator(hb, height=2)
            hb = widgetBox(hb, 0)
    else:
        hb = widgetBox(widget, box, 0)

    if ticks:
        slider = qwt.QwtSlider(hb, Qt.Horizontal, qwt.QwtSlider.Bottom,
                               qwt.QwtSlider.BgSlot)
    else:
        slider = qwt.QwtSlider(hb, Qt.Horizontal, qwt.QwtSlider.NoScale,
                               qwt.QwtSlider.BgSlot)
    hb.layout().addWidget(slider)

    slider.setScale(minValue, maxValue,
                    0)  # the third parameter for logaritmic scale
    slider.setScaleMaxMinor(10)
    slider.setThumbWidth(20)
    slider.setThumbLength(12)
    if maxWidth:
        slider.setMaximumSize(maxWidth, 40)
    slider.setRange(minValue, maxValue, step)
    slider.setValue(value)
    if tooltip:
        hb.setToolTip(tooltip)

    if showValueLabel:
        if type(precision) == str: format = precision
        else: format = " %s.%df" % ("%", precision)
        lbl = widgetLabel(hb, format % minValue)
        width1 = lbl.sizeHint().width()
        lbl.setText(format % maxValue)
        width2 = lbl.sizeHint().width()
        lbl.setFixedSize(max(width1, width2), lbl.sizeHint().height())
        lbl.setText(format % value)
        lbl.setLbl = lambda x, l=lbl, f=format: l.setText(f % (x))
        QObject.connect(slider, SIGNAL("valueChanged(double)"), lbl.setLbl)
    if callback:
        master.connect(slider, SIGNAL("valueChanged(double)"), callback)
    slider.box = hb
    return slider
Exemplo n.º 20
0
    def __init__(self):
        gr.top_block.__init__(self, "Ofdm Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Ofdm Tx")
        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", "ofdm_tx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.packet_len = packet_len = 100
        self.len_tag_key = len_tag_key = "packet_len"
        self.gain = gain = 60
        self.fft_len = fft_len = 128

        ##################################################
        # Blocks
        ##################################################
        self._gain_layout = Qt.QVBoxLayout()
        self._gain_tool_bar = Qt.QToolBar(self)
        self._gain_layout.addWidget(self._gain_tool_bar)
        self._gain_tool_bar.addWidget(Qt.QLabel("gain" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._gain_counter = qwt_counter_pyslot()
        self._gain_counter.setRange(0, 90, 1)
        self._gain_counter.setNumButtons(2)
        self._gain_counter.setValue(self.gain)
        self._gain_tool_bar.addWidget(self._gain_counter)
        self._gain_counter.valueChanged.connect(self.set_gain)
        self._gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._gain_slider.setRange(0, 90, 1)
        self._gain_slider.setValue(self.gain)
        self._gain_slider.setMinimumWidth(200)
        self._gain_slider.valueChanged.connect(self.set_gain)
        self._gain_layout.addWidget(self._gain_slider)
        self.top_layout.addLayout(self._gain_layout)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("A:A", 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(400e6, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=2,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.fosdem_burst_marker_0 = fosdem.burst_marker(
            gr.sizeof_gr_complex, len_tag_key, 0)
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
            fft_len=fft_len,
            cp_len=fft_len / 4,
            packet_length_tag_key=len_tag_key,
            bps_header=1,
            bps_payload=2,
            rolloff=0,
            debug_log=False,
            scramble_bits=True)
        self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(
            gr.sizeof_gr_complex * 1, len_tag_key, 2)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, "packet_len")
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, ))
        self.blocks_message_strobe_0 = blocks.message_strobe(
            pmt.cons(pmt.PMT_NIL, pmt.make_u8vector(packet_len, 0xAA)), 1000)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_tagged_stream_multiply_length_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_tagged_stream_multiply_length_0, 0),
                     (self.fosdem_burst_marker_0, 0))
        self.connect((self.fosdem_burst_marker_0, 0),
                     (self.uhd_usrp_sink_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.blocks_message_strobe_0, "strobe",
                         self.blocks_pdu_to_tagged_stream_0, "pdus")
Exemplo n.º 21
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.samp_rate = samp_rate = 5000000
        self.packet_len = packet_len = 2**19
        self.freq_res = freq_res = samp_rate/float(packet_len)
        self.freq = freq = (-1000000,1000000)
        self.center_freq = center_freq = 2.45e9
        self.vel = vel = 50
        self.v_res = v_res = freq_res*3e8/2/center_freq
        self.time_res = time_res = packet_len/float(samp_rate)
        self.range_res = range_res = 3e8/2/float((freq[1]-freq[0]))
        self.min_output_buffer = min_output_buffer = int(packet_len*2)
        self.decim_fac = decim_fac = 2**10
        self.Range = Range = 30

        ##################################################
        # Blocks
        ##################################################
        self._vel_layout = Qt.QVBoxLayout()
        self._vel_tool_bar = Qt.QToolBar(self)
        self._vel_layout.addWidget(self._vel_tool_bar)
        self._vel_tool_bar.addWidget(Qt.QLabel("vel"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._vel_counter = qwt_counter_pyslot()
        self._vel_counter.setRange(-50, 50, 0.1)
        self._vel_counter.setNumButtons(2)
        self._vel_counter.setValue(self.vel)
        self._vel_tool_bar.addWidget(self._vel_counter)
        self._vel_counter.valueChanged.connect(self.set_vel)
        self._vel_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._vel_slider.setRange(-50, 50, 0.1)
        self._vel_slider.setValue(self.vel)
        self._vel_slider.setMinimumWidth(200)
        self._vel_slider.valueChanged.connect(self.set_vel)
        self._vel_layout.addWidget(self._vel_slider)
        self.top_layout.addLayout(self._vel_layout)
        self._Range_layout = Qt.QVBoxLayout()
        self._Range_tool_bar = Qt.QToolBar(self)
        self._Range_layout.addWidget(self._Range_tool_bar)
        self._Range_tool_bar.addWidget(Qt.QLabel("Range"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._Range_counter = qwt_counter_pyslot()
        self._Range_counter.setRange(0, 100, 1)
        self._Range_counter.setNumButtons(2)
        self._Range_counter.setValue(self.Range)
        self._Range_tool_bar.addWidget(self._Range_counter)
        self._Range_counter.valueChanged.connect(self.set_Range)
        self._Range_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._Range_slider.setRange(0, 100, 1)
        self._Range_slider.setValue(self.Range)
        self._Range_slider.setMinimumWidth(200)
        self._Range_slider.valueChanged.connect(self.set_Range)
        self._Range_layout.addWidget(self._Range_slider)
        self.top_layout.addLayout(self._Range_layout)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=decim_fac,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=decim_fac,
                taps=None,
                fractional_bw=None,
        )
        self.radar_ts_fft_cc_0_0 = radar.ts_fft_cc(packet_len/decim_fac,  "packet_len")
        (self.radar_ts_fft_cc_0_0).set_min_output_buffer(1048576)
        self.radar_ts_fft_cc_0 = radar.ts_fft_cc(packet_len/decim_fac,  "packet_len")
        (self.radar_ts_fft_cc_0).set_min_output_buffer(1048576)
        self.radar_static_target_simulator_cc_0 = radar.static_target_simulator_cc((Range,), (vel, ), (1e14, ), (0,), (0,), samp_rate, center_freq, -10, True, True, "packet_len")
        (self.radar_static_target_simulator_cc_0).set_min_output_buffer(1048576)
        self.radar_signal_generator_cw_c_0_0 = radar.signal_generator_cw_c(packet_len, samp_rate, (freq[1], ), 0.5, "packet_len")
        (self.radar_signal_generator_cw_c_0_0).set_min_output_buffer(1048576)
        self.radar_signal_generator_cw_c_0 = radar.signal_generator_cw_c(packet_len, samp_rate, (freq[0], ), 0.5, "packet_len")
        (self.radar_signal_generator_cw_c_0).set_min_output_buffer(1048576)
        self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f(
            packet_len/decim_fac,
            0,
            1.0,
            "x-Axis",
            "y-Axis",
            "",
            1 # Number of inputs
        )
        self.qtgui_vector_sink_f_0.set_update_time(0.10)
        self.qtgui_vector_sink_f_0.set_y_axis(-140, 10)
        self.qtgui_vector_sink_f_0.enable_autoscale(True)
        self.qtgui_vector_sink_f_0.enable_grid(False)
        self.qtgui_vector_sink_f_0.set_x_axis_units("")
        self.qtgui_vector_sink_f_0.set_y_axis_units("")
        self.qtgui_vector_sink_f_0.set_ref_level(0)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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_vector_sink_f_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_vector_sink_f_0.set_line_label(i, labels[i])
            self.qtgui_vector_sink_f_0.set_line_width(i, widths[i])
            self.qtgui_vector_sink_f_0.set_line_color(i, colors[i])
            self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_vector_sink_f_0_win)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        (self.blocks_throttle_0_0).set_min_output_buffer(1048576)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        (self.blocks_throttle_0).set_min_output_buffer(1048576)
        self.blocks_tagged_stream_multiply_length_0_0 = blocks.tagged_stream_multiply_length(gr.sizeof_gr_complex*1, "packet_len", 1.0/float(decim_fac))
        (self.blocks_tagged_stream_multiply_length_0_0).set_min_output_buffer(1048576)
        self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(gr.sizeof_gr_complex*1, "packet_len", 1.0/float(decim_fac))
        (self.blocks_tagged_stream_multiply_length_0).set_min_output_buffer(1048576)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_float*1, packet_len/decim_fac)
        self.blocks_multiply_conjugate_cc_1 = blocks.multiply_conjugate_cc(1)
        (self.blocks_multiply_conjugate_cc_1).set_min_output_buffer(1048576)
        self.blocks_multiply_conjugate_cc_0_0 = blocks.multiply_conjugate_cc(1)
        (self.blocks_multiply_conjugate_cc_0_0).set_min_output_buffer(1048576)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        (self.blocks_multiply_conjugate_cc_0).set_min_output_buffer(1048576)
        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_1).set_min_output_buffer(1048576)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        (self.blocks_add_xx_0).set_min_output_buffer(1048576)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.5, 0)
        (self.analog_noise_source_x_0).set_min_output_buffer(1048576)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.radar_signal_generator_cw_c_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.radar_signal_generator_cw_c_0_0, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_1, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.blocks_add_xx_1, 0), (self.radar_static_target_simulator_cc_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_conjugate_cc_0_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_multiply_conjugate_cc_0_0, 1))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.radar_ts_fft_cc_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0))
        self.connect((self.blocks_tagged_stream_multiply_length_0_0, 0), (self.radar_ts_fft_cc_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_tagged_stream_multiply_length_0_0, 0))
        self.connect((self.radar_ts_fft_cc_0_0, 0), (self.blocks_multiply_conjugate_cc_1, 1))
        self.connect((self.radar_ts_fft_cc_0, 0), (self.blocks_multiply_conjugate_cc_1, 0))
        self.connect((self.radar_static_target_simulator_cc_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_1, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.qtgui_vector_sink_f_0, 0))
Exemplo n.º 22
0
    def __init__(self, ppm_param=0):
        gr.top_block.__init__(self, "Airprobe Bladerf")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Airprobe Bladerf")
        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", "airprobe_bladerf")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.ppm_param = ppm_param

        ##################################################
        # Variables
        ##################################################
        self.usrp_samp = usrp_samp = 12.5e6
        self.usrp_gn = usrp_gn = 15
        self.samp_rate = samp_rate = 2000000.052982
        self.ppm = ppm = ppm_param
        self.g = g = 43
        self.fc = fc = 939.4e6
        self.SDCCH = SDCCH = 6
        self.RACH = RACH = 3
        self.PCH = PCH = 5
        self.Frequency = Frequency = 947e6
        self.CHANNEL_UNKNOWN = CHANNEL_UNKNOWN = 0
        self.CCCH = CCCH = 2
        self.BandWidth = BandWidth = 250000
        self.BCCH = BCCH = 1
        self.AGCH = AGCH = 4

        ##################################################
        # Blocks
        ##################################################
        self._ppm_layout = Qt.QHBoxLayout()
        self._ppm_layout.addWidget(Qt.QLabel("clock_correction [ppm]" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._ppm_counter = qwt_counter_pyslot()
        self._ppm_counter.setRange(-150, 150, 1)
        self._ppm_counter.setNumButtons(2)
        self._ppm_counter.setMinimumWidth(100)
        self._ppm_counter.setValue(self.ppm)
        self._ppm_layout.addWidget(self._ppm_counter)
        self._ppm_counter.valueChanged.connect(self.set_ppm)
        self.top_layout.addLayout(self._ppm_layout)
        self._g_layout = Qt.QHBoxLayout()
        self._g_layout.addWidget(Qt.QLabel("gain" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._g_counter = qwt_counter_pyslot()
        self._g_counter.setRange(0, 50, 0.5)
        self._g_counter.setNumButtons(2)
        self._g_counter.setMinimumWidth(100)
        self._g_counter.setValue(self.g)
        self._g_layout.addWidget(self._g_counter)
        self._g_counter.valueChanged.connect(self.set_g)
        self.top_layout.addLayout(self._g_layout)
        self._fc_layout = Qt.QVBoxLayout()
        self._fc_tool_bar = Qt.QToolBar(self)
        self._fc_layout.addWidget(self._fc_tool_bar)
        self._fc_tool_bar.addWidget(Qt.QLabel("center_frequency" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._fc_counter = qwt_counter_pyslot()
        self._fc_counter.setRange(925e6, 960e6, 2e5)
        self._fc_counter.setNumButtons(2)
        self._fc_counter.setValue(self.fc)
        self._fc_tool_bar.addWidget(self._fc_counter)
        self._fc_counter.valueChanged.connect(self.set_fc)
        self._fc_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                        Qwt.QwtSlider.BottomScale,
                                        Qwt.QwtSlider.BgSlot)
        self._fc_slider.setRange(925e6, 960e6, 2e5)
        self._fc_slider.setValue(self.fc)
        self._fc_slider.setMinimumWidth(100)
        self._fc_slider.valueChanged.connect(self.set_fc)
        self._fc_layout.addWidget(self._fc_slider)
        self.top_layout.addLayout(self._fc_layout)
        self._usrp_samp_layout = Qt.QVBoxLayout()
        self._usrp_samp_label = Qt.QLabel("Sampling ")
        self._usrp_samp_slider = Qwt.QwtSlider(None, Qt.Qt.Vertical,
                                               Qwt.QwtSlider.LeftScale,
                                               Qwt.QwtSlider.BgSlot)
        self._usrp_samp_slider.setRange(0, 25e6, 1)
        self._usrp_samp_slider.setValue(self.usrp_samp)
        self._usrp_samp_slider.setMinimumHeight(200)
        self._usrp_samp_slider.valueChanged.connect(self.set_usrp_samp)
        self._usrp_samp_label.setAlignment(Qt.Qt.AlignTop)
        self._usrp_samp_layout.addWidget(self._usrp_samp_slider)
        self._usrp_samp_layout.addWidget(self._usrp_samp_label)
        self.top_grid_layout.addLayout(self._usrp_samp_layout, 0, 64, 1, 1)
        self._usrp_gn_layout = Qt.QVBoxLayout()
        self._usrp_gn_label = Qt.QLabel("Gain RX")
        self._usrp_gn_slider = Qwt.QwtSlider(None, Qt.Qt.Vertical,
                                             Qwt.QwtSlider.LeftScale,
                                             Qwt.QwtSlider.BgSlot)
        self._usrp_gn_slider.setRange(0, 50, 1)
        self._usrp_gn_slider.setValue(self.usrp_gn)
        self._usrp_gn_slider.setMinimumHeight(200)
        self._usrp_gn_slider.valueChanged.connect(self.set_usrp_gn)
        self._usrp_gn_label.setAlignment(Qt.Qt.AlignTop)
        self._usrp_gn_layout.addWidget(self._usrp_gn_slider)
        self._usrp_gn_layout.addWidget(self._usrp_gn_label)
        self.top_grid_layout.addLayout(self._usrp_gn_layout, 0, 63, 1, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            fc,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.osmosdr_source_1 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            "bladerf=0,fpga=/home/junaid/Downloads/hostedx115.rbf")
        self.osmosdr_source_1.set_sample_rate(samp_rate)
        self.osmosdr_source_1.set_center_freq(fc, 0)
        self.osmosdr_source_1.set_freq_corr(ppm, 0)
        self.osmosdr_source_1.set_dc_offset_mode(0, 0)
        self.osmosdr_source_1.set_iq_balance_mode(0, 0)
        self.osmosdr_source_1.set_gain_mode(False, 0)
        self.osmosdr_source_1.set_gain(g, 0)
        self.osmosdr_source_1.set_if_gain(20, 0)
        self.osmosdr_source_1.set_bb_gain(20, 0)
        self.osmosdr_source_1.set_antenna("", 0)
        self.osmosdr_source_1.set_bandwidth(250e3, 0)

        self.gsm_universal_ctrl_chans_demapper_0 = gsm.universal_ctrl_chans_demapper(
            ([2, 6, 12, 16, 22, 26, 32, 36, 42, 46]),
            ([BCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH, CCCH]))
        self.gsm_receiver_0 = gsm.receiver(4, ([0]), ([]))
        self.gsm_message_printer_1 = gsm.message_printer()
        self.gsm_input_0 = gsm.gsm_input(
            ppm=0,
            osr=4,
            fc=fc,
            samp_rate_in=samp_rate,
        )
        self.gsm_control_channels_decoder_0 = gsm.control_channels_decoder()
        self.gsm_clock_offset_control_0 = gsm.clock_offset_control(fc)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1",
                                                     "4729", 10000, False)
        self._Frequency_layout = Qt.QVBoxLayout()
        self._Frequency_label = Qt.QLabel("Center Frequency")
        self._Frequency_slider = Qwt.QwtSlider(None, Qt.Qt.Vertical,
                                               Qwt.QwtSlider.LeftScale,
                                               Qwt.QwtSlider.BgSlot)
        self._Frequency_slider.setRange(400e6, 4e9, 100000)
        self._Frequency_slider.setValue(self.Frequency)
        self._Frequency_slider.setMinimumHeight(200)
        self._Frequency_slider.valueChanged.connect(self.set_Frequency)
        self._Frequency_label.setAlignment(Qt.Qt.AlignTop)
        self._Frequency_layout.addWidget(self._Frequency_slider)
        self._Frequency_layout.addWidget(self._Frequency_label)
        self.top_grid_layout.addLayout(self._Frequency_layout, 0, 62, 1, 1)
        self._BandWidth_layout = Qt.QVBoxLayout()
        self._BandWidth_label = Qt.QLabel("BandWidth")
        self._BandWidth_slider = Qwt.QwtSlider(None, Qt.Qt.Vertical,
                                               Qwt.QwtSlider.LeftScale,
                                               Qwt.QwtSlider.BgSlot)
        self._BandWidth_slider.setRange(0, 1e6, 100)
        self._BandWidth_slider.setValue(self.BandWidth)
        self._BandWidth_slider.setMinimumHeight(200)
        self._BandWidth_slider.valueChanged.connect(self.set_BandWidth)
        self._BandWidth_label.setAlignment(Qt.Qt.AlignTop)
        self._BandWidth_layout.addWidget(self._BandWidth_slider)
        self._BandWidth_layout.addWidget(self._BandWidth_label)
        self.top_grid_layout.addLayout(self._BandWidth_layout, 0, 61, 1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gsm_input_0, 0), (self.gsm_receiver_0, 0))
        self.connect((self.osmosdr_source_1, 0), (self.gsm_input_0, 0))
        self.connect((self.osmosdr_source_1, 0), (self.qtgui_freq_sink_x_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.gsm_clock_offset_control_0, "ppm",
                         self.gsm_input_0, "ppm_in")
        self.msg_connect(self.gsm_receiver_0, "C0",
                         self.gsm_universal_ctrl_chans_demapper_0, "bursts")
        self.msg_connect(self.gsm_control_channels_decoder_0, "msgs",
                         self.gsm_message_printer_1, "msgs")
        self.msg_connect(self.gsm_control_channels_decoder_0, "msgs",
                         self.blocks_socket_pdu_0, "pdus")
        self.msg_connect(self.gsm_universal_ctrl_chans_demapper_0, "bursts",
                         self.gsm_control_channels_decoder_0, "bursts")
        self.msg_connect(self.gsm_receiver_0, "measurements",
                         self.gsm_clock_offset_control_0, "measurements")
Exemplo n.º 23
0
    def __init__(self):
        gr.top_block.__init__(self, "Sync Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Sync Test")
        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", "sync_test")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.pream_len = pream_len = 84
        self.samp_rate = samp_rate = 32000
        self.pream = pream = (mapper.preamble_generator(pream_len, 511,
                                                        1033)).get_preamble()
        self.SNR = SNR = 40
        self.Rotation = Rotation = 0
        self.Offset = Offset = 0

        ##################################################
        # Blocks
        ##################################################
        self._SNR_tool_bar = Qt.QToolBar(self)
        self._SNR_tool_bar.addWidget(Qt.QLabel("SNR" + ": "))
        self._SNR_line_edit = Qt.QLineEdit(str(self.SNR))
        self._SNR_tool_bar.addWidget(self._SNR_line_edit)
        self._SNR_line_edit.returnPressed.connect(lambda: self.set_SNR(
            eng_notation.str_to_num(self._SNR_line_edit.text().toAscii())))
        self.top_layout.addWidget(self._SNR_tool_bar)
        self._Rotation_layout = Qt.QVBoxLayout()
        self._Rotation_label = Qt.QLabel("Rotation")
        self._Rotation_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                              Qwt.QwtSlider.BottomScale,
                                              Qwt.QwtSlider.BgSlot)
        self._Rotation_slider.setRange(0, 2 * pi, pi / 100)
        self._Rotation_slider.setValue(self.Rotation)
        self._Rotation_slider.setMinimumWidth(200)
        self._Rotation_slider.valueChanged.connect(self.set_Rotation)
        self._Rotation_label.setAlignment(Qt.Qt.AlignBottom
                                          | Qt.Qt.AlignHCenter)
        self._Rotation_layout.addWidget(self._Rotation_label)
        self._Rotation_layout.addWidget(self._Rotation_slider)
        self.top_layout.addLayout(self._Rotation_layout)
        self._Offset_layout = Qt.QVBoxLayout()
        self._Offset_tool_bar = Qt.QToolBar(self)
        self._Offset_layout.addWidget(self._Offset_tool_bar)
        self._Offset_tool_bar.addWidget(Qt.QLabel("Offset" + ": "))
        self._Offset_counter = Qwt.QwtCounter()
        self._Offset_counter.setRange(-100, 100, 1)
        self._Offset_counter.setNumButtons(2)
        self._Offset_counter.setValue(self.Offset)
        self._Offset_tool_bar.addWidget(self._Offset_counter)
        self._Offset_counter.valueChanged.connect(self.set_Offset)
        self._Offset_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                            Qwt.QwtSlider.BottomScale,
                                            Qwt.QwtSlider.BgSlot)
        self._Offset_slider.setRange(-100, 100, 1)
        self._Offset_slider.setValue(self.Offset)
        self._Offset_slider.setMinimumWidth(200)
        self._Offset_slider.valueChanged.connect(self.set_Offset)
        self._Offset_layout.addWidget(self._Offset_slider)
        self.top_layout.addLayout(self._Offset_layout)
        self.qtgui_const_sink_x_0_1 = qtgui.const_sink_c(
            840 - 84,  #size
            "QT GUI Plot",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_1.set_update_time(0.10)
        self.qtgui_const_sink_x_0_1.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_1.set_x_axis(-2, 2)
        self._qtgui_const_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_1_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            840 - 84,  #size
            "QT GUI Plot",  #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_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self.mapper_preamble_sync_cc_0 = mapper.preamble_sync_cc(
            pream_len * 10, (pream), mapper.PSK8, ([0, 1, 2, 3, 4, 5, 6, 7]),
            .97, .90)
        self.mapper_preamble_insert_bb_0 = mapper.preamble_insert_bb(
            pream_len * 10, (pream))
        self.mapper_mapper_0 = mapper.mapper(mapper.PSK8,
                                             ([0, 1, 2, 3, 4, 5, 6, 7]))
        self.mapper_demapper_0 = mapper.demapper(mapper.PSK8,
                                                 ([0, 1, 2, 3, 4, 5, 6, 7]))
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            1.5 * pi / 100, 8)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=10**(-SNR / 20.0),
            frequency_offset=Offset,
            epsilon=1.0,
            taps=(exp((0 + 1j * Rotation)), ),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_sink_x_0_0 = blocks.vector_sink_b(1)
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(3)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 7, 10000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.mapper_preamble_insert_bb_0, 0),
                     (self.mapper_mapper_0, 0))
        self.connect((self.mapper_preamble_sync_cc_0, 0),
                     (self.mapper_demapper_0, 0))
        self.connect((self.mapper_mapper_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.mapper_preamble_sync_cc_0, 0))
        self.connect((self.mapper_preamble_sync_cc_0, 0),
                     (self.qtgui_const_sink_x_0_1, 0))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.mapper_preamble_insert_bb_0, 0))
        self.connect((self.mapper_demapper_0, 0),
                     (self.blocks_vector_sink_x_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
Exemplo n.º 24
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.data_rate_V2 = data_rate_V2 = 510 * 2
        self.version_chooser = version_chooser = data_rate_V2
        self.freq_range = freq_range = 433.995
        self.audio_rate = audio_rate = 48000
        self.trans = trans = 1.2e3
        self.samp_rate = samp_rate = 2400000
        self.samp_per_sym = samp_per_sym = audio_rate / version_chooser
        self.gain = gain = 390
        self.freq_offset = freq_offset = 100e3
        self.freq = freq = (0 * 433.886e6 + 0 * 433.877e6 +
                            0 * 433.995e6) + freq_range * 1e6 + 100e3
        self.data_rate_V1 = data_rate_V1 = 680
        self.data_rate = data_rate = version_chooser
        self.channel_trans = channel_trans = 2000
        self.channel_spacing = channel_spacing = 25e3

        ##################################################
        # 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, "Frequency")
        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, "Signal")
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, "Datarate")
        self.top_layout.addWidget(self.tab)
        self._gain_layout = Qt.QVBoxLayout()
        self._gain_tool_bar = Qt.QToolBar(self)
        self._gain_layout.addWidget(self._gain_tool_bar)
        self._gain_tool_bar.addWidget(Qt.QLabel("Decoder_Gain" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._gain_counter = qwt_counter_pyslot()
        self._gain_counter.setRange(0, 1000, 1)
        self._gain_counter.setNumButtons(2)
        self._gain_counter.setValue(self.gain)
        self._gain_tool_bar.addWidget(self._gain_counter)
        self._gain_counter.valueChanged.connect(self.set_gain)
        self._gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._gain_slider.setRange(0, 1000, 1)
        self._gain_slider.setValue(self.gain)
        self._gain_slider.setMinimumWidth(1000)
        self._gain_slider.valueChanged.connect(self.set_gain)
        self._gain_layout.addWidget(self._gain_slider)
        self.tab_layout_1.addLayout(self._gain_layout)
        self._version_chooser_options = [data_rate_V1, data_rate_V2]
        self._version_chooser_labels = ["V1", "V2"]
        self._version_chooser_tool_bar = Qt.QToolBar(self)
        self._version_chooser_tool_bar.addWidget(
            Qt.QLabel("Oregon Scientific Version" + ": "))
        self._version_chooser_combo_box = Qt.QComboBox()
        self._version_chooser_tool_bar.addWidget(
            self._version_chooser_combo_box)
        for label in self._version_chooser_labels:
            self._version_chooser_combo_box.addItem(label)
        self._version_chooser_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._version_chooser_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._version_chooser_options.index(i)))
        self._version_chooser_callback(self.version_chooser)
        self._version_chooser_combo_box.currentIndexChanged.connect(
            lambda i: self.set_version_chooser(self._version_chooser_options[i]
                                               ))
        self.tab_grid_layout_2.addWidget(self._version_chooser_tool_bar, 0, 0)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            freq,  #fc
            samp_rate,  #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)

        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.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 2,
                                         0)
        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            freq - freq_offset,  #fc
            samp_rate / 50,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_1.addWidget(self._qtgui_sink_x_0_win)

        self.qtgui_sink_x_0.enable_rf_freq(True)

        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        units = ["", "", "", "", "", "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, -1)
            self.qtgui_number_sink_0.set_max(i, 1)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_1.addWidget(self._qtgui_number_sink_0_win, 0, 0)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            freq,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(True, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("TX/RX", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            50, (firdes.low_pass(1, samp_rate, channel_spacing, channel_trans,
                                 firdes.WIN_BLACKMAN, 6.76)), -freq_offset,
            samp_rate)
        self._freq_range_layout = Qt.QVBoxLayout()
        self._freq_range_tool_bar = Qt.QToolBar(self)
        self._freq_range_layout.addWidget(self._freq_range_tool_bar)
        self._freq_range_tool_bar.addWidget(Qt.QLabel("Frequency" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._freq_range_counter = qwt_counter_pyslot()
        self._freq_range_counter.setRange(433, 434, 0.005)
        self._freq_range_counter.setNumButtons(2)
        self._freq_range_counter.setValue(self.freq_range)
        self._freq_range_tool_bar.addWidget(self._freq_range_counter)
        self._freq_range_counter.valueChanged.connect(self.set_freq_range)
        self._freq_range_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                                Qwt.QwtSlider.BottomScale,
                                                Qwt.QwtSlider.BgSlot)
        self._freq_range_slider.setRange(433, 434, 0.005)
        self._freq_range_slider.setValue(self.freq_range)
        self._freq_range_slider.setMinimumWidth(1)
        self._freq_range_slider.valueChanged.connect(self.set_freq_range)
        self._freq_range_layout.addWidget(self._freq_range_slider)
        self.tab_grid_layout_0.addLayout(self._freq_range_layout, 1, 0)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb()
        self._data_rate_tool_bar = Qt.QToolBar(self)
        self._data_rate_tool_bar.addWidget(Qt.QLabel("Datarate" + ": "))
        self._data_rate_line_edit = Qt.QLineEdit(str(self.data_rate))
        self._data_rate_tool_bar.addWidget(self._data_rate_line_edit)
        self._data_rate_line_edit.returnPressed.connect(
            lambda: self.set_data_rate(
                int(self._data_rate_line_edit.text().toAscii())))
        self.tab_grid_layout_2.addWidget(self._data_rate_tool_bar, 1, 0)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/tmp/fifo", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((gain * 1e-3, ))
        self.band_pass_filter_0 = filter.fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, samp_rate / 50, -2500, 2500, trans,
                                     firdes.WIN_HAMMING, 6.76))
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=samp_rate / 50,
            audio_decim=1,
            audio_pass=0 * 500 + 1 * 2500,
            audio_stop=5000,
        )
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1, 0)
        self.analog_agc2_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_binary_slicer_fb_1, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_1, 0))
        self.connect((self.osmosdr_source_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
Exemplo n.º 25
0
    def setup_controls(self):
        self.setWindowTitle('Field dialog')
        self.setObjectName("FieldDialog")
        self.setGeometry(300, 300, 250, 150)

        # name controls
        self.label_name = QtGui.QLabel("name", self)
        self.label_name.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTrailing
                                     | Qt.Qt.AlignVCenter)
        self.label_name.setObjectName("label_name")

        self.line_edit_name = QtGui.QLineEdit(self)
        self.line_edit_name.setObjectName("line_edit_name")
        self.connect(self.line_edit_name, Qt.SIGNAL('editingFinished()'),
                     self.set_field_name)

        # global inhibition controls
        self.label_global_inhibition = QtGui.QLabel("global inhibition", self)
        self.label_global_inhibition.setAlignment(Qt.Qt.AlignRight
                                                  | Qt.Qt.AlignTrailing
                                                  | Qt.Qt.AlignVCenter)
        self.label_global_inhibition.setObjectName("label_global_inhibition")

        self.slider_global_inhibition = Qwt.QwtSlider(self)
        self.slider_global_inhibition.setRange(0.0, 1000.0, 10.0)
        self.slider_global_inhibition.setOrientation(Qt.Qt.Horizontal)
        self.slider_global_inhibition.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_global_inhibition.setObjectName("slider_global_inhibition")
        self.connect(self.slider_global_inhibition,
                     Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_global_inhibition)

        self.value_global_inhibition = QtGui.QLabel(self)
        self.value_global_inhibition.setObjectName("value_global_inhibition")

        # resting level controls
        self.label_resting_level = QtGui.QLabel("resting level", self)
        self.label_resting_level.setAlignment(Qt.Qt.AlignRight
                                              | Qt.Qt.AlignTrailing
                                              | Qt.Qt.AlignVCenter)
        self.label_resting_level.setObjectName("label_resting_level")

        self.slider_resting_level = Qwt.QwtSlider(self)
        self.slider_resting_level.setRange(-10.0, 0.0, 0.1)
        self.slider_resting_level.setOrientation(Qt.Qt.Horizontal)
        self.slider_resting_level.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_resting_level.setObjectName("slider_resting_level")
        self.connect(self.slider_resting_level,
                     Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_resting_level)

        self.value_resting_level = QtGui.QLabel(self)
        self.value_resting_level.setObjectName("value_resting_level")

        # kernel amplitude controls
        self.label_kernel_amplitude = QtGui.QLabel("kernel amplitude", self)
        self.label_kernel_amplitude.setAlignment(Qt.Qt.AlignRight
                                                 | Qt.Qt.AlignTrailing
                                                 | Qt.Qt.AlignVCenter)
        self.label_kernel_amplitude.setObjectName("label_kernel_amplitude")

        self.slider_kernel_amplitude = Qwt.QwtSlider(self)
        self.slider_kernel_amplitude.setRange(0.0, 100.0, 0.1)
        self.slider_kernel_amplitude.setOrientation(Qt.Qt.Horizontal)
        self.slider_kernel_amplitude.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_kernel_amplitude.setObjectName("slider_kernel_amplitude")
        self.connect(self.slider_kernel_amplitude,
                     Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_kernel_amplitude)

        self.value_kernel_amplitude = QtGui.QLabel(self)
        self.value_kernel_amplitude.setObjectName("value_kernel_amplitude")

        # kernel width controls
        self.label_kernel_width = QtGui.QLabel("kernel width", self)
        self.label_kernel_width.setAlignment(Qt.Qt.AlignRight
                                             | Qt.Qt.AlignTrailing
                                             | Qt.Qt.AlignVCenter)
        self.label_kernel_width.setObjectName("label_kernel_width")

        self.slider_kernel_width = Qwt.QwtSlider(self)
        self.slider_kernel_width.setRange(0.0, 20.0, 0.1)
        self.slider_kernel_width.setOrientation(Qt.Qt.Horizontal)
        self.slider_kernel_width.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_kernel_width.setObjectName("slider_kernel_width")
        self.connect(self.slider_kernel_width,
                     Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_kernel_width)

        self.value_kernel_width = QtGui.QLabel(self)
        self.value_kernel_width.setObjectName("value_kernel_width")

        # noise controls
        self.label_noise = QtGui.QLabel("noise", self)
        self.label_noise.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTrailing
                                      | Qt.Qt.AlignVCenter)
        self.label_noise.setObjectName("label_noise")

        self.slider_noise = Qwt.QwtSlider(self)
        self.slider_noise.setRange(0.0, 1.0, 0.01)
        self.slider_noise.setOrientation(Qt.Qt.Horizontal)
        self.slider_noise.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_noise.setObjectName("slider_noise")
        self.connect(self.slider_noise, Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_noise)

        self.value_noise = QtGui.QLabel(self)
        self.value_noise.setObjectName("value_noise")

        # boost controls
        self.label_boost = QtGui.QLabel("boost", self)
        self.label_boost.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTrailing
                                      | Qt.Qt.AlignVCenter)
        self.label_boost.setObjectName("label_boost")

        self.slider_boost = Qwt.QwtSlider(self)
        self.slider_boost.setRange(0.0, 20.0, 0.1)
        self.slider_boost.setOrientation(Qt.Qt.Horizontal)
        self.slider_boost.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_boost.setObjectName("slider_boost")
        self.connect(self.slider_boost, Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_boost)

        self.value_boost = QtGui.QLabel(self)
        self.value_boost.setObjectName("value_boost")

        # sigmoid steepness controls
        self.label_steepness = QtGui.QLabel("steepness (sigmoid)", self)
        self.label_steepness.setAlignment(Qt.Qt.AlignRight
                                          | Qt.Qt.AlignTrailing
                                          | Qt.Qt.AlignVCenter)
        self.label_steepness.setObjectName("label_steepness")

        self.slider_steepness = Qwt.QwtSlider(self)
        self.slider_steepness.setRange(0.0, 100.0, 0.1)
        self.slider_steepness.setOrientation(Qt.Qt.Horizontal)
        self.slider_steepness.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_steepness.setObjectName("slider_steepness")
        self.connect(self.slider_steepness, Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_sigmoid_steepness)

        self.value_steepness = QtGui.QLabel(self)
        self.value_steepness.setObjectName("value_steepness")

        # sigmoid shift controls
        self.label_shift = QtGui.QLabel("shift (sigmoid)", self)
        self.label_shift.setAlignment(Qt.Qt.AlignRight | Qt.Qt.AlignTrailing
                                      | Qt.Qt.AlignVCenter)
        self.label_shift.setObjectName("label_shift")

        self.slider_shift = Qwt.QwtSlider(self)
        self.slider_shift.setRange(0.0, 10.0, 0.1)
        self.slider_shift.setOrientation(Qt.Qt.Horizontal)
        self.slider_shift.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_shift.setObjectName("slider_shift")
        self.connect(self.slider_shift, Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_sigmoid_shift)

        self.value_shift = QtGui.QLabel(self)
        self.value_shift.setObjectName("value_shift")

        # relaxation time controls
        self.label_relaxation_time = QtGui.QLabel("relaxation time", self)
        self.label_relaxation_time.setAlignment(Qt.Qt.AlignRight
                                                | Qt.Qt.AlignTrailing
                                                | Qt.Qt.AlignVCenter)
        self.label_relaxation_time.setObjectName("label_relaxation_time")

        self.slider_relaxation_time = Qwt.QwtSlider(self)
        self.slider_relaxation_time.setRange(1.0, 100.0, 1.0)
        self.slider_relaxation_time.setOrientation(Qt.Qt.Horizontal)
        self.slider_relaxation_time.setBgStyle(Qwt.QwtSlider.BgSlot)
        self.slider_relaxation_time.setObjectName("slider_relaxation_time")
        self.connect(self.slider_relaxation_time,
                     Qt.SIGNAL('valueChanged(double)'),
                     self.set_field_relaxation_time)

        self.value_relaxation_time = QtGui.QLabel(self)
        self.value_relaxation_time.setObjectName("value_relaxation_time")

        # layout
        field_control_grid_layout = QtGui.QGridLayout()

        name_widgets = [self.label_name, self.line_edit_name]
        field_control_grid_layout.addWidget(name_widgets[0], 0, 0)
        field_control_grid_layout.addWidget(name_widgets[1], 0, 1)

        global_inhibition_widgets = [
            self.label_global_inhibition, self.slider_global_inhibition,
            self.value_global_inhibition
        ]
        field_control_grid_layout.addWidget(global_inhibition_widgets[0], 1, 0)
        field_control_grid_layout.addWidget(global_inhibition_widgets[1], 1, 1)
        field_control_grid_layout.addWidget(global_inhibition_widgets[2], 1, 2)

        resting_level_widgets = [
            self.label_resting_level, self.slider_resting_level,
            self.value_resting_level
        ]
        field_control_grid_layout.addWidget(resting_level_widgets[0], 2, 0)
        field_control_grid_layout.addWidget(resting_level_widgets[1], 2, 1)
        field_control_grid_layout.addWidget(resting_level_widgets[2], 2, 2)

        kernel_amplitude_widgets = [
            self.label_kernel_amplitude, self.slider_kernel_amplitude,
            self.value_kernel_amplitude
        ]
        field_control_grid_layout.addWidget(kernel_amplitude_widgets[0], 3, 0)
        field_control_grid_layout.addWidget(kernel_amplitude_widgets[1], 3, 1)
        field_control_grid_layout.addWidget(kernel_amplitude_widgets[2], 3, 2)

        kernel_width_widgets = [
            self.label_kernel_width, self.slider_kernel_width,
            self.value_kernel_width
        ]
        field_control_grid_layout.addWidget(kernel_width_widgets[0], 4, 0)
        field_control_grid_layout.addWidget(kernel_width_widgets[1], 4, 1)
        field_control_grid_layout.addWidget(kernel_width_widgets[2], 4, 2)

        noise_widgets = [self.label_noise, self.slider_noise, self.value_noise]
        field_control_grid_layout.addWidget(noise_widgets[0], 5, 0)
        field_control_grid_layout.addWidget(noise_widgets[1], 5, 1)
        field_control_grid_layout.addWidget(noise_widgets[2], 5, 2)

        boost_widgets = [self.label_boost, self.slider_boost, self.value_boost]
        field_control_grid_layout.addWidget(boost_widgets[0], 6, 0)
        field_control_grid_layout.addWidget(boost_widgets[1], 6, 1)
        field_control_grid_layout.addWidget(boost_widgets[2], 6, 2)

        steepness_widgets = [
            self.label_steepness, self.slider_steepness, self.value_steepness
        ]
        field_control_grid_layout.addWidget(steepness_widgets[0], 7, 0)
        field_control_grid_layout.addWidget(steepness_widgets[1], 7, 1)
        field_control_grid_layout.addWidget(steepness_widgets[2], 7, 2)

        shift_widgets = [self.label_shift, self.slider_shift, self.value_shift]
        field_control_grid_layout.addWidget(shift_widgets[0], 8, 0)
        field_control_grid_layout.addWidget(shift_widgets[1], 8, 1)
        field_control_grid_layout.addWidget(shift_widgets[2], 8, 2)

        relaxation_time_widgets = [
            self.label_relaxation_time, self.slider_relaxation_time,
            self.value_relaxation_time
        ]
        field_control_grid_layout.addWidget(relaxation_time_widgets[0], 9, 0)
        field_control_grid_layout.addWidget(relaxation_time_widgets[1], 9, 1)
        field_control_grid_layout.addWidget(relaxation_time_widgets[2], 9, 2)

        field_control_group_box = QtGui.QGroupBox("Field parameters")
        field_control_group_box.setLayout(field_control_grid_layout)

        self.hbox = QtGui.QHBoxLayout()

        self.hbox.addWidget(field_control_group_box)

        self.setLayout(self.hbox)
Exemplo n.º 26
0
    def __init__(self):
        gr.top_block.__init__(self, "NC-OFDM loopback")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NC-OFDM loopback")
        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", "ncofdm_loopback")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.pn_symbols = pn_symbols = (
            1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1,
            1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1,
            1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1,
            -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1,
            -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1,
            1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1,
            -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1,
            1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1,
            1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1,
            1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1,
            1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1,
            1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1,
            -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1,
            -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1,
            -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1,
            -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1,
            1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1,
            -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1,
            -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1,
            1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1,
            -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1,
            -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1,
            -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1,
            -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1,
            1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1,
            1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1,
            -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1,
            -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1,
            1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1,
            -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1,
            1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1,
            1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1,
            -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1,
            1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1,
            -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1,
            -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1,
            1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1,
            1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1,
            1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1,
            -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1,
            1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1,
            -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1,
            -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1,
            -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1,
            -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1,
            -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1,
            -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1,
            -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1,
            -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1,
            -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1,
            1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1,
            -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1,
            -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1,
            -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1,
            1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1,
            1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1,
            1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1,
            1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1,
            -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1,
            1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1,
            -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1,
            1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1,
            1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1,
            1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1,
            1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1,
            1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1,
            -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1,
            1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1,
            -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1,
            1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1,
            -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1,
            1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1,
            -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1,
            1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1,
            -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1,
            -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1,
            -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1,
            1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1,
            1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1,
            -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1,
            1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1,
            -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1,
            1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1,
            -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1,
            -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1,
            1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1,
            -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1,
            -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1,
            -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1,
            -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1,
            1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1,
            1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1,
            -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1,
            -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1,
            -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1,
            -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1,
            -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1,
            1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
            -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1,
            1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1,
            -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1,
            -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1,
            -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1,
            -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1,
            1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1,
            -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1,
            1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1,
            -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1,
            -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1,
            -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1,
            1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1,
            1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1,
            1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1,
            -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1,
            -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1,
            -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1,
            1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1,
            -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1,
            1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1,
            1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1,
            -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1,
            -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1,
            -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1,
            -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1,
            -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1,
            -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1,
            1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1,
            1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1,
            -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1,
            1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1,
            -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1,
            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1,
            -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1,
            -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1,
            -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1,
            1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1,
            1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1,
            1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1,
            1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1,
            -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1,
            1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1,
            -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1,
            -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1,
            1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1,
            -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1,
            1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1,
            1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1,
            -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1,
            -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1,
            1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1,
            1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1,
            1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1,
            1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1,
            1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1,
            1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1,
            -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1,
            -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1,
            1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1,
            -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1,
            -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1,
            1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1,
            1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1,
            -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1,
            -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1,
            1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1,
            -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1,
            1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1,
            -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1,
            -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1,
            1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1,
            1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1,
            -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1,
            1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1,
            -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1,
            -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1,
            1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1,
            1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1,
            1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1,
            -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1,
            1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1,
            -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1,
            1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1,
            1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1,
            1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1,
            -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1,
            1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1,
            -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1,
            1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1,
            -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1,
            -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1,
            -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1,
            -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1,
            1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1,
            1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1,
            -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1,
            1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1,
            1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1,
            1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1,
            -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1,
            1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1,
            -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1,
            -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1,
            -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1,
            -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1,
            1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1,
            -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1,
            -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1,
            1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1,
            1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1,
            -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1,
            1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1,
            -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1,
            1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1,
            1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1,
            -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1,
            -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1,
            1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1,
            -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1,
            -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1,
            -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1,
            1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1,
            -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1,
            -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1,
            1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1,
            -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1,
            -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1,
            1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1,
            -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1,
            1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1,
            1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1,
            -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1,
            1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1,
            1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1,
            -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1,
            -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1,
            -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1,
            -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1,
            -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1,
            -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1,
            -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1,
            1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1,
            -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1,
            -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1,
            -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1,
            1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1,
            -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1,
            -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1,
            -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1,
            -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1,
            -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1,
            1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1,
            1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1,
            -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1,
            1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1,
            -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1,
            -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1,
            -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1,
            -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1,
            -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1,
            -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1,
            -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1,
            -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1,
            1, 1, 1, -1, 1, -1, -1, 1, 1, 1)
        self.occupied_carriers = occupied_carriers = (range(-31, 32), )
        self.length_tag_name = length_tag_name = "packet_len"
        self.fft_len = fft_len = 64
        self.ShSeqLen = ShSeqLen = 40
        self.LgSeqLen = LgSeqLen = 320
        self.DataSeqLen = DataSeqLen = 64
        self.sync_len = sync_len = 20
        self.samp_rate = samp_rate = 100000
        self.pilot_symbols = pilot_symbols = ((
            1,
            1,
            1,
            -1,
        ), )
        self.pilot_carriers = pilot_carriers = ((
            -21,
            -7,
            7,
            21,
        ), )
        self.payload_mod = payload_mod = digital.constellation_qpsk()
        self.packet_len = packet_len = 100
        self.ncofdm_amp = ncofdm_amp = 1
        self.header_formatter = header_formatter = digital.packet_header_ofdm(
            occupied_carriers, 1, length_tag_name)
        self.fileprefix = fileprefix = "/root/"
        self.cp_len = cp_len = fft_len / 4
        self.cen_freq = cen_freq = 1500000000
        self.ShThreshold = ShThreshold = 10
        self.ShSymbols = ShSymbols = pn_symbols[0:ShSeqLen]
        self.ShSeqRep = ShSeqRep = 8
        self.ShRepThreshold = ShRepThreshold = 3.5
        self.LgThreshold = LgThreshold = 100
        self.LgSymbols = LgSymbols = pn_symbols[ShSeqLen:ShSeqLen + LgSeqLen]
        self.DataSymbols = DataSymbols = pn_symbols[ShSeqLen +
                                                    LgSeqLen:DataSeqLen +
                                                    ShSeqLen + LgSeqLen]
        self.DataLen = DataLen = DataSeqLen * 20

        ##################################################
        # Blocks
        ##################################################
        self.ncofdm_stream2fftvector_0 = ncofdm.stream2fftvector(
            fft_len, cp_len)
        self.ncofdm_ncofdm_carrier_allocator_0 = ncofdm.ncofdm_carrier_allocator(
            fft_len, occupied_carriers, (), (), "packet_len")
        self._ncofdm_amp_layout = Qt.QVBoxLayout()
        self._ncofdm_amp_tool_bar = Qt.QToolBar(self)
        self._ncofdm_amp_layout.addWidget(self._ncofdm_amp_tool_bar)
        self._ncofdm_amp_tool_bar.addWidget(Qt.QLabel("ncofdm_amp" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._ncofdm_amp_counter = qwt_counter_pyslot()
        self._ncofdm_amp_counter.setRange(0, 2, 0.001)
        self._ncofdm_amp_counter.setNumButtons(2)
        self._ncofdm_amp_counter.setValue(self.ncofdm_amp)
        self._ncofdm_amp_tool_bar.addWidget(self._ncofdm_amp_counter)
        self._ncofdm_amp_counter.valueChanged.connect(self.set_ncofdm_amp)
        self._ncofdm_amp_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                                Qwt.QwtSlider.BottomScale,
                                                Qwt.QwtSlider.BgSlot)
        self._ncofdm_amp_slider.setRange(0, 2, 0.001)
        self._ncofdm_amp_slider.setValue(self.ncofdm_amp)
        self._ncofdm_amp_slider.setMinimumWidth(200)
        self._ncofdm_amp_slider.valueChanged.connect(self.set_ncofdm_amp)
        self._ncofdm_amp_layout.addWidget(self._ncofdm_amp_slider)
        self.top_layout.addLayout(self._ncofdm_amp_layout)
        self.ncofdm_add_cp_underlay_0 = ncofdm.add_cp_underlay(
            fft_len, cp_len, 20, 1280, ShSeqLen, ShSeqRep, ShSymbols,
            DataSeqLen, DataSymbols, LgSeqLen, LgSymbols, "packet_len")
        self.ncofdm_ShortPNdetector_0 = ncofdm.ShortPNdetector(
            fft_len, cp_len, ShSeqRep, ShSeqLen, 1)
        self.ncofdm_ShortPNcorr_0 = ncofdm.ShortPNcorr(fft_len, cp_len,
                                                       ShSeqRep, ShSeqLen,
                                                       (ShSymbols))
        self.ncofdm_LongPNcorrV2_0 = ncofdm.LongPNcorrV2(
            fft_len, cp_len, LgSeqLen, (LgSymbols), 60,
            ShSeqRep * ShSeqLen + LgSeqLen + DataLen + 10)
        self.ncofdm_FreqOffCalc_0 = ncofdm.FreqOffCalc(fft_len, fft_len / 4,
                                                       ShSeqLen, ShSeqRep)
        self.fft_vxx_1 = fft.fft_vcc(fft_len, True, (), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(fft_len, False, (()), True, 1)
        self.digital_chunks_to_symbols_xx_0_0_0 = digital.chunks_to_symbols_bc(
            (payload_mod.points()), 1)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0,
            frequency_offset=0.0004,
            epsilon=1.0,
            taps=(1, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_to_stream_0_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                   samp_rate, True)
        self.blocks_threshold_ff_0_0 = blocks.threshold_ff(
            ShRepThreshold, ShRepThreshold, 0)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, packet_len, "packet_len")
        self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb(
            8, payload_mod.bits_per_symbol(), length_tag_name, False,
            gr.GR_LSB_FIRST)
        self.blocks_null_sink_1_0_0_0_1_1_0_0 = blocks.null_sink(
            gr.sizeof_gr_complex * 1)
        self.blocks_null_sink_1_0_0_0_1_1_0 = blocks.null_sink(
            gr.sizeof_gr_complex * 1)
        self.blocks_null_sink_1_0_0_0_1_0_0_0 = blocks.null_sink(
            gr.sizeof_int * 1)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            ([1 / (math.sqrt(44))] * fft_len))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(
            100, 0.01, 4000)
        self.blocks_float_to_int_0 = blocks.float_to_int(1, 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_sink_1_0_0_0_3 = blocks.file_sink(
            gr.sizeof_gr_complex * 1, fileprefix + "short.dat", False)
        self.blocks_file_sink_1_0_0_0_3.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_2 = blocks.file_sink(
            gr.sizeof_gr_complex * 1, fileprefix + "org.dat", False)
        self.blocks_file_sink_1_0_0_0_2.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_1_1_1 = blocks.file_sink(
            gr.sizeof_float * 1, fileprefix + "rxshth.dat", False)
        self.blocks_file_sink_1_0_0_0_1_1_1.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_1_1_0 = blocks.file_sink(
            gr.sizeof_float * 1, fileprefix + "lgth.dat", False)
        self.blocks_file_sink_1_0_0_0_1_1_0.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_0_2_0 = blocks.file_sink(
            gr.sizeof_gr_complex * 1, fileprefix + "txdata.dat", False)
        self.blocks_file_sink_1_0_0_0_0_2_0.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_0_2 = blocks.file_sink(
            gr.sizeof_gr_complex * 1, fileprefix + "rxd.dat", False)
        self.blocks_file_sink_1_0_0_0_0_2.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_0_0 = blocks.file_sink(
            gr.sizeof_int * 1, fileprefix + "corr.dat", False)
        self.blocks_file_sink_1_0_0_0_0_0.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0_0 = blocks.file_sink(
            gr.sizeof_gr_complex * 1, fileprefix + "dec.dat", False)
        self.blocks_file_sink_1_0_0_0_0.set_unbuffered(False)
        self.blocks_file_sink_1_0_0_0 = blocks.file_sink(
            gr.sizeof_gr_complex * 1, fileprefix + "long.dat", False)
        self.blocks_file_sink_1_0_0_0.set_unbuffered(False)
        self.blocks_delay_0_0_0_0_0_0_0 = blocks.delay(gr.sizeof_float * 1, 2)
        self.blocks_delay_0_0_0_0_0_0 = blocks.delay(gr.sizeof_float * 1, 2)
        self.blocks_delay_0_0_0_0_0 = blocks.delay(gr.sizeof_int * 1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0_0_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 200, 10000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.ncofdm_ShortPNdetector_0, 0))
        self.connect((self.blocks_complex_to_mag_0_0_0, 0),
                     (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_file_sink_1_0_0_0_1_1_0, 0))
        self.connect((self.blocks_delay_0_0_0_0_0, 0),
                     (self.ncofdm_FreqOffCalc_0, 1))
        self.connect((self.blocks_delay_0_0_0_0_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_delay_0_0_0_0_0_0_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.ncofdm_LongPNcorrV2_0, 1))
        self.connect((self.blocks_float_to_int_0, 0),
                     (self.blocks_delay_0_0_0_0_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.ncofdm_LongPNcorrV2_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.ncofdm_add_cp_underlay_0, 0))
        self.connect((self.blocks_repack_bits_bb_0_0, 0),
                     (self.digital_chunks_to_symbols_xx_0_0_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.blocks_repack_bits_bb_0_0, 0))
        self.connect((self.blocks_threshold_ff_0_0, 0),
                     (self.blocks_delay_0_0_0_0_0_0, 0))
        self.connect((self.blocks_threshold_ff_0_0, 0),
                     (self.blocks_float_to_int_0, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_file_sink_1_0_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.blocks_vector_to_stream_0_1, 0),
                     (self.blocks_file_sink_1_0_0_0_0_2, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_complex_to_mag_0_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_file_sink_1_0_0_0_2, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.ncofdm_LongPNcorrV2_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.ncofdm_ShortPNcorr_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.ncofdm_stream2fftvector_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0_0, 0),
                     (self.ncofdm_ncofdm_carrier_allocator_0, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.fft_vxx_1, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.ncofdm_FreqOffCalc_0, 0),
                     (self.blocks_delay_0_0_0_0_0_0_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 1),
                     (self.blocks_file_sink_1_0_0_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 2),
                     (self.blocks_file_sink_1_0_0_0_0_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 2),
                     (self.blocks_null_sink_1_0_0_0_1_0_0_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 1),
                     (self.blocks_null_sink_1_0_0_0_1_1_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 0),
                     (self.blocks_null_sink_1_0_0_0_1_1_0_0, 0))
        self.connect((self.ncofdm_LongPNcorrV2_0, 2),
                     (self.ncofdm_stream2fftvector_0, 1))
        self.connect((self.ncofdm_ShortPNcorr_0, 1),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.ncofdm_ShortPNcorr_0, 1),
                     (self.blocks_file_sink_1_0_0_0_3, 0))
        self.connect((self.ncofdm_ShortPNcorr_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.ncofdm_ShortPNcorr_0, 1),
                     (self.ncofdm_FreqOffCalc_0, 0))
        self.connect((self.ncofdm_ShortPNdetector_0, 1),
                     (self.blocks_file_sink_1_0_0_0_1_1_1, 0))
        self.connect((self.ncofdm_ShortPNdetector_0, 0),
                     (self.blocks_threshold_ff_0_0, 0))
        self.connect((self.ncofdm_add_cp_underlay_0, 0),
                     (self.blocks_file_sink_1_0_0_0_0_2_0, 0))
        self.connect((self.ncofdm_add_cp_underlay_0, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.ncofdm_ncofdm_carrier_allocator_0, 0),
                     (self.blocks_vector_to_stream_0_1, 0))
        self.connect((self.ncofdm_ncofdm_carrier_allocator_0, 0),
                     (self.fft_vxx_0, 0))
        self.connect((self.ncofdm_stream2fftvector_0, 0), (self.fft_vxx_1, 0))
Exemplo n.º 27
0
    def __init__(self, parent=None, manager=None, printpreview=None):
        qt.QWidget.__init__(self, parent)
        self.mainLayout = qt.QGridLayout(self)
        if printpreview is None:
            self.printPreview = Object3DPrintPreview.Object3DPrintPreview(
                modal=0)
        else:
            self.printPreview = printpreview

        self.buildToolBar()

        self.wheelSlider10 = WheelAndSpacer(self, orientation=qt.Qt.Vertical)

        # Wheel
        self.__applyingCube = False

        #self.wheelSlider10.wheel.setMass(0.5)
        self.wheelSlider10.wheel.setRange(-360., 360., 0.5)
        self.wheelSlider10.wheel.setValue(0.0)
        self.wheelSlider10.wheel.setTotalAngle(360.)
        self.connect(self.wheelSlider10.wheel,
                     qt.SIGNAL("valueChanged(double)"), self.setTheta)

        self.glWidget = SceneGLWidget.SceneGLWidget(self)
        self.scene = weakref.proxy(self.glWidget.scene)
        self.glWidget.setObjectSelectionMode(True)
        self.wheelSlider12 = Qwt5.QwtSlider(self, qt.Qt.Vertical,
                                            Qwt5.QwtSlider.NoScale,
                                            Qwt5.QwtSlider.BgSlot)

        #self.axesObject = BlissGLAxesObject.BlissGLAxesObject("3D Axes")
        #self.glWidget.addObject3D(self.axesObject)
        #self.wheelSlider12.setScaleEngine(Qwt5.QwtLog10ScaleEngine())
        #self.wheelSlider12.setThumbWidth(20)
        self.wheelSlider12.setRange(-10, 10, 0.05)
        #self.wheelSlider12.setScale(0.01, 100)
        self.wheelSlider12.setValue(0.0)
        #self.wheelSlider12.setScaleMaxMinor(10)
        self.connect(self.wheelSlider12, qt.SIGNAL("valueChanged(double)"),
                     self.setZoomFactor)

        self.wheelSlider21 = WheelAndLineEdit(self,
                                              orientation=qt.Qt.Horizontal)
        #wheel
        #self.wheelSlider21.wheel.setMass(0.5)
        self.wheelSlider21.wheel.setRange(-360., 360., 0.5)
        self.wheelSlider21.wheel.setValue(0.0)
        self.wheelSlider21.wheel.setTotalAngle(360.)
        self.infoLine = self.wheelSlider21.lineEdit
        self.infoLine.setText("Scene is in object selection mode.")
        self.connect(self.wheelSlider21.wheel,
                     qt.SIGNAL("valueChanged(double)"), self.setPhi)

        self.mainLayout.addWidget(self.toolBar, 0, 1)
        self.mainLayout.addWidget(self.wheelSlider10, 1, 0)
        self.mainLayout.addWidget(self.glWidget, 1, 1)
        self.mainLayout.addWidget(self.wheelSlider12, 1, 2)
        self.mainLayout.addWidget(self.wheelSlider21, 2, 1)

        if manager is None:
            self.manager = SceneManager.SceneManager(None, glwindow=self)
            self.sceneControl = self.manager.sceneControl
            #self.sceneControl = SceneControl.SceneControl(None, self.glWidget.scene)
            #self.manager.sceneControl
            self.connectSceneControl()
            #self.manager.show()
            #self.sceneControl.show()
            self.connect(self.manager, qt.SIGNAL('SceneManagerSignal'),
                         self.sceneManagerSlot)
        else:
            self.manager = weakref.proxy(manager)

        self.activeObject = None

        self.connect(self.glWidget, qt.SIGNAL('objectSelected'),
                     self.objectSelectedSlot)

        self.connect(self.glWidget, qt.SIGNAL('vertexSelected'),
                     self.vertexSelectedSlot)

        self.setWindowTitle(self.tr("Object3D Scene"))
Exemplo n.º 28
0
    def build(self):
        self.mainLayout = qt.QGridLayout(self)
        self.mainLayout.setMargin(0)
        self.mainLayout.setSpacing(2)

        # the ComboBox
        self.comboBox = qt.QComboBox(self)
        for colormap in self.colormapList:
            self.comboBox.addItem(colormap)

        self.mainLayout.addWidget(self.comboBox, 0, 0)
        self.connect(self.comboBox, qt.SIGNAL("activated(int)"),
                     self.colormapChanged)

        # autoscale
        self.autoScaleButton = qt.QPushButton("Autoscale", self)
        self.autoScaleButton.setCheckable(True)
        self.autoScaleButton.setAutoDefault(False)
        self.connect(self.autoScaleButton, qt.SIGNAL("toggled(bool)"),
                     self.autoscaleChanged)
        self.mainLayout.addWidget(self.autoScaleButton, 0, 1)

        # autoscale 90%
        self.autoScale90Button = qt.QPushButton("Autoscale 90%", self)
        self.autoScale90Button.setCheckable(True)
        self.autoScale90Button.setAutoDefault(False)

        self.connect(self.autoScale90Button, qt.SIGNAL("toggled(bool)"),
                     self.autoscale90Changed)

        self.mainLayout.addWidget(self.autoScale90Button, 0, 2)

        #the checkboxes
        self.buttonGroup = qt.QButtonGroup()
        g1 = qt.QCheckBox(self)
        g1.setText("Linear")
        g2 = qt.QCheckBox(self)
        g2.setText("Logarithmic")
        g3 = qt.QCheckBox(self)
        g3.setText("Gamma")
        self.buttonGroup.addButton(g1, 0)
        self.buttonGroup.addButton(g2, 1)
        self.buttonGroup.addButton(g3, 2)
        self.buttonGroup.setExclusive(True)
        if self.colormapType == 1:
            self.buttonGroup.button(1).setChecked(True)
        elif self.colormapType == 2:
            self.buttonGroup.button(2).setChecked(True)
        else:
            self.buttonGroup.button(0).setChecked(True)
        self.mainLayout.addWidget(g1, 1, 0)
        self.mainLayout.addWidget(g2, 1, 1)
        self.mainLayout.addWidget(g3, 1, 2)
        self.connect(self.buttonGroup, qt.SIGNAL("buttonClicked(int)"),
                     self.buttonGroupChanged)

        # The max line
        label = qt.QLabel(self)
        label.setText('Maximum')
        self.maxText = qt.QLineEdit(self)
        self.maxText.setText("%f" % self.maxValue)
        self.maxText.setAlignment(qt.Qt.AlignRight)
        self.maxText.setFixedWidth(
            self.maxText.fontMetrics().width('######.#####'))
        v = qt.QDoubleValidator(self.maxText)
        self.maxText.setValidator(v)
        self.mainLayout.addWidget(label, 0, 3)
        self.mainLayout.addWidget(self.maxText, 0, 4)
        self.connect(self.maxText, qt.SIGNAL("editingFinished()"),
                     self.textChanged)
        # The min line
        label = qt.QLabel(self)
        label.setText('Minimum')
        self.minText = qt.QLineEdit(self)
        self.minText.setFixedWidth(
            self.minText.fontMetrics().width('######.#####'))
        self.minText.setAlignment(qt.Qt.AlignRight)
        self.minText.setText("%f" % self.minValue)
        v = qt.QDoubleValidator(self.minText)
        self.minText.setValidator(v)
        self.mainLayout.addWidget(label, 1, 3)
        self.mainLayout.addWidget(self.minText, 1, 4)
        self.connect(self.minText, qt.SIGNAL("editingFinished()"),
                     self.textChanged)

        # The sliders
        self.dataMin = -10
        self.dataMax = 10
        self.minValue = 0
        self.maxValue = 1
        self.sliderList = []
        delta = (self.dataMax - self.dataMin) / 200.
        for i in [0, 1]:
            slider = Qwt5.QwtSlider(self, qt.Qt.Horizontal)
            slider.setRange(self.dataMin, self.dataMax, delta)
            if i == 0:
                slider.setValue(self.maxValue)
            else:
                slider.setValue(self.minValue)
            self.mainLayout.addWidget(slider, i, 5)
            self.connect(slider, qt.SIGNAL("valueChanged(double)"),
                         self.sliderChanged)
            self.sliderList.append(slider)
Exemplo n.º 29
0
    def __init__(self, antenna="RX2", args="", fft_size=1024, freq=833e6, gain=20, samp_rate=13e6, spec="", stream_args="", update_rate=.1, wire_format=""):
        gr.top_block.__init__(self, "Spectrum Analyzer")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Spectrum Analyzer")
        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", "spectrum_analyzer")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.args = args
        self.fft_size = fft_size
        self.freq = freq
        self.gain = gain
        self.samp_rate = samp_rate
        self.spec = spec
        self.stream_args = stream_args
        self.update_rate = update_rate
        self.wire_format = wire_format

        ##################################################
        # Variables
        ##################################################
        self.freq_c = freq_c = freq
        self.chan0_lo_locked = chan0_lo_locked = uhd.sensor_value("", False, "")
        self.usrp_device_info = usrp_device_info = uhd.get_version_string()
        self.uhd_version_info = uhd_version_info = uhd.get_version_string()
        self.samp_rate_ = samp_rate_ = samp_rate
        self.lo_locked_probe = lo_locked_probe = chan0_lo_locked.to_bool()
        self.gain_ = gain_ = gain
        self.current_freq_c = current_freq_c = freq_c
        self.ant = ant = antenna

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate__tool_bar = Qt.QToolBar(self)
        self._samp_rate__tool_bar.addWidget(Qt.QLabel("Sampling Rate"+": "))
        self._samp_rate__line_edit = Qt.QLineEdit(str(self.samp_rate_))
        self._samp_rate__tool_bar.addWidget(self._samp_rate__line_edit)
        self._samp_rate__line_edit.returnPressed.connect(
        	lambda: self.set_samp_rate_(eng_notation.str_to_num(str(self._samp_rate__line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._samp_rate__tool_bar, 3,2,1,2)
        self._gain__layout = Qt.QVBoxLayout()
        self._gain__tool_bar = Qt.QToolBar(self)
        self._gain__layout.addWidget(self._gain__tool_bar)
        self._gain__tool_bar.addWidget(Qt.QLabel("RX Gain"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._gain__counter = qwt_counter_pyslot()
        self._gain__counter.setRange(0, 31.5, .5)
        self._gain__counter.setNumButtons(2)
        self._gain__counter.setValue(self.gain_)
        self._gain__tool_bar.addWidget(self._gain__counter)
        self._gain__counter.valueChanged.connect(self.set_gain_)
        self._gain__slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._gain__slider.setRange(0, 31.5, .5)
        self._gain__slider.setValue(self.gain_)
        self._gain__slider.setMinimumWidth(200)
        self._gain__slider.valueChanged.connect(self.set_gain_)
        self._gain__layout.addWidget(self._gain__slider)
        self.top_grid_layout.addLayout(self._gain__layout, 2,0,1,4)
        self._freq_c_tool_bar = Qt.QToolBar(self)
        self._freq_c_tool_bar.addWidget(Qt.QLabel("RX Tune Frequency"+": "))
        self._freq_c_line_edit = Qt.QLineEdit(str(self.freq_c))
        self._freq_c_tool_bar.addWidget(self._freq_c_line_edit)
        self._freq_c_line_edit.returnPressed.connect(
        	lambda: self.set_freq_c(eng_notation.str_to_num(str(self._freq_c_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._freq_c_tool_bar, 3,0,1,2)
        self._ant_options = ("RX2", "TX/RX", "J1", "J2", )
        self._ant_labels = ("RX2", "TX/RX", "J1", "J2", )
        self._ant_tool_bar = Qt.QToolBar(self)
        self._ant_tool_bar.addWidget(Qt.QLabel("Antenna"+": "))
        self._ant_combo_box = Qt.QComboBox()
        self._ant_tool_bar.addWidget(self._ant_combo_box)
        for label in self._ant_labels: self._ant_combo_box.addItem(label)
        self._ant_callback = lambda i: Qt.QMetaObject.invokeMethod(self._ant_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._ant_options.index(i)))
        self._ant_callback(self.ant)
        self._ant_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_ant(self._ant_options[i]))
        self.top_grid_layout.addWidget(self._ant_tool_bar, 4,2,1,2)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join((args, "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate_)
        self.uhd_usrp_source_0.set_center_freq(float(freq_c), 0)
        self.uhd_usrp_source_0.set_gain(gain_, 0)
        self.uhd_usrp_source_0.set_antenna(ant, 0)
        self.uhd_usrp_source_0.set_bandwidth(samp_rate, 0)
        self.display = Qt.QTabWidget()
        self.display_widget_0 = Qt.QWidget()
        self.display_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.display_widget_0)
        self.display_grid_layout_0 = Qt.QGridLayout()
        self.display_layout_0.addLayout(self.display_grid_layout_0)
        self.display.addTab(self.display_widget_0, "Spectrum")
        self.display_widget_1 = Qt.QWidget()
        self.display_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.display_widget_1)
        self.display_grid_layout_1 = Qt.QGridLayout()
        self.display_layout_1.addLayout(self.display_grid_layout_1)
        self.display.addTab(self.display_widget_1, "Waterfall")
        self.display_widget_2 = Qt.QWidget()
        self.display_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.display_widget_2)
        self.display_grid_layout_2 = Qt.QGridLayout()
        self.display_layout_2.addLayout(self.display_grid_layout_2)
        self.display.addTab(self.display_widget_2, "Scope")
        self.top_grid_layout.addWidget(self.display, 0,0,1,4)
        self._usrp_device_info_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._usrp_device_info_formatter = None
        else:
          self._usrp_device_info_formatter = lambda x: x
        
        self._usrp_device_info_tool_bar.addWidget(Qt.QLabel("Device Information"+": "))
        self._usrp_device_info_label = Qt.QLabel(str(self._usrp_device_info_formatter(self.usrp_device_info)))
        self._usrp_device_info_tool_bar.addWidget(self._usrp_device_info_label)
        self.top_grid_layout.addWidget(self._usrp_device_info_tool_bar, 1,2,1,2)
          
        self._uhd_version_info_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._uhd_version_info_formatter = None
        else:
          self._uhd_version_info_formatter = lambda x: x
        
        self._uhd_version_info_tool_bar.addWidget(Qt.QLabel("UHD Version"+": "))
        self._uhd_version_info_label = Qt.QLabel(str(self._uhd_version_info_formatter(self.uhd_version_info)))
        self._uhd_version_info_tool_bar.addWidget(self._uhd_version_info_label)
        self.top_grid_layout.addWidget(self._uhd_version_info_tool_bar, 1,0,1,2)
          
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	freq, #fc
        	samp_rate_, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(update_rate)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        
        if complex == type(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.display_grid_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win, 0,0,1,4)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
        	1024, #size
        	samp_rate_, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(update_rate)
        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(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        
        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.display_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_win, 0,0,1,4)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	fft_size, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	freq, #fc
        	samp_rate_, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(update_rate)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.1)
        
        if complex == type(float()):
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.display_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0,0,1,4)
        self._lo_locked_probe_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._lo_locked_probe_formatter = None
        else:
          self._lo_locked_probe_formatter = lambda x: x
        
        self._lo_locked_probe_tool_bar.addWidget(Qt.QLabel("LO locked"+": "))
        self._lo_locked_probe_label = Qt.QLabel(str(self._lo_locked_probe_formatter(self.lo_locked_probe)))
        self._lo_locked_probe_tool_bar.addWidget(self._lo_locked_probe_label)
        self.top_grid_layout.addWidget(self._lo_locked_probe_tool_bar, 4,0,1,2)
          
        def _current_freq_c_probe():
            while True:
                val = self.uhd_usrp_source_0.get_sensor('lo_locked')
                try:
                    self.set_current_freq_c(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _current_freq_c_thread = threading.Thread(target=_current_freq_c_probe)
        _current_freq_c_thread.daemon = True
        _current_freq_c_thread.start()
        def _chan0_lo_locked_probe():
            while True:
                val = self.uhd_usrp_source_0.get_sensor('lo_locked')
                try:
                    self.set_chan0_lo_locked(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _chan0_lo_locked_thread = threading.Thread(target=_chan0_lo_locked_probe)
        _chan0_lo_locked_thread.daemon = True
        _chan0_lo_locked_thread.start()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.qtgui_freq_sink_x_0, 'freq'), (self.qtgui_freq_sink_x_0, 'freq'))    
        self.msg_connect((self.qtgui_freq_sink_x_0, 'freq'), (self.uhd_usrp_source_0, 'command'))    
        self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))    
Exemplo n.º 30
0
    def __init__(self):
        gr.top_block.__init__(self, "FM Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("FM 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", "fm_receiver")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 4e6
        self.lpf_decim = lpf_decim = 40
        self.freq = freq = 0
        self.audio_samp_rate = audio_samp_rate = 96000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=int(samp_rate / lpf_decim / 1000),
            decimation=96,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "From Air",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_AUTO, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.05)

        if complex == type(float()):
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            lpf_decim,
            firdes.low_pass(1, samp_rate, 100e3, 10e3, firdes.WIN_HAMMING,
                            6.76))
        self._freq_layout = Qt.QVBoxLayout()
        self._freq_tool_bar = Qt.QToolBar(self)
        self._freq_layout.addWidget(self._freq_tool_bar)
        self._freq_tool_bar.addWidget(Qt.QLabel("Frequency" + ": "))

        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)

            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)

        self._freq_counter = qwt_counter_pyslot()
        self._freq_counter.setRange(-2e6, 2e6, 1)
        self._freq_counter.setNumButtons(2)
        self._freq_counter.setValue(self.freq)
        self._freq_tool_bar.addWidget(self._freq_counter)
        self._freq_counter.valueChanged.connect(self.set_freq)
        self._freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                          Qwt.QwtSlider.BottomScale,
                                          Qwt.QwtSlider.BgSlot)
        self._freq_slider.setRange(-2e6, 2e6, 1)
        self._freq_slider.setValue(self.freq)
        self._freq_slider.setMinimumWidth(200)
        self._freq_slider.valueChanged.connect(self.set_freq)
        self._freq_layout.addWidget(self._freq_slider)
        self.top_layout.addLayout(self._freq_layout)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/surligas/radio_capture_complex_96MHz.dat", True)
        self.audio_sink_0 = audio.sink(audio_samp_rate, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate / lpf_decim,
            audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))