def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_if_rate(self.samp_rate*40)
     self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 7500, 100, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_1.set_taps(firdes.high_pass(1, self.samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_0_0_0.set_taps(firdes.high_pass(1, self.samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_0_0.set_taps(firdes.high_pass(1, self.samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_0.set_taps(firdes.high_pass(1, self.samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
     self.blocks_throttle_0.set_sample_rate(self.samp_rate)
Exemple #2
0
 def set_decimation(self, decimation):
     self.decimation = decimation
     self.analog_sig_source_x_0_0_0.set_sampling_freq(self.samp_rate/self.decimation)
     self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0_0_0.set_taps(firdes.low_pass(self.visualsq, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.fractional_resampler_xx_0.set_resamp_ratio((self.samp_rate/self.decimation)/48000.0)
Exemple #3
0
 def set_range_h(self, range_h):
     self.range_h = range_h
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, self.range_h, 100,
                          firdes.WIN_HAMMING, 6.76))
     self._range_h_slider.set_value(self.range_h)
     self._range_h_text_box.set_value(self.range_h)
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate)
     self.osmosdr_sink_0.set_sample_rate(self.samp_rate)
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, 200e3, 50e3,
                          firdes.WIN_HAMMING, 6.76))
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.uhd_usrp_source_0_0.set_samp_rate(self.samp_rate)
     self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
     self.uhd_usrp_sink_0_0.set_samp_rate(self.samp_rate)
     self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate)
     self.low_pass_filter_0_2.set_taps(firdes.low_pass(self.gain, self.samp_rate, self.cut_off, self.transition, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_1.set_taps(firdes.low_pass(self.gain, self.samp_rate, self.cut_off, self.transition, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0.set_taps(firdes.low_pass(self.gain, self.samp_rate, self.cut_off, self.transition, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(firdes.low_pass(self.gain, self.samp_rate, self.cut_off, self.transition, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_2.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_1.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_0.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
Exemple #6
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate)
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
     self.osmosdr_source_0.set_sample_rate(self.samp_rate)
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, 220e3, 5e3, firdes.WIN_HANN,
                          6.76))
Exemple #7
0
 def set_bw(self, bw):
     self.bw = bw
     self.set_sb_pos(((self.bw*self.mode==2)-(self.bw*self.mode==3)))
     self.analog_sig_source_x_0.set_frequency(self.dev+(self.bw*self.mode==2)+(self.bw*self.mode==3))
     self.analog_sig_source_x_0_0_0.set_frequency(-self.bw)
     self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_2.set_taps(firdes.low_pass(1, self.samp_rate, self.bw*(2+(self.mode==2)+(self.mode==3)), 500, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0_0_0.set_taps(firdes.low_pass(self.visualsq, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
Exemple #8
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, self.range_h, 100,
                          firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, self.rango_l, 100,
                         firdes.WIN_HAMMING, 6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
Exemple #9
0
 def set_symbol_rate(self, symbol_rate):
     self.symbol_rate = symbol_rate
     self.set_sps((self.samp_rate * 1.0) / (self.symbol_rate * 1.0))
     self.root_raised_cosine_filter_0.set_taps(
         firdes.root_raised_cosine(1, self.samp_rate, self.symbol_rate, 0.5,
                                   361))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, self.symbol_rate, 300e3,
                          firdes.WIN_BLACKMAN, 6.76))
 def set_samp_rate_Baseband(self, samp_rate_Baseband):
     self.samp_rate_Baseband = samp_rate_Baseband
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate_Baseband, 20000, 2500,
                         firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate_Baseband, 24188, 2500,
                          firdes.WIN_HAMMING, 6.76))
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate_Baseband)
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, self.range_h, 100,
                          firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, self.rango_l, 100,
                         firdes.WIN_HAMMING, 6.76))
     self.qtgui_freq_sink_x_1.set_frequency_range(0, self.samp_rate)
     self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate)
 def set_transition_width(self, transition_width):
     self.transition_width = transition_width
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(
             1, self.samp_rate,
             self.frequency + self.cut_off - self.transition_width,
             self.transition_width, firdes.WIN_BLACKMAN, 6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(
             1, self.samp_rate,
             self.frequency + self.cut_off + (self.transition_width * 1.1),
             self.transition_width, firdes.WIN_BLACKMAN, 6.76))
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(
             1, self.samp_rate,
             self.frequency + self.cut_off - self.transition_width,
             self.transition_width, firdes.WIN_BLACKMAN, 6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(
             1, self.samp_rate,
             self.frequency + self.cut_off + (self.transition_width * 1.1),
             self.transition_width, firdes.WIN_BLACKMAN, 6.76))
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
Exemple #14
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate)
     self.low_pass_filter_1.set_taps(
         firdes.low_pass(1, self.samp_rate, 25000, 15000,
                         firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 37500, 18750,
                         firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, 25000, 15000,
                          firdes.WIN_HAMMING, 6.76))
     self.blocks_throttle_0.set_sample_rate(self.samp_rate)
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 20e3, 1e3, firdes.WIN_HAMMING,
                         6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, 20e3, 1e3, firdes.WIN_HAMMING,
                          6.76))
     self.blocks_throttle_0.set_sample_rate(self.samp_rate)
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate, 30e3, 60e3, 1e3,
                          firdes.WIN_HAMMING, 6.76))
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
 def set_frequency(self, frequency):
     self.frequency = frequency
     self.set_cut_off(self.frequency / 10)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(
             1, self.samp_rate,
             self.frequency + self.cut_off - self.transition_width,
             self.transition_width, firdes.WIN_BLACKMAN, 6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(
             1, self.samp_rate,
             self.frequency + self.cut_off + (self.transition_width * 1.1),
             self.transition_width, firdes.WIN_BLACKMAN, 6.76))
     self.analog_sig_source_x_0.set_frequency(self.frequency)
Exemple #17
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_decimation(self.samp_rate/self.aud_rate)
     self.low_pass_filter_0_1.set_taps(firdes.low_pass(30, self.samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_1_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
     self.band_pass_filter_0_0.set_taps(firdes.band_pass(120, self.samp_rate, 24000, 52000, 1000, firdes.WIN_HAMMING, 6.76))
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
     self.analog_sig_source_x_0_0_0.set_sampling_freq(self.samp_rate/self.decimation)
     self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0_0.set_taps(firdes.low_pass(1, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.fractional_resampler_xx_0_0.set_resamp_ratio(self.samp_rate/48000.0)
     self.fractional_resampler_xx_0_0_0.set_resamp_ratio(self.samp_rate/48000.0)
     self.low_pass_filter_0_2.set_taps(firdes.low_pass(1, self.samp_rate, self.bw*(2+(self.mode==2)+(self.mode==3)), 500, firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0_0_0_0.set_taps(firdes.low_pass(self.visualsq, self.samp_rate/self.decimation, self.bw, 10, firdes.WIN_HAMMING, 6.76))
     self.band_pass_filter_0_0_0.set_taps(firdes.band_pass(250, self.samp_rate, 18500, 19500, 500, firdes.WIN_HAMMING, 6.76))
     self.fractional_resampler_xx_0.set_resamp_ratio((self.samp_rate/self.decimation)/48000.0)
     self.rtlsdr_source_0.set_sample_rate(self.samp_rate)
Exemple #18
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_sps((self.samp_rate * 1.0) / (self.symbol_rate * 1.0))
     self.root_raised_cosine_filter_0.set_taps(
         firdes.root_raised_cosine(1, self.samp_rate, self.symbol_rate, 0.5,
                                   361))
     self.qtgui_waterfall_sink_x_0.set_frequency_range(
         self.center_freq, self.samp_rate)
     self.qtgui_freq_sink_x_0.set_frequency_range(self.center_freq,
                                                  self.samp_rate)
     self.osmosdr_source_0.set_sample_rate(self.samp_rate * 10)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate * 10, self.samp_rate / 2, 100e3,
                         firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, self.symbol_rate, 300e3,
                          firdes.WIN_BLACKMAN, 6.76))
 def update_filter(self):
     self.high_pass_filter_0 = filter.fir_filter_fff(1, firdes.high_pass(
     	1, self.samp_rate, self.cutoff_freq, self.transition_width, firdes.WIN_HAMMING, 6.76))
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.high_pass_filter_0.set_taps(firdes.high_pass(1, self.samp_rate, 1000, 10, firdes.WIN_HAMMING, 6.76))
Exemple #21
0
    def __init__(self):
        gr.top_block.__init__(self, "Headless105 7")

        ##################################################
        # Variables
        ##################################################
        self.offset = offset = .25
        self.desired_freq = desired_freq = 105.7
        self.samp_rate = samp_rate = 2e6
        self.channel_width = channel_width = 200e3
        self.center_freq = center_freq = desired_freq * 1e6 + offset * 1e6

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=121,
            decimation=50,
            taps=None,
            fractional_bw=None,
        )
        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(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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(0, 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("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            int(samp_rate / channel_width),
            firdes.low_pass(1, samp_rate, 75e3, 25e3, firdes.WIN_HAMMING,
                            6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.high_pass(1, 48e3, 150, 10, firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=480e3,
            audio_decimation=10,
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_SIN_WAVE, offset * 1e6, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.high_pass_filter_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_wfm_rcv_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Filtering")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Filtering")
        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", "filtering")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 256e3
        self.freq = freq = 10e3

        ##################################################
        # Blocks
        ##################################################
        self._freq_range = Range(-100e3, 100e3, 100, 10e3, 200)
        self._freq_win = RangeWidget(self._freq_range, self.set_freq,
                                     'Frequency', "counter_slider", float)
        self.top_layout.addWidget(self._freq_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            4  #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_y_label('Relative Gain', 'dB')
        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(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(True)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

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

        labels = [
            'Unfiltered', 'Low Pass', 'High Pass', 'Band Pass', '', '', '', '',
            '', ''
        ]
        widths = [2, 2, 2, 2, 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(4):
            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(
            1,
            firdes.low_pass(1, samp_rate, 20e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.high_pass(1, samp_rate, 20e3, 1e3, firdes.WIN_HAMMING,
                             6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(1, samp_rate, 30e3, 60e3, 1e3, firdes.WIN_HAMMING,
                             6.76))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, freq, 1, 0)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(
            analog.GR_GAUSSIAN, 0.01, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_0, 3))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.high_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_0, 2))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_0, 1))
Exemple #23
0
    def __init__(self):
        gr.top_block.__init__(self, "Not titled yet")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Not titled yet")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "Tp1a")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 12146841
        self.filtro_luminancia = filtro_luminancia = firdes.low_pass(
            1.0, samp_rate, 2.1e6, 1e6, firdes.WIN_RECTANGULAR, 6.76)
        self.filtro_crominancia = filtro_crominancia = firdes.high_pass(
            1.0, samp_rate, 4e6, 1e3, firdes.WIN_RECTANGULAR, 6.76)

        ##################################################
        # Blocks
        ##################################################
        self.views = Qt.QTabWidget()
        self.views_widget_0 = Qt.QWidget()
        self.views_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                            self.views_widget_0)
        self.views_grid_layout_0 = Qt.QGridLayout()
        self.views_layout_0.addLayout(self.views_grid_layout_0)
        self.views.addTab(self.views_widget_0, 'Separación de señales')
        self.views_widget_1 = Qt.QWidget()
        self.views_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                            self.views_widget_1)
        self.views_grid_layout_1 = Qt.QGridLayout()
        self.views_layout_1.addLayout(self.views_grid_layout_1)
        self.views.addTab(self.views_widget_1, 'Superpuestas')
        self.top_grid_layout.addWidget(self.views)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

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

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

        labels = [
            'Señal', 'Luminancia', 'Crominancia', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

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

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.views_layout_1.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Crominancia",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)

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

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

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

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

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.views_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_0_0_win,
                                           1, 0, 1, 2)
        for r in range(1, 2):
            self.views_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 2):
            self.views_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Luminancia",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

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

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

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

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

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.views_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_0_win, 0,
                                           1, 1, 1)
        for r in range(0, 1):
            self.views_grid_layout_0.setRowStretch(r, 1)
        for c in range(1, 2):
            self.views_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Señal",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(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(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

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

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

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.views_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_win, 0, 0,
                                           1, 1)
        for r in range(0, 1):
            self.views_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 1):
            self.views_grid_layout_0.setColumnStretch(c, 1)
        self.fir_filter_xxx_0_0_0 = filter.fir_filter_fff(
            1, filtro_crominancia)
        self.fir_filter_xxx_0_0_0.declare_sample_delay(0)
        self.fir_filter_xxx_0_0 = filter.fir_filter_fff(1, filtro_luminancia)
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/fran/Documents/UCA/4to año/Radiodifusión/WAHD-TV/ve3irr-testing.dat',
            True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_delay_1 = blocks.delay(gr.sizeof_float * 1, 6)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_delay_1, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.fir_filter_xxx_0_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.fir_filter_xxx_0_0_0, 0))
        self.connect((self.blocks_delay_1, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_delay_1, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.fir_filter_xxx_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.fir_filter_xxx_0_0, 0),
                     (self.qtgui_time_sink_x_1, 1))
        self.connect((self.fir_filter_xxx_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.fir_filter_xxx_0_0_0, 0),
                     (self.qtgui_time_sink_x_1, 2))
    def __init__(self):
        gr.top_block.__init__(self, "THD Analyser")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("THD Analyser")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "THD_analyser")
        self.restoreGeometry(
            self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.frequency = frequency = 1000
        self.cut_off = cut_off = frequency / 10
        self.transition_width = transition_width = cut_off / 10
        self.samp_rate = samp_rate = 44100

        ##################################################
        # Blocks
        ##################################################
        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.top_grid_layout.addWidget(self._qtgui_number_sink_0_win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate,
                            frequency + cut_off - transition_width,
                            transition_width, firdes.WIN_BLACKMAN, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.high_pass(1, samp_rate,
                             frequency + cut_off + (transition_width * 1.1),
                             transition_width, firdes.WIN_BLACKMAN, 6.76))
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(32, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_rms_xx_0_0 = blocks.rms_ff(0.0001)
        self.blocks_rms_xx_0 = blocks.rms_ff(0.0001)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.audio_source_0 = audio.source(samp_rate, '', True)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, frequency, 0.5, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.audio_sink_0, 1))
        self.connect((self.audio_source_0, 1), (self.blocks_null_sink_0, 0))
        self.connect((self.audio_source_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.audio_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_divide_xx_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.blocks_null_source_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_rms_xx_0, 0), (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_rms_xx_0_0, 0), (self.blocks_divide_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_rms_xx_0_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_rms_xx_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0_0, 0))
 def set_cut_off_h(self, cut_off_h):
     self.cut_off_h = cut_off_h
     self.high_pass_filter_0_2.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_1.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0_0.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
     self.high_pass_filter_0.set_taps(firdes.high_pass(self.gain_h, self.samp_rate, self.cut_off_h, self.transition_h, firdes.WIN_HAMMING, 6.76))
 def update_filter(self):
     self.high_pass_filter_0 = filter.fir_filter_fff(
         1,
         firdes.high_pass(1, self.samp_rate, self.cutoff_freq,
                          self.transition_width, firdes.WIN_HAMMING, 6.76))
    def __init__(self):
        gr.top_block.__init__(self, "Usrp Angle Of Arrival")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Usrp Angle Of Arrival")
        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", "usrp_angle_of_arrival")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.vec_size = vec_size = 1024
        self.usrp2_gain = usrp2_gain = 40
        self.usrp1_gain = usrp1_gain = 40
        self.tresh = tresh = 100
        self.transition_h = transition_h = 10e3
        self.transition = transition = 10e3
        self.tar_gain = tar_gain = 40
        self.tar_freq_0 = tar_freq_0 = 100e3
        self.tar_freq = tar_freq = 100e3
        self.samp_rate = samp_rate = 1e6
        self.ref_gain = ref_gain = 16
        self.ref_freq = ref_freq = 10e3
        self.keep = keep = 250
        self.gain_h = gain_h = 2
        self.gain = gain = 2
        self.cut_off_h = cut_off_h = 90e3
        self.cut_off = cut_off = 15e3
        self.center_freq = center_freq = 1.3e9

        ##################################################
        # Blocks
        ##################################################
        self._usrp2_gain_range = Range(0, 100, 1, 40, 200)
        self._usrp2_gain_win = RangeWidget(self._usrp2_gain_range, self.set_usrp2_gain, "usrp2_gain", "counter_slider", float)
        self.top_layout.addWidget(self._usrp2_gain_win)
        self._usrp1_gain_range = Range(0, 100, 1, 40, 200)
        self._usrp1_gain_win = RangeWidget(self._usrp1_gain_range, self.set_usrp1_gain, "usrp1_gain", "counter_slider", float)
        self.top_layout.addWidget(self._usrp1_gain_win)
        self._tresh_range = Range(0.01, 5000, 0.01, 100, 200)
        self._tresh_win = RangeWidget(self._tresh_range, self.set_tresh, "tresh", "counter_slider", float)
        self.top_layout.addWidget(self._tresh_win)
        self._tar_gain_range = Range(0, 100, 1, 40, 200)
        self._tar_gain_win = RangeWidget(self._tar_gain_range, self.set_tar_gain, "tar_gain", "counter_slider", float)
        self.top_layout.addWidget(self._tar_gain_win)
        self._ref_gain_range = Range(0, 100, 1, 16, 200)
        self._ref_gain_win = RangeWidget(self._ref_gain_range, self.set_ref_gain, "ref_gain", "counter_slider", float)
        self.top_layout.addWidget(self._ref_gain_win)
        self.uhd_usrp_source_0_0 = uhd.usrp_source(
        	",".join(("addr=164.8.30.121", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(2),
        	),
        )
        self.uhd_usrp_source_0_0.set_clock_source("external", 0)
        self.uhd_usrp_source_0_0.set_time_source("external", 0)
        self.uhd_usrp_source_0_0.set_subdev_spec("A:0 B:0", 0)
        self.uhd_usrp_source_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0_0.set_time_unknown_pps(uhd.time_spec())
        self.uhd_usrp_source_0_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_source_0_0.set_gain(usrp2_gain, 0)
        self.uhd_usrp_source_0_0.set_antenna("RX2", 0)
        self.uhd_usrp_source_0_0.set_center_freq(center_freq, 1)
        self.uhd_usrp_source_0_0.set_gain(usrp2_gain, 1)
        self.uhd_usrp_source_0_0.set_antenna("RX2", 1)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("addr=192.168.40.2", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(2),
        	),
        )
        self.uhd_usrp_source_0.set_clock_source("external", 0)
        self.uhd_usrp_source_0.set_time_source("external", 0)
        self.uhd_usrp_source_0.set_subdev_spec("A:0 B:0", 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec())
        self.uhd_usrp_source_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_source_0.set_gain(usrp1_gain, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.uhd_usrp_source_0.set_center_freq(center_freq, 1)
        self.uhd_usrp_source_0.set_gain(usrp1_gain, 1)
        self.uhd_usrp_source_0.set_antenna("RX2", 1)
        self.uhd_usrp_sink_0_0 = uhd.usrp_sink(
        	",".join(("addr=164.8.30.119", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_sink_0_0.set_gain(tar_gain, 0)
        self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=164.8.30.120", "")),
        	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(center_freq, 0)
        self.uhd_usrp_sink_0.set_gain(ref_gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.myBlocks_phaseSync_cc_0 = myBlocks.phaseSync_cc()
        self.myBlocks_aoa_spectrum_sink_0 = myBlocks.aoa_spectrum_sink(vec_size, (0, 0.1154, 0.2308, 0.3462), center_freq, tresh)
        self.low_pass_filter_0_2 = filter.fir_filter_ccf(1, firdes.low_pass(
        	gain, samp_rate, cut_off, transition, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1 = filter.fir_filter_ccf(1, firdes.low_pass(
        	gain, samp_rate, cut_off, transition, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	gain, samp_rate, cut_off, transition, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	gain, samp_rate, cut_off, transition, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0_2 = filter.fir_filter_ccf(1, firdes.high_pass(
        	gain_h, samp_rate, cut_off_h, transition_h, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0_1 = filter.fir_filter_ccf(1, firdes.high_pass(
        	gain_h, samp_rate, cut_off_h, transition_h, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.high_pass(
        	gain_h, samp_rate, cut_off_h, transition_h, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass(
        	gain_h, samp_rate, cut_off_h, transition_h, firdes.WIN_HAMMING, 6.76))
        self.blocks_stream_to_vector_0_1 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_size)
        self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_size)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_size)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, vec_size)
        self.blocks_multiply_xx_0_2 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_keep_one_in_n_0_2 = blocks.keep_one_in_n(gr.sizeof_gr_complex*vec_size, keep)
        self.blocks_keep_one_in_n_0_1 = blocks.keep_one_in_n(gr.sizeof_gr_complex*vec_size, keep)
        self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*vec_size, keep)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*vec_size, keep)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, tar_freq, 0.5, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, ref_freq, 0.5, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.uhd_usrp_sink_0_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.myBlocks_aoa_spectrum_sink_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.myBlocks_aoa_spectrum_sink_0, 1))    
        self.connect((self.blocks_keep_one_in_n_0_1, 0), (self.myBlocks_aoa_spectrum_sink_0, 2))    
        self.connect((self.blocks_keep_one_in_n_0_2, 0), (self.myBlocks_aoa_spectrum_sink_0, 3))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_stream_to_vector_0_0, 0))    
        self.connect((self.blocks_multiply_xx_0_1, 0), (self.blocks_stream_to_vector_0_1, 0))    
        self.connect((self.blocks_multiply_xx_0_2, 0), (self.blocks_stream_to_vector_0_0_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.blocks_keep_one_in_n_0, 0))    
        self.connect((self.blocks_stream_to_vector_0_0, 0), (self.blocks_keep_one_in_n_0_0, 0))    
        self.connect((self.blocks_stream_to_vector_0_0_0, 0), (self.blocks_keep_one_in_n_0_2, 0))    
        self.connect((self.blocks_stream_to_vector_0_1, 0), (self.blocks_keep_one_in_n_0_1, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.high_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_0, 0))    
        self.connect((self.high_pass_filter_0_1, 0), (self.blocks_multiply_xx_0_1, 0))    
        self.connect((self.high_pass_filter_0_2, 0), (self.blocks_multiply_xx_0_2, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.myBlocks_phaseSync_cc_0, 0))    
        self.connect((self.low_pass_filter_0_0, 0), (self.myBlocks_phaseSync_cc_0, 1))    
        self.connect((self.low_pass_filter_0_1, 0), (self.myBlocks_phaseSync_cc_0, 2))    
        self.connect((self.low_pass_filter_0_2, 0), (self.myBlocks_phaseSync_cc_0, 3))    
        self.connect((self.myBlocks_phaseSync_cc_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.myBlocks_phaseSync_cc_0, 1), (self.blocks_multiply_xx_0_0, 1))    
        self.connect((self.myBlocks_phaseSync_cc_0, 2), (self.blocks_multiply_xx_0_1, 1))    
        self.connect((self.myBlocks_phaseSync_cc_0, 3), (self.blocks_multiply_xx_0_2, 1))    
        self.connect((self.uhd_usrp_source_0, 0), (self.high_pass_filter_0, 0))    
        self.connect((self.uhd_usrp_source_0, 1), (self.high_pass_filter_0_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.uhd_usrp_source_0, 1), (self.low_pass_filter_0_0, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.high_pass_filter_0_1, 0))    
        self.connect((self.uhd_usrp_source_0_0, 1), (self.high_pass_filter_0_2, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.low_pass_filter_0_1, 0))    
        self.connect((self.uhd_usrp_source_0_0, 1), (self.low_pass_filter_0_2, 0))    
    def __init__(self, args):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000
        self.seed = seed = args.seed
        self.m_rate = m_rate = args.m_rate
        self.if_rate = if_rate = samp_rate * 40
        self.gauss = gauss = args.gauss
        self.fc = fc = args.fc
        self.dpp = dpp = args.dop

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0_1 = filter.rational_resampler_fff(
            interpolation=3,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=40,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_1_0 = filter.fir_filter_fff(
            40, firdes.low_pass(1, if_rate, 7500, 100, firdes.WIN_HAMMING,
                                6.76))
        self.low_pass_filter_1 = filter.fir_filter_fff(
            40, firdes.low_pass(1, if_rate, 7500, 100, firdes.WIN_HAMMING,
                                6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 7500, 100, firdes.WIN_HAMMING, 6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(301, firdes.WIN_HAMMING, 6.76)
        self.high_pass_filter_0_1 = filter.fir_filter_fff(
            1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING,
                                6.76))
        self.high_pass_filter_0_0_0_0 = filter.fir_filter_fff(
            1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING,
                                6.76))
        self.high_pass_filter_0_0_0 = filter.fir_filter_fff(
            1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING,
                                6.76))
        self.high_pass_filter_0_0 = filter.fir_filter_fff(
            1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING,
                                6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.high_pass(1, samp_rate, 50, 10, firdes.WIN_HAMMING,
                                6.76))
        self.channels_fading_model_0 = channels.fading_model(
            8, dpp / if_rate, True, 2, 256)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(file1, False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (m_rate, ))
        self.blocks_file_sink_0_5 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file2, False)
        self.blocks_file_sink_0_5.set_unbuffered(False)
        self.blocks_file_sink_0_4 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file3, False)
        self.blocks_file_sink_0_4.set_unbuffered(False)
        self.blocks_file_sink_0_3 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file4, False)
        self.blocks_file_sink_0_3.set_unbuffered(False)
        self.blocks_file_sink_0_2 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file5, False)
        self.blocks_file_sink_0_2.set_unbuffered(False)
        self.blocks_file_sink_0_1 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file6, False)
        self.blocks_file_sink_0_1.set_unbuffered(False)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_float * 1,
                                                     file7, False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 1, file8,
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.band_pass_filter_0_1 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100,
                             firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0_0_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100,
                             firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100,
                             firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100,
                             firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(4, if_rate, fc - 7.5e3, fc + 7.5e3, 100,
                             firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            if_rate, analog.GR_COS_WAVE, fc, 1, 0)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(
            analog.GR_GAUSSIAN, gauss, seed, 8192)
        self.analog_am_demod_cf_0_1 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )
        self.analog_am_demod_cf_0_0_0_0 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )
        self.analog_am_demod_cf_0_0_0 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )
        self.analog_am_demod_cf_0_0 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=fc,
            audio_decim=40,
            audio_pass=7500,
            audio_stop=10e3,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.high_pass_filter_0, 0))
        self.connect((self.analog_am_demod_cf_0_0, 0),
                     (self.high_pass_filter_0_0, 0))
        self.connect((self.analog_am_demod_cf_0_0_0, 0),
                     (self.high_pass_filter_0_0_0, 0))
        self.connect((self.analog_am_demod_cf_0_0_0_0, 0),
                     (self.high_pass_filter_0_0_0_0, 0))
        self.connect((self.analog_am_demod_cf_0_1, 0),
                     (self.high_pass_filter_0_1, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_add_xx_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.band_pass_filter_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.analog_am_demod_cf_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0),
                     (self.analog_am_demod_cf_0_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.band_pass_filter_0_0_0_0, 0),
                     (self.analog_am_demod_cf_0_0_0_0, 0))
        self.connect((self.band_pass_filter_0_1, 0),
                     (self.analog_am_demod_cf_0_1, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.band_pass_filter_0_1, 0))
        self.connect((self.blocks_add_xx_0_0_0, 0),
                     (self.band_pass_filter_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_add_xx_0_0_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.rational_resampler_xxx_0_1, 0))
        self.connect((self.channels_fading_model_0, 0),
                     (self.band_pass_filter_0_0_0, 0))
        self.connect((self.channels_fading_model_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.channels_fading_model_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.high_pass_filter_0, 0),
                     (self.blocks_file_sink_0_5, 0))
        self.connect((self.high_pass_filter_0_0, 0),
                     (self.blocks_file_sink_0_3, 0))
        self.connect((self.high_pass_filter_0_0_0, 0),
                     (self.blocks_file_sink_0_2, 0))
        self.connect((self.high_pass_filter_0_0_0_0, 0),
                     (self.blocks_file_sink_0_1, 0))
        self.connect((self.high_pass_filter_0_1, 0),
                     (self.blocks_file_sink_0_4, 0))
        self.connect((self.hilbert_fc_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_add_xx_0_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.channels_fading_model_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.low_pass_filter_1_0, 0),
                     (self.blocks_file_sink_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0_1, 0),
                     (self.low_pass_filter_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Proyectofinal")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Proyectofinal")
        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", "proyectoFinal")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000
        self.rango_l = rango_l = 12000
        self.range_h = range_h = 1

        ##################################################
        # Blocks
        ##################################################
        self._rango_l_range = Range(0, 24000, 100, 12000, 200)
        self._rango_l_win = RangeWidget(self._rango_l_range, self.set_rango_l,
                                        "rango_low", "counter_slider", float)
        self.top_layout.addWidget(self._rango_l_win)
        self._range_h_range = Range(1, 24000, 100, 1, 200)
        self._range_h_win = RangeWidget(self._range_h_range, self.set_range_h,
                                        "range_h", "counter_slider", float)
        self.top_layout.addWidget(self._range_h_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(True)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1.disable_legend()

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

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #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.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "float" == "float" or "float" == "msg_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_fff(
            1,
            firdes.low_pass(1, samp_rate, rango_l, 100, firdes.WIN_HAMMING,
                            6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.high_pass(1, samp_rate, range_h, 100, firdes.WIN_HAMMING,
                             6.76))
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "/usr/share/sounds/alsa/Front_Center.wav", True)
        self.audio_sink_0 = audio.sink(samp_rate, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.high_pass_filter_0, 0), (self.audio_sink_0, 0))
        self.connect((self.high_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.high_pass_filter_0, 0))
 def set_range_h(self, range_h):
     self.range_h = range_h
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, self.range_h, 100,
                          firdes.WIN_HAMMING, 6.76))
Exemple #31
0
 def set_demod_rate(self, demod_rate):
     self.demod_rate = demod_rate
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(2, self.demod_rate, 100, 50, firdes.WIN_HANN,
                          6.76))
Exemple #32
0
    def __init__(self, outfile=""):
        grc_wxgui.top_block_gui.__init__(self, title="Record Jamming")

        ##################################################
        # Parameters
        ##################################################
        self.outfile = outfile

        ##################################################
        # Variables
        ##################################################
        self.key_freq = key_freq = 433.92e6
        self.samp_rate = samp_rate = 2e6
        self.offset = offset = 220e3
        self.freq = freq = key_freq

        ##################################################
        # Blocks
        ##################################################
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            label='freq',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            minimum=key_freq - 10e6,
            maximum=key_freq + 10e6,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=freq - offset,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=freq - offset,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        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 - offset, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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(0, 0)
        self.osmosdr_source_0.set_if_gain(17, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.high_pass_filter_0 = filter.fir_filter_ccf(
            1, firdes.high_pass(1, samp_rate, 220e3, 5e3, firdes.WIN_HANN,
                                6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_cc(1024, True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1,
                                                   outfile, False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.dc_blocker_xx_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.high_pass_filter_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.high_pass_filter_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.dc_blocker_xx_0, 0))
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.high_pass_filter_0.set_taps(
         firdes.high_pass(1, self.samp_rate, 1000, 10, firdes.WIN_HAMMING,
                          6.76))
Exemple #34
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Filter Taps")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.transition = transition = 1000
        self.samp_rate = samp_rate = 32000
        self.cutoff_low = cutoff_low = 2000
        self.cutoff_high = cutoff_high = 14000
        self.bp_low = bp_low = 6000
        self.bp_high = bp_high = 10000

        self.lp_taps = lp_taps = firdes.low_pass(1.0, samp_rate, cutoff_high,
                                                 transition,
                                                 firdes.WIN_HAMMING, 6.76)

        self.hp_taps = hp_taps = firdes.high_pass(1.0, samp_rate, cutoff_low,
                                                  transition,
                                                  firdes.WIN_HAMMING, 6.76)

        self.bp_taps = bp_taps = firdes.band_pass(1.0, samp_rate, bp_low,
                                                  bp_high, transition,
                                                  firdes.WIN_HAMMING, 6.76)

        ##################################################
        # Blocks
        ##################################################
        self.notebook = self.notebook = wx.Notebook(self.GetWin(),
                                                    style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "lp")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "hp")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "bp")
        self.Add(self.notebook)
        self.wxgui_fftsink2_0_0_1_0_1 = fftsink2.fft_sink_f(
            self.notebook.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=4096,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='filtro pasa banda',
            peak_hold=False,
            win=window.flattop,
        )
        self.notebook.GetPage(2).Add(self.wxgui_fftsink2_0_0_1_0_1.win)
        self.wxgui_fftsink2_0_0_1_0_0 = fftsink2.fft_sink_f(
            self.notebook.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=4096,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='filtro pasa altas',
            peak_hold=False,
            win=window.flattop,
        )
        self.notebook.GetPage(1).Add(self.wxgui_fftsink2_0_0_1_0_0.win)
        self.wxgui_fftsink2_0_0_1_0 = fftsink2.fft_sink_f(
            self.notebook.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=4096,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='filtro pasa bajas',
            peak_hold=False,
            win=window.flattop,
        )
        self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0_0_1_0.win)
        self.lp_filter = filter.fir_filter_fff(1, (lp_taps))
        self.lp_filter.declare_sample_delay(0)
        self.hp_filter = filter.fir_filter_fff(1, (hp_taps))
        self.hp_filter.declare_sample_delay(0)
        self.bp_filter = filter.fir_filter_fff(1, (bp_taps))
        self.bp_filter.declare_sample_delay(0)
        self.blocks_throttle_0_1_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                       samp_rate, True)
        self.blocks_throttle_0_1_0 = blocks.throttle(gr.sizeof_float * 1,
                                                     samp_rate, True)
        self.blocks_throttle_0_1 = blocks.throttle(gr.sizeof_float * 1,
                                                   samp_rate, True)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_f(
            analog.GR_GAUSSIAN, 1, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.bp_filter, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.hp_filter, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.lp_filter, 0))
        self.connect((self.blocks_throttle_0_1, 0),
                     (self.wxgui_fftsink2_0_0_1_0, 0))
        self.connect((self.blocks_throttle_0_1_0, 0),
                     (self.wxgui_fftsink2_0_0_1_0_0, 0))
        self.connect((self.blocks_throttle_0_1_0_0, 0),
                     (self.wxgui_fftsink2_0_0_1_0_1, 0))
        self.connect((self.bp_filter, 0), (self.blocks_throttle_0_1_0_0, 0))
        self.connect((self.hp_filter, 0), (self.blocks_throttle_0_1_0, 0))
        self.connect((self.lp_filter, 0), (self.blocks_throttle_0_1, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="B200 VHF NBFM transceiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.tx_rx_choice = tx_rx_choice = 1
        self.tx_gain = tx_gain = .615
        self.tune_minus_20 = tune_minus_20 = 0
        self.tune_minus_10 = tune_minus_10 = 0
        self.tune_20 = tune_20 = 0
        self.tune_10 = tune_10 = 0
        self.tone = tone = 100
        self.squelch = squelch = -70.32
        self.samp_rate = samp_rate = 4000000
        self.rx_offset = rx_offset = 0
        self.rit_tune = rit_tune = 0
        self.offset = offset = 600000
        self.chooser_fm = chooser_fm = 147.34e6
        self.audio_gain = audio_gain = .7

        ##################################################
        # Blocks
        ##################################################
        self._tx_rx_choice_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tx_rx_choice,
        	callback=self.set_tx_rx_choice,
        	label="TX-RX",
        	choices=[0, 1],
        	labels=['TX', 'RX'],
        )
        self.GridAdd(self._tx_rx_choice_chooser, 0, 3, 1, 1)
        _tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tx_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_tx_gain_sizer,
        	value=self.tx_gain,
        	callback=self.set_tx_gain,
        	label="TX Gain: 144= .6, 220= .70, 440= .72",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._tx_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_tx_gain_sizer,
        	value=self.tx_gain,
        	callback=self.set_tx_gain,
        	minimum=.6,
        	maximum=.75,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_tx_gain_sizer)
        self._tune_minus_20_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_minus_20,
        	callback=self.set_tune_minus_20,
        	label="-20 Tune",
        	choices=[0, 20e3, 40e3, 60e3, 80e3, 100e3, 120e3, 140e3, 0],
        	labels=[0, -20, -40, -60, -80, -100, -120, -140, 0],
        )
        self.GridAdd(self._tune_minus_20_chooser, 0, 1, 1, 1)
        self._tune_minus_10_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_minus_10,
        	callback=self.set_tune_minus_10,
        	label="-10 Tune",
        	choices=[0,-10e3, -20e3, -30e3, -40e3,-50e3,0],
        	labels=[0, -10, -20, -30, -40,-50,0],
        )
        self.GridAdd(self._tune_minus_10_chooser, 1, 1, 1, 1)
        self._tune_20_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_20,
        	callback=self.set_tune_20,
        	label="+20 Tune",
        	choices=[0, 20e3, 40e3, 60e3, 80e3, 100e3, 120e3, 140e3,0],
        	labels=[0, '+20', '+40', '+60', '+80', '+100', '+120', '+140','0'],
        )
        self.GridAdd(self._tune_20_chooser, 0, 0, 1, 1)
        self._tune_10_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.tune_10,
        	callback=self.set_tune_10,
        	label="+10 Tune",
        	choices=[0,10e3, 20e3, 30e3, 40e3,50e3,0],
        	labels=[0,'+10', '+20', '+30', '+40','+50','0'],
        )
        self.GridAdd(self._tune_10_chooser, 1, 0, 1, 1)
        self._tone_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.tone,
        	callback=self.set_tone,
        	label="CTCSS",
        	choices=[100,103.5, 110.9, 118.8, 123.0,127.3,179.5],
        	labels=['100', '103.5', '110.9','118.8', '123.0', '127.3','179.5'],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._tone_chooser, 0, 5, 1, 1)
        _squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_squelch_sizer,
        	value=self.squelch,
        	callback=self.set_squelch,
        	label="Squelch",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._squelch_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_squelch_sizer,
        	value=self.squelch,
        	callback=self.set_squelch,
        	minimum=-95,
        	maximum=-55,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_squelch_sizer, 0, 6, 1, 1)
        self._rx_offset_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.rx_offset,
        	callback=self.set_rx_offset,
        	label="RX offset",
        	choices=[0, 600000, -600000,5e6],
        	labels=['0', '+', '-','+5M'],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._rx_offset_chooser, 1, 6, 1, 1)
        _rit_tune_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rit_tune_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rit_tune_sizer,
        	value=self.rit_tune,
        	callback=self.set_rit_tune,
        	label="RIT",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rit_tune_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rit_tune_sizer,
        	value=self.rit_tune,
        	callback=self.set_rit_tune,
        	minimum=-30e3,
        	maximum=+30e3,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_rit_tune_sizer, 1, 2, 1, 3)
        self._offset_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.offset,
        	callback=self.set_offset,
        	label="TX offset",
        	choices=[600000, -600000, 0,5e6],
        	labels=['+', '-', '0','5MHz'],
        	style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._offset_chooser, 0, 4, 1, 1)
        self._chooser_fm_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.chooser_fm,
        	callback=self.set_chooser_fm,
        	label="Preset",
        	choices=[145.13e6,145.33e6, 145.88e6, 146.46e6, 146.49e6, 146.52e6,146.58e6, 146.64e6,146.74e6, 146.82e6, 146.86e6, 146.92e6, 146.96e6, 147.0e6,147.06e6, 147.08e6, 147.20e6, 147.22e6, 147.34e6, 223.5e6,441.825e6, 432.25e6],
        	labels=[145.13,145.33, 145.88, 146.46, 146.49, 146.52, 146.58, 146.64, 146.74, 146.82, 146.860, 146.92, 146.96,  147.00, 147.06, 147.08,147.200, 147.220, 147.34, 223.5,441.825, 432.25],
        	style=wx.RA_HORIZONTAL,
        )
        self.Add(self._chooser_fm_chooser)
        _audio_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._audio_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_audio_gain_sizer,
        	value=self.audio_gain,
        	callback=self.set_audio_gain,
        	label="Audio gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._audio_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_audio_gain_sizer,
        	value=self.audio_gain,
        	callback=self.set_audio_gain,
        	minimum=.1,
        	maximum=4,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_audio_gain_sizer, 0, 2, 1, 1)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=(((((chooser_fm+tune_20)-tune_minus_20)+tune_10)+tune_minus_10)+rx_offset),
        	y_per_div=5,
        	y_divs=16,
        	ref_level=-55,
        	ref_scale=2.0,
        	sample_rate=samp_rate/2,
        	fft_size=1024*0+2048*0+4096,
        	fft_rate=12,
        	average=True,
        	avg_alpha=.4,
        	title="RF Bandpass",
        	peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 2, 0, 5, 14)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "")),
        	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((((((chooser_fm+tune_20)-tune_minus_20)+tune_10)+tune_minus_10)+rx_offset)-10e3, 0)
        self.uhd_usrp_source_0.set_normalized_gain(.520*.8, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.uhd_usrp_source_0.set_bandwidth(1.99e6, 0)
        self.uhd_usrp_sink_1 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_1.set_samp_rate(320000)
        self.uhd_usrp_sink_1.set_center_freq((((((chooser_fm+offset)+tune_20)-tune_minus_20)+tune_10)+tune_minus_10)+rit_tune, 0)
        self.uhd_usrp_sink_1.set_normalized_gain((.83*0+.72)*0+tx_gain, 0)
        self.uhd_usrp_sink_1.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_1.set_bandwidth(200000, 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=32000,
                decimation=40000,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=samp_rate/2,
                decimation=samp_rate,
                taps=None,
                fractional_bw=None,
        )
        self.pfb_decimator_ccf_0 = pfb.decimator_ccf(
        	  2,
        	  (firdes.low_pass(.1, (samp_rate), (samp_rate)/4.05,10e3)),
        	  0,
        	  100,
                  True,
                  True)
        self.pfb_decimator_ccf_0.declare_sample_delay(0)
        	
        self.low_pass_filter_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, 32000, 4400, 300, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, 32000, 4500, 600, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, 32000, 300, 100, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(50, (firdes.low_pass(1,samp_rate/2,18e3,600)), 0+rit_tune+10e3, samp_rate/2)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex*1)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vcc((.8, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((125, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((audio_gain*tx_rx_choice, ))
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blks2_selector_0_1 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=1+(tx_rx_choice),
        	output_index=0,
        )
        self.audio_source_1 = audio.source(32000, "", True)
        self.audio_sink_0 = audio.sink(32000, "", True)
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(squelch, .0001)
        self.analog_sig_source_x_0 = analog.sig_source_f(32000, analog.GR_COS_WAVE, tone, .091, 0)
        self.analog_nbfm_tx_1 = analog.nbfm_tx(
        	audio_rate=32000,
        	quad_rate=320000,
        	tau=(75e-6)*0+90e-6,
        	max_dev=5e3,
                )
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=32000,
        	quad_rate=32000,
        	tau=75e-6,
        	max_dev=5e3,
          )
        self.analog_fm_preemph_0 = analog.fm_preemph(fs=32e3, tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=32000, tau=75e-6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_fm_deemph_0, 0), (self.low_pass_filter_1, 0))    
        self.connect((self.analog_fm_preemph_0, 0), (self.blocks_add_xx_1, 0))    
        self.connect((self.analog_nbfm_rx_0, 0), (self.analog_fm_deemph_0, 0))    
        self.connect((self.analog_nbfm_tx_1, 0), (self.blocks_multiply_const_vxx_2, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_1, 1))    
        self.connect((self.analog_simple_squelch_cc_0, 0), (self.rational_resampler_xxx_1, 0))    
        self.connect((self.audio_source_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blks2_selector_0_1, 0), (self.uhd_usrp_sink_1, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.analog_nbfm_tx_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.high_pass_filter_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blks2_selector_0_1, 1))    
        self.connect((self.blocks_null_source_0, 0), (self.blks2_selector_0_1, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_simple_squelch_cc_0, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_fm_preemph_0, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.pfb_decimator_ccf_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
        self.connect((self.rational_resampler_xxx_1, 0), (self.analog_nbfm_rx_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.pfb_decimator_ccf_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.rational_resampler_xxx_0, 0))    
Exemple #36
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Bl")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000
        self.rango_l = rango_l = 24000
        self.range_h = range_h = 50

        ##################################################
        # Blocks
        ##################################################
        _rango_l_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rango_l_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rango_l_sizer,
            value=self.rango_l,
            callback=self.set_rango_l,
            label='rango_l',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rango_l_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rango_l_sizer,
            value=self.rango_l,
            callback=self.set_rango_l,
            minimum=0,
            maximum=24000,
            num_steps=240,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rango_l_sizer)
        _range_h_sizer = wx.BoxSizer(wx.VERTICAL)
        self._range_h_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_range_h_sizer,
            value=self.range_h,
            callback=self.set_range_h,
            label="range_h",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._range_h_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_range_h_sizer,
            value=self.range_h,
            callback=self.set_range_h,
            minimum=0,
            maximum=24000,
            num_steps=240,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_range_h_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, rango_l, 100, firdes.WIN_HAMMING,
                            6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.high_pass(1, samp_rate, range_h, 100, firdes.WIN_HAMMING,
                             6.76))
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "/usr/share/sounds/alsa/Front_Center.wav", True)
        self.audio_sink_0 = audio.sink(samp_rate, "sysdefault", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.low_pass_filter_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.wxgui_fftsink2_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.freq = freq = 390e6
        self.amplitude = amplitude = 1

        ##################################################
        # Blocks
        ##################################################
        self._amplitude_range = Range(1, 10, 1, 1, 200)
        self._amplitude_win = RangeWidget(self._amplitude_range,
                                          self.set_amplitude, "amplitude",
                                          "counter_slider", float)
        self.top_layout.addWidget(self._amplitude_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #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.set_y_label('Relative Gain', 'dB')
        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(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_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.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " + '')
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(0, 0)
        self.osmosdr_sink_0.set_if_gain(40, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)

        self.mult = blocks.multiply_const_vcc((amplitude, ))
        self.high_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.high_pass(1, samp_rate, 200e3, 50e3, firdes.WIN_HAMMING,
                             6.76))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/james/Desktop/gnuradio_projects/hackrf_am_file_rx/capture',
            True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0),
                     (self.high_pass_filter_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.mult, 0))
        self.connect((self.mult, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.mult, 0), (self.qtgui_freq_sink_x_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "NOAA Weather Radio")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NOAA Weather Radio")
        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", "noaa_weather")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.valid_gains = valid_gains = [0.0, 0.9, 1.4, 2.7, 3.7, 7.7, 8.7, 12.5, 14.4, 15.7, 16.6, 19.7, 20.7, 22.9, 25.4, 28.0, 29.7, 32.8, 33.8, 36.4, 37.2, 38.6, 40.2, 42.1, 43.4, 43.9, 44.5, 48.0, 49.6]
        self.noaa_stations = noaa_stations = [(162.400e6,'WX2') , (162.425e6, 'WX4'), (162.450e6, 'WX5'), (162.475e6,'WX3'), (162.500e6, 'WX6'), (162.525e6, 'WX7'), (162.550e6, 'WX1')]
        self.samp_rate = samp_rate = 250e3
        self.range_ppm_corr = range_ppm_corr = 9
        self.noaa_stations_labels = noaa_stations_labels = ['{:>7.3f} MHz (Channel {:3})'.format(f[0]/1e6, f[1]) for f in noaa_stations]
        self.chooser_gain = chooser_gain = valid_gains[-1]
        self.chooser_frequency = chooser_frequency = noaa_stations[0][0]

        ##################################################
        # Blocks
        ##################################################
        self.notebook_top = Qt.QTabWidget()
        self.notebook_top_widget_0 = Qt.QWidget()
        self.notebook_top_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_0)
        self.notebook_top_grid_layout_0 = Qt.QGridLayout()
        self.notebook_top_layout_0.addLayout(self.notebook_top_grid_layout_0)
        self.notebook_top.addTab(self.notebook_top_widget_0, "RF")
        self.notebook_top_widget_1 = Qt.QWidget()
        self.notebook_top_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_top_widget_1)
        self.notebook_top_grid_layout_1 = Qt.QGridLayout()
        self.notebook_top_layout_1.addLayout(self.notebook_top_grid_layout_1)
        self.notebook_top.addTab(self.notebook_top_widget_1, "Audio")
        self.top_grid_layout.addWidget(self.notebook_top, 2, 0, 1, 2)
        self._range_ppm_corr_range = Range(-50, 50, 1, 9, 200)
        self._range_ppm_corr_win = RangeWidget(self._range_ppm_corr_range, self.set_range_ppm_corr, "PPM Correction", "counter_slider", int)
        self.notebook_top_grid_layout_0.addWidget(self._range_ppm_corr_win, 0, 1, 1, 1)
        self.notebook_rf = Qt.QTabWidget()
        self.notebook_rf_widget_0 = Qt.QWidget()
        self.notebook_rf_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_rf_widget_0)
        self.notebook_rf_grid_layout_0 = Qt.QGridLayout()
        self.notebook_rf_layout_0.addLayout(self.notebook_rf_grid_layout_0)
        self.notebook_rf.addTab(self.notebook_rf_widget_0, "Spectrum")
        self.notebook_rf_widget_1 = Qt.QWidget()
        self.notebook_rf_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.notebook_rf_widget_1)
        self.notebook_rf_grid_layout_1 = Qt.QGridLayout()
        self.notebook_rf_layout_1.addLayout(self.notebook_rf_grid_layout_1)
        self.notebook_rf.addTab(self.notebook_rf_widget_1, "Waterfall")
        self.notebook_top_layout_0.addWidget(self.notebook_rf)
        self._chooser_gain_options = valid_gains
        self._chooser_gain_labels = ['{}'.format(g) for g in valid_gains]
        self._chooser_gain_tool_bar = Qt.QToolBar(self)
        self._chooser_gain_tool_bar.addWidget(Qt.QLabel("RF Gain"+": "))
        self._chooser_gain_combo_box = Qt.QComboBox()
        self._chooser_gain_tool_bar.addWidget(self._chooser_gain_combo_box)
        for label in self._chooser_gain_labels: self._chooser_gain_combo_box.addItem(label)
        self._chooser_gain_callback = lambda i: Qt.QMetaObject.invokeMethod(self._chooser_gain_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._chooser_gain_options.index(i)))
        self._chooser_gain_callback(self.chooser_gain)
        self._chooser_gain_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_chooser_gain(self._chooser_gain_options[i]))
        self.notebook_top_grid_layout_0.addWidget(self._chooser_gain_tool_bar, 0, 0, 1, 1)
        self._chooser_frequency_options = [f[0] for f in noaa_stations]
        self._chooser_frequency_labels = noaa_stations_labels
        self._chooser_frequency_tool_bar = Qt.QToolBar(self)
        self._chooser_frequency_tool_bar.addWidget(Qt.QLabel("NOAA Frequency"+": "))
        self._chooser_frequency_combo_box = Qt.QComboBox()
        self._chooser_frequency_tool_bar.addWidget(self._chooser_frequency_combo_box)
        for label in self._chooser_frequency_labels: self._chooser_frequency_combo_box.addItem(label)
        self._chooser_frequency_callback = lambda i: Qt.QMetaObject.invokeMethod(self._chooser_frequency_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._chooser_frequency_options.index(i)))
        self._chooser_frequency_callback(self.chooser_frequency)
        self._chooser_frequency_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_chooser_frequency(self._chooser_frequency_options[i]))
        self.top_grid_layout.addWidget(self._chooser_frequency_tool_bar, 0, 0, 1, 1)
        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(chooser_frequency, 0)
        self.rtlsdr_source_0.set_freq_corr(range_ppm_corr, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(2, 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(chooser_gain, 0)
        self.rtlsdr_source_0.set_if_gain(1, 0)
        self.rtlsdr_source_0.set_bb_gain(1, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=int(16e3),
                decimation=int(samp_rate),
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_1 = qtgui.waterfall_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	16e3, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_1.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_1.enable_grid(False)
        
        if not True:
          self.qtgui_waterfall_sink_x_1.disable_legend()
        
        if "float" == "float" or "float" == "msg_float":
          self.qtgui_waterfall_sink_x_1.set_plot_pos_half(not False)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [3, 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_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_1.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_1.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_x_1.set_intensity_range(-80, -40)
        
        self._qtgui_waterfall_sink_x_1_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_1.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_1.addWidget(self._qtgui_waterfall_sink_x_1_win, 0,1,1,1)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #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)
        
        if not False:
          self.qtgui_waterfall_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_x_0.set_intensity_range(-80, -20)
        
        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.notebook_rf_layout_1.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	16e3, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-80, -40)
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(True)
        self.qtgui_freq_sink_x_0_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0_0.disable_legend()
        
        if "float" == "float" or "float" == "msg_float":
          self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not 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", "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_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.notebook_top_grid_layout_1.addWidget(self._qtgui_freq_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
        	chooser_frequency, #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(-80, -20)
        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)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_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.notebook_rf_layout_0.addWidget(self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 6e3, 1e3, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, 16e3, 15, 5, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(16000, "", True)
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=int(16e3),
        	quad_rate=int(16e3),
        	tau=75e-6,
        	max_dev=4e3,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_nbfm_rx_0, 0), (self.high_pass_filter_0, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.qtgui_freq_sink_x_0_0, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_1, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_nbfm_rx_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.qtgui_waterfall_sink_x_0, 0))    
Exemple #39
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Non Linear Junction Detector")

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = -19
        self.variable_check_box_0 = variable_check_box_0 = 0
        self.samp_rate = samp_rate = 4000000
        self.demod_rate = demod_rate = 40000
        self.audio_rate = audio_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=audio_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=-20,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self._variable_check_box_0_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.variable_check_box_0,
            callback=self.set_variable_check_box_0,
            label='rf_on_off',
            true=60,
            false=0,
        )
        self.Add(self._variable_check_box_0_check_box)
        self.sdr_source_0 = sdr.source({}, "CF32", ([0]), {})
        self.sdr_source_0.set_samp_rate(samp_rate)
        self.sdr_source_0.set_center_freq(999000000, 0)
        self.sdr_source_0.set_gain(10, 0)
        self.sdr_sink_0 = sdr.sink({}, "CF32", ([0]), {})
        self.sdr_sink_0.set_samp_rate(samp_rate)
        self.sdr_sink_0.set_center_freq(5875000000, 0)
        self.sdr_sink_0.set_gain(0, 0)
        self.sdr_sink_0.set_antenna('TX/RX', 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=48,
            decimation=40,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_fff(
            100,
            firdes.low_pass(3, samp_rate, 10000, 5000, firdes.WIN_HAMMING,
                            6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.high_pass(2, demod_rate, 100, 50, firdes.WIN_HANN, 6.76))
        self.fosphor_wx_sink_c_0 = fosphor.wx_sink_c(self.GetWin())
        self.fosphor_wx_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_wx_sink_c_0.set_frequency_range(999000000, samp_rate)
        self.Add(self.fosphor_wx_sink_c_0.win)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_abs_xx_0 = blocks.abs_ii(1)
        self.audio_sink_0 = audio.sink(audio_rate, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, -1000000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            100000, analog.GR_COS_WAVE, 0, 2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_abs_xx_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.sdr_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_null_source_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.high_pass_filter_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_abs_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.sdr_source_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.sdr_source_0, 0), (self.fosphor_wx_sink_c_0, 0))
Exemple #40
0
    def __init__(self):
        gr.top_block.__init__(self, "RX logic")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 192000
        self.mode = mode = 2
        self.bw = bw = 3200
        self.aud_rate = aud_rate = 22050
        self.visualsq = visualsq = 1
        self.st = st = 1
        self.sq = sq = -700
        self.sb_pos = sb_pos = ((bw*mode==2)-(bw*mode==3))
        self.rec = rec = 1
        self.laj_0 = laj_0 = 0
        self.laj = laj = 0
        self.lai_0 = lai_0 = 0
        self.lai = lai = 0
        self.freq = freq = 98500000
        self.device = device = "fcd=0,type=2"
        self.dev = dev = 19000
        self.decimation = decimation = samp_rate/aud_rate
        self.batswitch = batswitch = 0
        self.batido = batido = 2950
        self.VEC = VEC = 1280

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="nchan=" + str(1) + " " + device )
        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(7, 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(14, 0)
        self.rtlsdr_source_0.set_if_gain(14, 0)
        self.rtlsdr_source_0.set_bb_gain(14, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.probe_st = analog.probe_avg_mag_sqrd_f(10, 1)
        self.low_pass_filter_0_2 = filter.fir_filter_ccf(decimation, firdes.low_pass(
        	1, samp_rate, bw*(2+(mode==2)+(mode==3)), 500, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1_0_0_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_1 = filter.fir_filter_fff(1, firdes.low_pass(
        	30, samp_rate, 14000, 1000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0_0_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	visualsq, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass(
        	1, samp_rate/decimation, bw, 10, firdes.WIN_HAMMING, 6.76))
        self.fractional_resampler_xx_0_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0)
        self.fractional_resampler_xx_0_0 = filter.fractional_resampler_ff(0, samp_rate/48000.0)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_ff(0, (samp_rate/decimation)/48000.0)
        self.fft_vxx_0 = fft.fft_vcc(VEC, True, (window.blackmanharris(1024)), True, 1)
        self.fft_probe = blocks.probe_signal_vf(VEC)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/tmp/CAPTURE.WAV", 2, 48000, 16)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, VEC)
        self.blocks_multiply_xx_0_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0_0_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(VEC)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((-complex(lai,laj), ))
        self.blks2_valve_0_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec))
        self.blks2_valve_0_0_1 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=5))
        self.blks2_valve_0_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(0))
        self.blks2_valve_0_0 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(mode!=4))
        self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec))
        self.blks2_selector_0_1_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=(mode==3),
        	output_index=0,
        )
        self.blks2_selector_0_0_1_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=3,
        	num_outputs=1,
        	input_index=(mode>3)+(mode>4),
        	output_index=0,
        )
        self.blks2_selector_0_0_1 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=3,
        	num_outputs=1,
        	input_index=(mode>3)+(mode>4),
        	output_index=0,
        )
        self.blks2_selector_0_0 = grc_blks2.selector(
        	item_size=gr.sizeof_float*1,
        	num_inputs=4,
        	num_outputs=1,
        	input_index=mode,
        	output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=1,
        	num_outputs=4,
        	input_index=0,
        	output_index=mode,
        )
        self.band_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	250, samp_rate, 18500, 19500, 500, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	120, samp_rate, 24000, 52000, 1000, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "dmix:CARD=Pro,DEV=0", False)
        self.analog_wfm_rcv_1 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=1,
        )
        self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate/decimation, analog.GR_COS_WAVE, -bw, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, dev+(bw*mode==2)+(bw*mode==3), 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(0.25)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
        	channel_rate=samp_rate,
        	audio_decim=samp_rate/48000,
        	deviation=50000,
        	audio_pass=15000,
        	audio_stop=16000,
        	gain=3.0,
        	tau=50e-6,
        )
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=48000, tau=50e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=48000, tau=50e-6)
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(64, 0.9)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=samp_rate/decimation,
        	audio_decim=samp_rate/decimation/aud_rate,
        	audio_pass=(samp_rate/decimation/2)-500,
        	audio_stop=(samp_rate/decimation/2)-100,
        )
        self.analog_agc3_xx_0 = analog.agc3_cc(0.0001, 0.0001, 0.9, 0.1)
        self.analog_agc3_xx_0.set_max_gain(200)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.fft_probe, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_valve_0_0_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_1_0, 0))
        self.connect((self.low_pass_filter_0_1, 0), (self.analog_fm_deemph_0, 0))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.low_pass_filter_0_1, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_wfm_rcv_1, 0), (self.band_pass_filter_0_0_0, 0))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.low_pass_filter_0_1_0_0_0, 0), (self.analog_fm_deemph_0_0, 0))
        self.connect((self.analog_agc3_xx_0, 0), (self.analog_wfm_rcv_1, 0))
        self.connect((self.blks2_valve_0_0_1, 0), (self.analog_agc3_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_1, 0))
        self.connect((self.blocks_multiply_xx_0_1_0, 0), (self.low_pass_filter_0_1_0_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 1))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_multiply_xx_0_1_0, 2))
        self.connect((self.analog_fm_deemph_0_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.analog_fm_deemph_0, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.fractional_resampler_xx_0_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fractional_resampler_xx_0_0, 0))
        self.connect((self.blks2_valve_0_0, 0), (self.analog_fm_demod_cf_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_valve_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_2, 0))
        self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 3))
        self.connect((self.blocks_complex_to_real_0_0_0_0, 0), (self.blks2_selector_0_0, 2))
        self.connect((self.blks2_selector_0_1_0, 0), (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_0, 0), (self.blocks_complex_to_real_0_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.analog_am_demod_cf_0, 0), (self.blks2_selector_0_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blks2_selector_0_0, 1))
        self.connect((self.blks2_selector_0, 1), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blks2_selector_0_0, 0), (self.low_pass_filter_0_0_0_0, 0))
        self.connect((self.blks2_selector_0, 2), (self.high_pass_filter_0, 0))
        self.connect((self.blks2_selector_0, 3), (self.low_pass_filter_0_0_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.blks2_selector_0_1_0, 0))
        self.connect((self.low_pass_filter_0_0_0, 0), (self.blks2_selector_0_1_0, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1, 1))
        self.connect((self.analog_fm_demod_cf_0, 0), (self.blks2_selector_0_0_1_0, 1))
        self.connect((self.fractional_resampler_xx_0_0_0, 0), (self.blks2_selector_0_0_1_0, 2))
        self.connect((self.fractional_resampler_xx_0_0, 0), (self.blks2_selector_0_0_1, 2))
        self.connect((self.blks2_selector_0_0_1_0, 0), (self.audio_sink_0, 1))
        self.connect((self.blks2_selector_0_0_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blks2_valve_0, 0), (self.blocks_wavfile_sink_0, 1))
        self.connect((self.blks2_selector_0_0_1_0, 0), (self.blks2_valve_0, 0))
        self.connect((self.blks2_selector_0_0_1, 0), (self.blks2_valve_0_1, 0))
        self.connect((self.blks2_valve_0_1, 0), (self.blocks_wavfile_sink_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.blks2_selector_0_0_1, 0))
        self.connect((self.low_pass_filter_0_2, 0), (self.analog_feedforward_agc_cc_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0_0_0_0, 0), (self.fractional_resampler_xx_0, 0))
        self.connect((self.analog_feedforward_agc_cc_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.probe_st, 0))