def create_number_sink (self, sps):   
     self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
         self.GetWin(),
         unit="Units",
         minval=-100,
         maxval=100,
         factor=1.0,
         decimal_places=10,
         ref_level=0,
         sample_rate=sps,
         number_rate=15,
         average=False,
         avg_alpha=None,
         label="BER",
         peak_hold=False,
         show_gauge=True,
     )
     self.Add(self.wxgui_numbersink2_1.win)
     self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
         self.GetWin(),
         unit="Units",
         minval=-100,
         maxval=100,
         factor=1.0,
         decimal_places=10,
         ref_level=0,
         sample_rate=sps,
         number_rate=15,
         average=False,
         avg_alpha=None,
         label="SNR",
         peak_hold=False,
         show_gauge=True,
     )
     self.Add(self.wxgui_numbersink2_0.win)
Exemple #2
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="Hz",
            minval=50,
            maxval=280,
            factor=1,
            decimal_places=2,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=False,
            avg_alpha=None,
            label="Number Plot",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(samp_rate / 50, 25 / pi, 200)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float * 1, 10)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.band_pass_filter_0 = filter.fir_filter_ccc(
            1, firdes.complex_band_pass(1, samp_rate, 60, 255, 100, firdes.WIN_BLACKMAN, 6.76)
        )
        self.audio_source_0 = audio.source(samp_rate, "default", True)
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(
            200 * 2.0 * pi / samp_rate, 260 * 2.0 * pi / samp_rate, 60 * 2.0 * pi / samp_rate
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_moving_average_xx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_moving_average_xx_0, 0))
Exemple #3
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="BER Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="%",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="BER",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_not_xx_0 = blocks.not_bb()
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.bitErrorRate_0 = bitErrorRate()
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 2, 16)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.bitErrorRate_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.bitErrorRate_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.blocks_not_xx_0, 0))
        self.connect((self.blocks_not_xx_0, 0), (self.bitErrorRate_0, 1))
Exemple #4
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="My First Block Fg")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="Units",
			minval=-100,
			maxval=100,
			factor=1.0,
			decimal_places=10,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Number Plot",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.my_first_python_block_0 = dt.my_first_python_block()
		self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
		self.const_source_x_0_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, -22)
		self.const_source_x_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 5)

		##################################################
		# Connections
		##################################################
		self.connect((self.const_source_x_0, 0), (self.my_first_python_block_0, 0))
		self.connect((self.const_source_x_0_0, 0), (self.my_first_python_block_0, 1))
		self.connect((self.my_first_python_block_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.wxgui_numbersink2_0, 0))
Exemple #5
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="Units",
			minval=-100,
			maxval=100,
			factor=1.0,
			decimal_places=5,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Addition",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.operation_add_0 = gnuradio.add.add()
		self.const_source_x_1 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 13)
		self.const_source_x_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 6)

		##################################################
		# Connections
		##################################################
		self.connect((self.const_source_x_0, 0), (self.operation_add_0, 1))
		self.connect((self.const_source_x_1, 0), (self.operation_add_0, 0))
		self.connect((self.operation_add_0, 0), (self.wxgui_numbersink2_0, 0))
Exemple #6
0
	def __init__(self, fm_subcarrier=9960, zero_point=-5):
		grc_wxgui.top_block_gui.__init__(self, title="VOR Receiver")

		##################################################
		# Parameters
		##################################################
		self.fm_subcarrier = fm_subcarrier
		self.zero_point = zero_point

		##################################################
		# Variables
		##################################################
		self.rf_rate = rf_rate = 1000000
		self.dir_rate = dir_rate = 10
		self.channel_rate = channel_rate = 40000
		self.audio_rate = audio_rate = 10000
		self.vor_freq = vor_freq = 113.9e6
		self.volume = volume = 0
		self.rf_scale = rf_scale = int(rf_rate/channel_rate) + rf_rate % channel_rate
		self.offset = offset = fm_subcarrier + 4000
		self.dir_scale = dir_scale = int(audio_rate/dir_rate) + audio_rate % dir_rate
		self.channel = channel = 113.9e6
		self.audio_scale = audio_scale = int(channel_rate/audio_rate) + channel_rate % audio_rate

		##################################################
		# Blocks
		##################################################
		_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=-10,
			maximum=10,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_volume_sizer)
		self._channel_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.channel,
			callback=self.set_channel,
			label="Channel (Hz)",
			converter=forms.float_converter(),
		)
		self.Add(self._channel_text_box)
		self.zeroer = blocks.add_const_vff((zero_point*(math.pi/180), ))
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="deg",
			minval=-180,
			maxval=180,
			factor=180/math.acos(-1),
			decimal_places=2,
			ref_level=0,
			sample_rate=dir_rate,
			number_rate=dir_rate,
			average=True,
			avg_alpha=.25,
			label="Direction",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=channel,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=channel_rate,
			fft_size=1024,
			fft_rate=15,
			average=True,
			avg_alpha=0.25,
			title="Channel",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self._vor_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.vor_freq,
			callback=self.set_vor_freq,
			label='vor_freq',
			converter=forms.float_converter(),
		)
		self.Add(self._vor_freq_text_box)
		self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
		        interpolation=40,
		        decimation=1,
		        taps=None,
		        fractional_bw=None,
		)
		self.low_pass_filter_1 = filter.fir_filter_ccf(1, firdes.low_pass(
			1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
			1, channel_rate, 10000, 4000, firdes.WIN_HAMMING, 6.76))
		self.goertzel_fc_0_0 = fft.goertzel_fc(channel_rate, dir_scale*audio_scale, 30)
		self.goertzel_fc_0 = fft.goertzel_fc(audio_rate, dir_scale, 30)
		self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1.0, channel_rate, 500, 100, firdes.WIN_HAMMING)), fm_subcarrier, channel_rate)
		self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(rf_scale, (firdes.low_pass(1.0, rf_rate, channel_rate, channel_rate/2, firdes.WIN_HAMMING)), 900, rf_rate)
		self.dc_blocker_xx_0 = filter.dc_blocker_ff(128, True)
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 1e6)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10**(volume/10), ))
		self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/john/apps/aviation_rx/woodside_vor25.dat", True)
		self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, int(channel_rate/30*0.0))
		self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
		self.audio_sink_0 = audio.sink(audio_rate, "", True)
		self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
		self.analog_am_demod_cf_0 = analog.am_demod_cf(
			channel_rate=40e3,
			audio_decim=4,
			audio_pass=5000,
			audio_stop=5500,
		)
		self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_1.set_max_gain(65536)
		self.analog_agc2_xx_0_1_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_0_1_0.set_max_gain(100)
		self.analog_agc2_xx_0_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_0_1.set_max_gain(100)

		##################################################
		# Connections
		##################################################
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_delay_0, 0))
		self.connect((self.analog_quadrature_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
		self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0_1, 0))
		self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_1_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.blocks_delay_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0))
		self.connect((self.blocks_complex_to_arg_0, 0), (self.zeroer, 0))
		self.connect((self.zeroer, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.low_pass_filter_1, 0), (self.blocks_complex_to_arg_0, 0))
		self.connect((self.analog_agc2_xx_0_1, 0), (self.blocks_multiply_conjugate_cc_0, 0))
		self.connect((self.analog_agc2_xx_0_1_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
		self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_1, 0))
		self.connect((self.low_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0))
		self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0, 0))
		self.connect((self.analog_am_demod_cf_0, 0), (self.dc_blocker_xx_0, 0))
		self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_file_source_0, 0), (self.rational_resampler_xxx_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_1, 0))
		self.connect((self.analog_agc2_xx_1, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.freq_0 = freq_0 = 525.2e6
        self.threshold = threshold = -60
        self.samp_rate = samp_rate = 2.048e6
        self.freq = freq = freq_0

        ##################################################
        # Blocks
        ##################################################
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	label="threshold",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._threshold_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	minimum=-100,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_threshold_sizer)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="signal present",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=2.048e6,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Signal detection",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-120,
        	maxval=0,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=2048000,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=2048000,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.030,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(2.048e6)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(30, 0)
        self.rtlsdr_source_0.set_if_gain(30, 0)
        self.rtlsdr_source_0.set_bb_gain(5, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab1")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab2")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab3")
        self.Add(self.notebook_0)
        _freq_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_0_sizer,
        	value=self.freq_0,
        	callback=self.set_freq_0,
        	label='freq_0',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_0_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_0_sizer,
        	value=self.freq_0,
        	callback=self.set_freq_0,
        	minimum=478e6,
        	maximum=862e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_0_sizer)
        self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.rectangular(1024)), True, 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, 1024)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 2048000,True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, -60)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_int*1, "/media/ubuntu/01D165566F075780/Q3/wireless networking/GNU/out1.txt", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1024)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1.04858e6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))    
Exemple #8
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2.5e6
        self.decim = decim = 1
        self.post_decim = post_decim = samp_rate / decim
        self.freq_ctr2 = freq_ctr2 = 990e6
        self.freq_ctr1 = freq_ctr1 = 990e6
        self.cutoff = cutoff = 1e4 * 5

        ##################################################
        # Blocks
        ##################################################
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "1")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "2")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "3")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "4")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "5")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "6")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "7")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "8")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "9")
        self.Add(self.notebook_0)
        _freq_ctr1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_ctr1_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_freq_ctr1_sizer,
            value=self.freq_ctr1,
            callback=self.set_freq_ctr1,
            label="center frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_ctr1_slider = forms.slider(
            parent=self.notebook_0.GetPage(0).GetWin(),
            sizer=_freq_ctr1_sizer,
            value=self.freq_ctr1,
            callback=self.set_freq_ctr1,
            minimum=989.1e6,
            maximum=990.1e6,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.notebook_0.GetPage(0).Add(_freq_ctr1_sizer)
        self.wxgui_scopesink2_1_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=post_decim,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_1_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(2).GetWin(),
            title="Scope Plot",
            sample_rate=post_decim,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_numbersink2_0_0_0_1 = numbersink2.number_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            unit="Hz",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate * 0 + post_decim,
            number_rate=15,
            average=False,
            avg_alpha=0.001,
            label="phase",
            peak_hold=False,
            show_gauge=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_numbersink2_0_0_0_1.win)
        self.wxgui_numbersink2_0_0_0_0 = numbersink2.number_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            unit="Hz",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate * 0 + post_decim,
            number_rate=15,
            average=False,
            avg_alpha=0.001,
            label="error",
            peak_hold=False,
            show_gauge=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_numbersink2_0_0_0_0.win)
        self.wxgui_numbersink2_0_0_0 = numbersink2.number_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            unit="Hz",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate * 0 + post_decim,
            number_rate=15,
            average=False,
            avg_alpha=0.001,
            label="freq",
            peak_hold=False,
            show_gauge=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_numbersink2_0_0_0.win)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            unit="",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate * 0 + post_decim,
            number_rate=15,
            average=False,
            avg_alpha=0.001,
            label="signal",
            peak_hold=False,
            show_gauge=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=freq_ctr1,
            y_per_div=10,
            y_divs=5,
            ref_level=-10,
            ref_scale=2.0,
            sample_rate=samp_rate * 0 + post_decim,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.2,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=freq_ctr1,
            y_per_div=10,
            y_divs=5,
            ref_level=-10,
            ref_scale=2.0,
            sample_rate=samp_rate * 0 + post_decim,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.2,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.osmosdr_source_c_0 = osmosdr.source_c(args="nchan=" + str(1) + " " + "rtl=0,xtal=28.8e6,tuner_xtal=28.8e6")
        self.osmosdr_source_c_0.set_sample_rate(samp_rate)
        self.osmosdr_source_c_0.set_center_freq(freq_ctr1, 0)
        self.osmosdr_source_c_0.set_freq_corr(0, 0)
        self.osmosdr_source_c_0.set_iq_balance_mode(2, 0)
        self.osmosdr_source_c_0.set_gain_mode(1, 0)
        self.osmosdr_source_c_0.set_gain(0, 0)
        self.osmosdr_source_c_0.set_if_gain(0, 0)

        self.low_pass_filter_0 = gr.fir_filter_ccf(
            decim, firdes.low_pass(1, samp_rate, samp_rate / 4, samp_rate / 4, firdes.WIN_HAMMING, 6.76)
        )
        _freq_ctr2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_ctr2_text_box = forms.text_box(
            parent=self.notebook_0.GetPage(4).GetWin(),
            sizer=_freq_ctr2_sizer,
            value=self.freq_ctr2,
            callback=self.set_freq_ctr2,
            label="center frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_ctr2_slider = forms.slider(
            parent=self.notebook_0.GetPage(4).GetWin(),
            sizer=_freq_ctr2_sizer,
            value=self.freq_ctr2,
            callback=self.set_freq_ctr2,
            minimum=989.1e6,
            maximum=990.1e6,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.notebook_0.GetPage(4).Add(_freq_ctr2_sizer)
        self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(2, 0.05, 512, 0.008)
        self.analog_pll_refout_cc_0 = analog.pll_refout_cc(math.pi / 1000, 2, -2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_scopesink2_1_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 2), (self.wxgui_numbersink2_0_0_0_1, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 3), (self.wxgui_numbersink2_0_0_0_0, 0))
        self.connect((self.osmosdr_source_c_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.digital_fll_band_edge_cc_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 1), (self.wxgui_numbersink2_0_0_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0), (self.analog_pll_refout_cc_0, 0))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.analog_pll_refout_cc_0, 0), (self.wxgui_numbersink2_0_0, 0))
Exemple #9
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Psk31 Rx")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.center_freq = center_freq = 441000000
        self.samp_rate = samp_rate = 960000
        self.psk_offset = psk_offset = 1000
        self.psk_center = psk_center = center_freq + 141000
        self.int_rate = int_rate = 48000
        self.gain = gain = 30
        self.corr = corr = 0
        self.audio_rate = audio_rate = 8000

        ##################################################
        # Message Queues
        ##################################################
        blocks_message_sink_0_msgq_out = wxgui_termsink_0_msgq_in = gr.msg_queue(2)

        ##################################################
        # Blocks
        ##################################################
        _psk_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._psk_offset_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_psk_offset_sizer,
        	value=self.psk_offset,
        	callback=self.set_psk_offset,
        	label="PSK offset",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._psk_offset_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_psk_offset_sizer,
        	value=self.psk_offset,
        	callback=self.set_psk_offset,
        	minimum=0,
        	maximum=3000,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_psk_offset_sizer, 1, 0, 1, 2)
        _psk_center_sizer = wx.BoxSizer(wx.VERTICAL)
        self._psk_center_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_psk_center_sizer,
        	value=self.psk_center,
        	callback=self.set_psk_center,
        	label="Tuning",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._psk_center_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_psk_center_sizer,
        	value=self.psk_center,
        	callback=self.set_psk_center,
        	minimum=center_freq + 110000,
        	maximum=center_freq + 150000,
        	num_steps=40,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_psk_center_sizer, 0, 0, 1, 2)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "960 kHz")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "48 kHz")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "4 kHz")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "I/Q scope")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Constellation")
        self.GridAdd(self.nb, 3, 0, 1, 2)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label='gain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=49.6,
        	num_steps=124,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_gain_sizer, 2, 0, 1, 1)
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_corr_sizer,
        	value=self.corr,
        	callback=self.set_corr,
        	label='corr',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._corr_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_corr_sizer,
        	value=self.corr,
        	callback=self.set_corr,
        	minimum=-150,
        	maximum=150,
        	num_steps=300,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_corr_sizer, 2, 1, 1, 1)
        self.wxgui_waterfallsink2_2 = waterfallsink2.waterfall_sink_f(
        	self.nb.GetPage(2).GetWin(),
        	baseband_freq=0,
        	dynamic_range=30,
        	ref_level=-40,
        	ref_scale=2.0,
        	sample_rate=audio_rate,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        	win=window.blackmanharris,
        	size=((800,400)),
        )
        self.nb.GetPage(2).Add(self.wxgui_waterfallsink2_2.win)
        def wxgui_waterfallsink2_2_callback(x, y):
        	self.set_psk_offset(x)
        
        self.wxgui_waterfallsink2_2.set_callback(wxgui_waterfallsink2_2_callback)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=psk_center,
        	dynamic_range=30,
        	ref_level=-30,
        	ref_scale=2.0,
        	sample_rate=int_rate,
        	fft_size=2048,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        	size=((800,400)),
        )
        self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=center_freq,
        	dynamic_range=30,
        	ref_level=-20,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=2048,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        	size=((800,400)),
        )
        self.nb.GetPage(0).Add(self.wxgui_waterfallsink2_0.win)
        def wxgui_waterfallsink2_0_callback(x, y):
        	self.set_psk_center(x)
        
        self.wxgui_waterfallsink2_0.set_callback(wxgui_waterfallsink2_0_callback)
        self.wxgui_termsink_0 = termsink.termsink(
        	parent=self.GetWin(),
        	size=(500,100),
        	msgq=wxgui_termsink_0_msgq_in,
        )
        self.Add(self.wxgui_termsink_0)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.nb.GetPage(4).GetWin(),
        	title="Scope Plot",
        	sample_rate=31.25,
        	v_scale=0.4,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(4).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
        	self.nb.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=500,
        	v_scale=0.4,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Hz",
        	minval=-500 / math.pi,
        	maxval=500 / math.pi,
        	factor=500 / math.pi,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=500,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Carrier tracking offset",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_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(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(corr, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(0, 0)
        self.osmosdr_source_0.set_gain(gain, 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.ham_varicode_rx_0 = ham.varicode_rx()
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(16, (firdes.low_pass(10, audio_rate, 120, 40, firdes.WIN_HAMMING, 6.76)), psk_offset, audio_rate)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(samp_rate / int_rate, (firdes.low_pass(1, samp_rate, 12000, 12000, firdes.WIN_HAMMING, 6.76)), round(psk_center - center_freq,-3), samp_rate)
        self.digital_diff_phasor_cc_0 = digital.diff_phasor_cc()
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(5 * math.pi /100.0, 2)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_cc(16, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_message_sink_0 = blocks.message_sink(gr.sizeof_char*1, blocks_message_sink_0_msgq_out, True)
        self.blocks_complex_to_real_1 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.band_pass_filter_0 = filter.fir_filter_ccc(int_rate / audio_rate, firdes.complex_band_pass(
        	1, int_rate, 200, 2800, 200, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(audio_rate, "plughw:0,0", True)
        self.analog_agc_xx_0 = analog.agc_cc(1e-3, 0.1, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.wxgui_waterfallsink2_2, 0))
        self.connect((self.digital_costas_loop_cc_0, 1), (self.wxgui_numbersink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_diff_phasor_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.ham_varicode_rx_0, 0), (self.blocks_message_sink_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.ham_varicode_rx_0, 0))
        self.connect((self.blocks_complex_to_real_1, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_diff_phasor_cc_0, 0), (self.blocks_complex_to_real_1, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.audio_sink_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.analog_agc_xx_0, 0))
        self.connect((self.analog_agc_xx_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.analog_agc_xx_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.wxgui_scopesink2_1, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="DVB-T Signal Detector using RTL-SDR")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.threshold = threshold = -70
        self.samp_rate = samp_rate = 2048000
        self.probe_level = probe_level = 0
        self.probe_detection = probe_detection = 0
        self.freq = freq = 525200000
        self.fft_size = fft_size = 1024

        ##################################################
        # Blocks
        ##################################################
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_threshold_sizer,
            value=self.threshold,
            callback=self.set_threshold,
            label="Threshold",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._threshold_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_threshold_sizer,
            value=self.threshold,
            callback=self.set_threshold,
            minimum=-100,
            maximum=0,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_threshold_sizer)
        self.probe_signal_level = blocks.probe_signal_f()
        self.probe_signal_detection = blocks.probe_signal_f()
        self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Waterfall")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Spectrum")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Output")
        self.Add(self.notebook)
        _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=478000000,
            maximum=862000000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook.GetPage(0).GetWin(),
            baseband_freq=freq,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=fft_size,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
            win=window.rectangular,
        )
        self.notebook.GetPage(0).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
            self.notebook.GetPage(2).GetWin(),
            unit="dB",
            minval=-120,
            maxval=0,
            factor=1,
            decimal_places=0,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=False,
            avg_alpha=0.03,
            label="Level",
            peak_hold=False,
            show_gauge=True,
        )
        self.notebook.GetPage(2).Add(self.wxgui_numbersink2_1.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.notebook.GetPage(2).GetWin(),
            unit="signal present",
            minval=0,
            maxval=1,
            factor=1.0,
            decimal_places=0,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=False,
            avg_alpha=None,
            label="Signal Detector",
            peak_hold=False,
            show_gauge=True,
        )
        self.notebook.GetPage(2).Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
            self.notebook.GetPage(1).GetWin(),
            baseband_freq=freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=fft_size,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Spectrum",
            peak_hold=False,
            win=window.rectangular,
        )
        self.notebook.GetPage(1).Add(self.wxgui_fftsink2_1.win)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + "")
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(20, 0)
        self.rtlsdr_source_0.set_if_gain(10, 0)
        self.rtlsdr_source_0.set_bb_gain(5, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        def _probe_level_probe():
            while True:
                val = self.probe_signal_level.level()
                try:
                    self.set_probe_level(val)
                except AttributeError, e:
                    pass
                time.sleep(1.0 / (10))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.threshold = threshold = -70
        self.samp_rate = samp_rate = 2048000
        self.freq = freq = 525200000
        self.fft_size = fft_size = 1024

        ##################################################
        # Blocks
        ##################################################
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	label="Threshold",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._threshold_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	minimum=-100,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_threshold_sizer)
        _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=478000000,
        	maximum=862000000,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="signal present",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=0,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Signal Detection",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_1.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="dB",
        	minval=-120,
        	maxval=0,
        	factor=1.0,
        	decimal_places=0,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.030,
        	label="Level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=fft_size,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	title="Spectrum",
        	peak_hold=False,
        	win=window.rectangular,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_1 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_1.set_sample_rate(samp_rate)
        self.rtlsdr_source_1.set_center_freq(freq, 0)
        self.rtlsdr_source_1.set_freq_corr(0, 0)
        self.rtlsdr_source_1.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_1.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_1.set_gain_mode(False, 0)
        self.rtlsdr_source_1.set_gain(20, 0)
        self.rtlsdr_source_1.set_if_gain(10, 0)
        self.rtlsdr_source_1.set_bb_gain(5, 0)
        self.rtlsdr_source_1.set_antenna("", 0)
        self.rtlsdr_source_1.set_bandwidth(1, 0)
          
        self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "spectrum")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "output")
        self.Add(self.notebook)
        self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.blackmanharris(1024)), True, 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_size)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, threshold)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_size)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, fft_size*fft_size)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_1, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.rtlsdr_source_1, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.rtlsdr_source_1, 0), (self.wxgui_fftsink2_0, 0))    
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx Only Power")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = 48
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 20e6
        self.lo_offset = lo_offset = 11e6
        self.gain = gain = 20
        self.freq = freq = 5.805e9
        self.chan_est = chan_est = 0

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.samp_rate,
        	callback=self.set_samp_rate,
        	label="Sample Rate",
        	choices=[5e6, 10e6, 20e6],
        	labels=["5 MHz", "10 MHz", "20 MHz"],
        	style=wx.RA_HORIZONTAL,
        )
        self.Add(self._samp_rate_chooser)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "FFT")
        self.Add(self.nb)
        self._lo_offset_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.lo_offset,
        	callback=self.set_lo_offset,
        	label="LO Offset",
        	choices=[0, 6e6, 11e6],
        	labels=['0 MHz', '6 MHz', '11 MHz'],
        )
        self.Add(self._lo_offset_chooser)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label='gain',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=100,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_gain_sizer)
        self._freq_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.freq,
        	callback=self.set_freq,
        	label="Channel",
        	choices=[2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0, 2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0, 2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0, 2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0, 5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0, 5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0, 5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0, 5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0, 5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0, 5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0, 5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0, 5920000000.0],
        	labels=['  1 | 2412.0 | 11g', '  2 | 2417.0 | 11g', '  3 | 2422.0 | 11g', '  4 | 2427.0 | 11g', '  5 | 2432.0 | 11g', '  6 | 2437.0 | 11g', '  7 | 2442.0 | 11g', '  8 | 2447.0 | 11g', '  9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g', ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g', ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g', ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a', ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a', ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a', ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a', ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a', ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a', '100 | 5500.0 | 11a', '104 | 5520.0 | 11a', '108 | 5540.0 | 11a', '112 | 5560.0 | 11a', '116 | 5580.0 | 11a', '120 | 5600.0 | 11a', '124 | 5620.0 | 11a', '128 | 5640.0 | 11a', '132 | 5660.0 | 11a', '136 | 5680.0 | 11a', '140 | 5700.0 | 11a', '149 | 5745.0 | 11a', '153 | 5765.0 | 11a', '157 | 5785.0 | 11a', '161 | 5805.0 | 11a', '165 | 5825.0 | 11a', '172 | 5860.0 | 11p', '174 | 5870.0 | 11p', '176 | 5880.0 | 11p', '178 | 5890.0 | 11p', '180 | 5900.0 | 11p', '182 | 5910.0 | 11p', '184 | 5920.0 | 11p'],
        )
        self.Add(self._freq_chooser)
        self._chan_est_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.chan_est,
        	callback=self.set_chan_est,
        	label='chan_est',
        	choices=[0, 1],
        	labels=["LMS", "Linear Comb"],
        	style=wx.RA_HORIZONTAL,
        )
        self.Add(self._chan_est_chooser)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_scopesink1 = scopesink2.scope_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	title="Scope Plot",
        	sample_rate=12500,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(0).Add(self.wxgui_scopesink1.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="%",
        	minval=0,
        	maxval=100,
        	factor=1.0,
        	decimal_places=2,
        	ref_level=0,
        	sample_rate=1,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.02,
        	label="Frame Error Rate",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(2).GetWin(),
        	baseband_freq=580.5*10e6,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=gain,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=64,
        	fft_rate=15,
        	average=True,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        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(uhd.tune_request(freq, rf_freq = freq - lo_offset, rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(0.56, 2, False, False)
        self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(sync_length, True, False)
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True)
        self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(chan_est, False)
        self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(True, False)
        self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(True, True)
        self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(window_size + 16)
        self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(window_size)
        self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True, 1)
        self.blocks_vector_to_stream_1 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 64)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 48)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 64)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len")
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/furonics/GNURadio/25Feb2016DataTransfer.dat", False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/furonics/GNURadio/11thFeb2016_AtHome.pcap", False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex*1, 16)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, sync_length)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.foo_wireshark_connector_0, 'in'))    
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'), (self.ieee802_11_ofdm_parse_mac_0, 'in'))    
        self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.ieee802_11_moving_average_xx_1, 0))    
        self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_delay_0, 0), (self.ieee802_11_ofdm_sync_long_0, 1))    
        self.connect((self.blocks_delay_0_0, 0), (self.blocks_conjugate_cc_0, 0))    
        self.connect((self.blocks_delay_0_0, 0), (self.ieee802_11_ofdm_sync_short_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 2))    
        self.connect((self.blocks_divide_xx_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.ieee802_11_moving_average_xx_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.wxgui_scopesink1, 0))    
        self.connect((self.blocks_vector_to_stream_1, 0), (self.blocks_file_sink_1, 0))    
        self.connect((self.blocks_vector_to_stream_1, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_1, 0))    
        self.connect((self.fft_vxx_0, 0), (self.ieee802_11_ofdm_equalize_symbols_0, 0))    
        self.connect((self.foo_wireshark_connector_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.ieee802_11_moving_average_xx_0, 0), (self.ieee802_11_ofdm_sync_short_0, 1))    
        self.connect((self.ieee802_11_moving_average_xx_1, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0), (self.ieee802_11_ofdm_decode_mac_0, 0))    
        self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0), (self.ieee802_11_ofdm_decode_signal_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_long_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.blocks_delay_0, 0))    
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0), (self.ieee802_11_ofdm_sync_long_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))    
    def __init__(self, clock=100.0e6, dcg=1, decln=-28.0, devid="addr=192.168.10.2", fftsize=8192, frequency=1.406e9, maxg=50, rfgain=0.0, rxant="", spa=1, srate=10.0e6, subdev="A:0", tpint=2.0):
        grc_wxgui.top_block_gui.__init__(self, title="Total Power Radiometer - N200 with Filter")

        ##################################################
        # Parameters
        ##################################################
        self.clock = clock
        self.dcg = dcg
        self.decln = decln
        self.devid = devid
        self.fftsize = fftsize
        self.frequency = frequency
        self.maxg = maxg
        self.rfgain = rfgain
        self.rxant = rxant
        self.spa = spa
        self.srate = srate
        self.subdev = subdev
        self.tpint = tpint

        ##################################################
        # Variables
        ##################################################
        self.israte = israte = srate
        self.samp_rate = samp_rate = int(israte)
        self.prefix = prefix = "tpr_"
        self.filter_band = filter_band = 500e3
        self.variable_static_text_0_0_0_0 = variable_static_text_0_0_0_0 = clock
        self.variable_static_text_0_0_0 = variable_static_text_0_0_0 = devid
        self.variable_static_text_0_0 = variable_static_text_0_0 = subdev
        self.variable_static_text_0 = variable_static_text_0 = israte
        self.taps = taps = firdes.low_pass(1.0, samp_rate,filter_band, 1000)
        self.spec_data_fifo = spec_data_fifo = "spectrum_" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.spavg = spavg = int(spa)
        self.scope_rate = scope_rate = 2
        self.recfile_tpr = recfile_tpr = prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.recfile_kelvin = recfile_kelvin = prefix+"kelvin" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.rec_button_tpr = rec_button_tpr = 1
        self.rec_button_iq = rec_button_iq = 1
        self.integ = integ = tpint
        self.idecln = idecln = decln
        self.gain = gain = 26
        self.freq = freq = frequency
        self.file_rate = file_rate = 2.0
        self.fftrate = fftrate = int(samp_rate/fftsize)
        self.det_rate = det_rate = int(20.0)
        self.dc_gain = dc_gain = int(dcg)
        self.calib_2 = calib_2 = -342.774
        self.calib_1 = calib_1 = 4.0755e3
        self.add_filter = add_filter = 0

        ##################################################
        # Blocks
        ##################################################
        self.Main = self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.Main.AddPage(grc_wxgui.Panel(self.Main), "N200 Control Panel")
        self.Main.AddPage(grc_wxgui.Panel(self.Main), "TPR Measurements")
        self.Add(self.Main)
        _spavg_sizer = wx.BoxSizer(wx.VERTICAL)
        self._spavg_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_spavg_sizer,
        	value=self.spavg,
        	callback=self.set_spavg,
        	label="Spectral Averaging (Seconds)",
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._spavg_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_spavg_sizer,
        	value=self.spavg,
        	callback=self.set_spavg,
        	minimum=1,
        	maximum=20,
        	num_steps=20,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_spavg_sizer, 1, 1, 1, 1)
        self._rec_button_tpr_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.rec_button_tpr,
        	callback=self.set_rec_button_tpr,
        	label="Record TPR Data",
        	choices=[0,1],
        	labels=['Stop','Start'],
        )
        self.Main.GetPage(0).GridAdd(self._rec_button_tpr_chooser, 4, 1, 1, 1)
        self._rec_button_iq_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.rec_button_iq,
        	callback=self.set_rec_button_iq,
        	label="Record I/Q Data",
        	choices=[0,1],
        	labels=['Stop','Start'],
        )
        self.Main.GetPage(0).GridAdd(self._rec_button_iq_chooser, 4, 0, 1, 1)
        self._israte_chooser = forms.radio_buttons(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.israte,
        	callback=self.set_israte,
        	label="Sample Rate (BW)",
        	choices=[1e6,2e6,5e6,10e6,25e6],
        	labels=['1 MHz','2 MHz','5 MHz','10 MHz','25 MHz'],
        	style=wx.RA_HORIZONTAL,
        )
        self.Main.GetPage(0).GridAdd(self._israte_chooser, 1, 3, 1, 1)
        _integ_sizer = wx.BoxSizer(wx.VERTICAL)
        self._integ_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_integ_sizer,
        	value=self.integ,
        	callback=self.set_integ,
        	label="Integration Time (Seconds)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._integ_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_integ_sizer,
        	value=self.integ,
        	callback=self.set_integ,
        	minimum=1,
        	maximum=60,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_integ_sizer, 0, 2, 1, 1)
        self._freq_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.freq,
        	callback=self.set_freq,
        	label="Center Frequency (Hz)",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._freq_text_box, 0, 0, 1, 1)
        self._dc_gain_chooser = forms.radio_buttons(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.dc_gain,
        	callback=self.set_dc_gain,
        	label="DC Gain",
        	choices=[1, 10, 100, 1000, 10000],
        	labels=[],
        	style=wx.RA_HORIZONTAL,
        )
        self.Main.GetPage(0).GridAdd(self._dc_gain_chooser, 1, 0, 1, 1)
        self._calib_2_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.calib_2,
        	callback=self.set_calib_2,
        	label="Calibration value 2",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._calib_2_text_box, 3, 1, 1, 1)
        self._calib_1_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.calib_1,
        	callback=self.set_calib_1,
        	label="Calibration value 1",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._calib_1_text_box, 3, 0, 1, 1)
        self._add_filter_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.add_filter,
        	callback=self.set_add_filter,
        	label="Filter On/Off",
        	choices=[0,1],
        	labels=['Off','On'],
        )
        self.Main.GetPage(0).GridAdd(self._add_filter_chooser, 3, 3, 1, 1)
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	title="Total Power",
        	sample_rate=2,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_STRIPCHART,
        	y_axis_label="power level",
        )
        self.Main.GetPage(1).Add(self.wxgui_scopesink2_2.win)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	unit="",
        	minval=0,
        	maxval=.2,
        	factor=1,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=scope_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Raw Power level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Main.GetPage(1).Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	unit="Kelvin",
        	minval=0,
        	maxval=400,
        	factor=1,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=scope_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Calibrated Temperature",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Main.GetPage(1).Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.Main.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=50,
        	ref_scale=2.0,
        	sample_rate=israte,
        	fft_size=1024,
        	fft_rate=5,
        	average=True,
        	avg_alpha=0.1,
        	title="Spectrum",
        	peak_hold=False,
        	size=(800,400),
        )
        self.Main.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self._variable_static_text_0_0_0_0_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.variable_static_text_0_0_0_0,
        	callback=self.set_variable_static_text_0_0_0_0,
        	label="N200 Clock",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._variable_static_text_0_0_0_0_static_text, 2, 3, 1, 1)
        self._variable_static_text_0_0_0_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.variable_static_text_0_0_0,
        	callback=self.set_variable_static_text_0_0_0,
        	label="Device",
        	converter=forms.str_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._variable_static_text_0_0_0_static_text, 2, 2, 1, 1)
        self._variable_static_text_0_0_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.variable_static_text_0_0,
        	callback=self.set_variable_static_text_0_0,
        	label="SubDev",
        	converter=forms.str_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._variable_static_text_0_0_static_text, 2, 1, 1, 1)
        self._variable_static_text_0_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.variable_static_text_0,
        	callback=self.set_variable_static_text_0,
        	label="Samp rate",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._variable_static_text_0_static_text, 2, 0, 1, 1)
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
        	sample_rate=samp_rate,
        	fft_size=fftsize,
        	ref_scale=2,
        	frame_rate=fftrate,
        	avg_alpha=1.0/float(spavg*fftrate),
        	average=True,
        )
        self._idecln_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.idecln,
        	callback=self.set_idecln,
        	label="Declination",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._idecln_text_box, 1, 2, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="RF Gain (dB)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=maxg,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_gain_sizer, 0, 1, 1, 1)
        _filter_band_sizer = wx.BoxSizer(wx.VERTICAL)
        self._filter_band_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_filter_band_sizer,
        	value=self.filter_band,
        	callback=self.set_filter_band,
        	label="Filter Bandwidth",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._filter_band_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_filter_band_sizer,
        	value=self.filter_band,
        	callback=self.set_filter_band,
        	minimum=100e3,
        	maximum=9e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_filter_band_sizer, 3, 2, 1, 1)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(1, (taps), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((calib_1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((dc_gain, ))
        self.blocks_keep_one_in_n_3 = blocks.keep_one_in_n(gr.sizeof_float*fftsize, fftrate)
        self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*1, int(det_rate/file_rate))
        self.blocks_file_sink_5 = blocks.file_sink(gr.sizeof_float*fftsize, spec_data_fifo, False)
        self.blocks_file_sink_5.set_unbuffered(True)
        self.blocks_file_sink_4 = blocks.file_sink(gr.sizeof_float*1, recfile_tpr, False)
        self.blocks_file_sink_4.set_unbuffered(True)
        self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, prefix+"iq_raw" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat", False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, recfile_kelvin, False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((calib_2, ))
        self.blks2_valve_2 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(rec_button_iq))
        self.blks2_valve_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(0))
        self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec_button_tpr))
        self.blks2_selector_0 = grc_blks2.selector(
        	item_size=gr.sizeof_gr_complex*1,
        	num_inputs=2,
        	num_outputs=1,
        	input_index=add_filter,
        	output_index=0,
        )
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, .5, 0)
        self.TPR_0 = TPR(
            integ=integ,
            samp_rate=samp_rate,
            det_rate=det_rate,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.TPR_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.analog_noise_source_x_0, 0), (self.blks2_selector_0, 0))    
        self.connect((self.analog_noise_source_x_0, 0), (self.fft_filter_xxx_0, 0))    
        self.connect((self.blks2_selector_0, 0), (self.TPR_0, 0))    
        self.connect((self.blks2_selector_0, 0), (self.blks2_valve_2, 0))    
        self.connect((self.blks2_selector_0, 0), (self.logpwrfft_x_0, 0))    
        self.connect((self.blks2_selector_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blks2_valve_0, 0), (self.blocks_file_sink_4, 0))    
        self.connect((self.blks2_valve_1, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blks2_valve_2, 0), (self.blocks_file_sink_1, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blks2_valve_1, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blks2_valve_0, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blocks_keep_one_in_n_3, 0), (self.blocks_file_sink_5, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_keep_one_in_n_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_scopesink2_2, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_1, 0))    
        self.connect((self.fft_filter_xxx_0, 0), (self.blks2_selector_0, 1))    
        self.connect((self.logpwrfft_x_0, 0), (self.blocks_keep_one_in_n_3, 0))    
Exemple #14
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.variable_slider_0 = variable_slider_0 = 0
        self.samp_rate = samp_rate = 32000
        self.len_vec = len_vec = 2**10

        ##################################################
        # Blocks
        ##################################################
        _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_variable_slider_0_sizer,
        	value=self.variable_slider_0,
        	callback=self.set_variable_slider_0,
        	label='variable_slider_0',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._variable_slider_0_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_variable_slider_0_sizer,
        	value=self.variable_slider_0,
        	callback=self.set_variable_slider_0,
        	minimum=0,
        	maximum=50,
        	num_steps=50,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=10000,
        	average=False,
        	avg_alpha=None,
        	label="Differenzphase",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.radar_get_phase_delta_vcf_0 = radar.get_phase_delta_vcf(2**10)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_float*1, 2**10)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_float*1, 2**10)
        self.asdf = blocks.delay(gr.sizeof_float*1, variable_slider_0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.radar_get_phase_delta_vcf_0, 0))
        self.connect((self.blocks_stream_to_vector_0_0, 0), (self.radar_get_phase_delta_vcf_0, 1))
        self.connect((self.radar_get_phase_delta_vcf_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.asdf, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.wxgui_scopesink2_0, 1))
        self.connect((self.asdf, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.asdf, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_stream_to_vector_0_0, 0))
Exemple #15
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.threshold = threshold = -40
        self.samp_rate = samp_rate = 2000000
        self.freq = freq = 446093750

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_2 = fftsink2.fft_sink_c(
        	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=30,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_2.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(2, 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(42, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=200,
                taps=None,
                fractional_bw=None,
        )
        self.blocks_threshold_ff_0 = blocks.threshold_ff(threshold-1, threshold, 0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.blocks_float_to_int_0 = blocks.float_to_int(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vii((40, ))
        self.blks2_tcp_sink_0 = grc_blks2.tcp_sink(
        	itemsize=gr.sizeof_int*1,
        	addr="127.0.0.1",
        	port=50000,
        	server=False,
        )
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=200e3,
        	audio_decim=1,
        	audio_pass=5000,
        	audio_stop=5500,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blks2_tcp_sink_0, 0))
        self.connect((self.blocks_float_to_int_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_int_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_2, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
Exemple #16
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Hackrfone Am Rx 8Msps")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8e6
        self.ppm = ppm = 0
        self.freq = freq = 472e3
        self.fi = fi = 200e3
        self.RF_Gain = RF_Gain = 0
        self.FI_Gain = FI_Gain = 10
        self.FI_BWD = FI_BWD = 10e3
        self.BandWidth = BandWidth = 0
        self.BB_Gain = BB_Gain = 20
        self.Audio_Gain = Audio_Gain = 5

        ##################################################
        # Blocks
        ##################################################
        _ppm_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ppm_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_ppm_sizer,
        	value=self.ppm,
        	callback=self.set_ppm,
        	label='Freq. Corr. [ppm]',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._ppm_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_ppm_sizer,
        	value=self.ppm,
        	callback=self.set_ppm,
        	minimum=-10,
        	maximum=10,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_ppm_sizer, 1, 1, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "RF")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FI")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "AF")
        self.Add(self.notebook_0)
        _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='Frequency',
        	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=400e3,
        	maximum=1.2e6,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_freq_sizer, 1, 0, 1, 1)
        self._RF_Gain_chooser = forms.button(
        	parent=self.GetWin(),
        	value=self.RF_Gain,
        	callback=self.set_RF_Gain,
        	label='RF Amp',
        	choices=[0, 8],
        	labels=['0 dB', '13 dB'],
        )
        self.GridAdd(self._RF_Gain_chooser, 0, 0, 1, 1)
        _FI_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._FI_Gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_FI_Gain_sizer,
        	value=self.FI_Gain,
        	callback=self.set_FI_Gain,
        	label='Rx FI Gain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._FI_Gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_FI_Gain_sizer,
        	value=self.FI_Gain,
        	callback=self.set_FI_Gain,
        	minimum=0,
        	maximum=47,
        	num_steps=47,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_FI_Gain_sizer, 0, 1, 1, 1)
        _FI_BWD_sizer = wx.BoxSizer(wx.VERTICAL)
        self._FI_BWD_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_FI_BWD_sizer,
        	value=self.FI_BWD,
        	callback=self.set_FI_BWD,
        	label='FI Bandwidth',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._FI_BWD_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_FI_BWD_sizer,
        	value=self.FI_BWD,
        	callback=self.set_FI_BWD,
        	minimum=500,
        	maximum=20e3,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_FI_BWD_sizer, 1, 3, 1, 1)
        self._BandWidth_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.BandWidth,
        	callback=self.set_BandWidth,
        	label='Bandwidth',
        	choices=[0, 1.75e6, 20e6],
        	labels=['Auto', '1.75 MHz', '20 MHz'],
        )
        self.GridAdd(self._BandWidth_chooser, 0, 3, 1, 1)
        _BB_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._BB_Gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_BB_Gain_sizer,
        	value=self.BB_Gain,
        	callback=self.set_BB_Gain,
        	label='Base Band Gain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._BB_Gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_BB_Gain_sizer,
        	value=self.BB_Gain,
        	callback=self.set_BB_Gain,
        	minimum=0,
        	maximum=62,
        	num_steps=31,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_BB_Gain_sizer, 0, 2, 1, 1)
        _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=0,
        	maximum=10,
        	num_steps=50,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_Audio_Gain_sizer, 1, 2, 1, 1)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit='Unidades',
        	minval=0,
        	maxval=2,
        	factor=1.0,
        	decimal_places=2,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=2,
        	average=False,
        	avg_alpha=0.5,
        	label='RMS de Entrada',
        	peak_hold=False,
        	show_gauge=True,
        )
        self.GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 4)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	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=True,
        	avg_alpha=0.5,
        	title='FFT Plot',
        	peak_hold=False,
        	size=(800,400),
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0_0_0 = fftsink2.fft_sink_f(
        	self.notebook_0.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32000,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.2,
        	title='AF',
        	peak_hold=False,
        	size=(800,500),
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_0_0_0.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=fi,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate/80,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.2,
        	title='FI',
        	peak_hold=False,
        	size=(800,500),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=8,
                decimation=25,
                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(freq+fi, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(True, 0)
        self.osmosdr_source_0.set_gain(RF_Gain, 0)
        self.osmosdr_source_0.set_if_gain(FI_Gain, 0)
        self.osmosdr_source_0.set_bb_gain(BB_Gain, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(BandWidth, 0)
          
        self.low_pass_filter_0 = filter.fir_filter_ccf(80, firdes.low_pass(
        	1, samp_rate, FI_BWD/2, samp_rate/2500, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(160, True)
        self.blocks_rms_xx_0 = blocks.rms_cf(0.0001)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((Audio_Gain, ))
        self.audio_sink_0 = audio.sink(32000, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fi, 1, 0)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=samp_rate/80,
        	audio_decim=1,
        	audio_pass=5000,
        	audio_stop=7000,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_am_demod_cf_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        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.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_0_1, 0))    
        self.connect((self.blocks_rms_xx_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.wxgui_fftsink2_0_0_0_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0_0_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.blocks_rms_xx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.dc_blocker_xx_0, 0))    
Exemple #17
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Audio Fft 2")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 48000

		##################################################
		# Blocks
		##################################################
		self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="deg",
			minval=-90,
			maxval=90,
			factor=90/3.14159,
			decimal_places=10,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Angle",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0_0.win)
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="mag",
			minval=-100,
			maxval=0,
			factor=20,
			decimal_places=10,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Magnitude",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
			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="Reflect",
			peak_hold=False,
			win=window.hamming,
		)
		self.Add(self.wxgui_fftsink2_0_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			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="Reference",
			peak_hold=False,
			win=window.hamming,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.gr_nlog10_ff_0 = gr.nlog10_ff(1, 1, 0)
		self.gr_divide_xx_0 = gr.divide_cc(1)
		self.gr_complex_to_mag_0 = gr.complex_to_mag(1)
		self.gr_complex_to_arg_0 = gr.complex_to_arg(1)
		self.band_pass_filter_0_0 = gr.fir_filter_fcc(1, firdes.complex_band_pass(
			1, samp_rate, 4.8e3, 5.2e3, 100, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_0 = gr.fir_filter_fcc(1, firdes.complex_band_pass(
			1, samp_rate, 4.8e3, 5.2e3, 100, firdes.WIN_HAMMING, 6.76))
		self.audio_source_0 = audio.source(samp_rate, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.audio_source_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.audio_source_0, 1), (self.band_pass_filter_0_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.wxgui_fftsink2_0_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_divide_xx_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.gr_divide_xx_0, 1))
		self.connect((self.gr_divide_xx_0, 0), (self.gr_complex_to_arg_0, 0))
		self.connect((self.gr_complex_to_arg_0, 0), (self.wxgui_numbersink2_0_0, 0))
		self.connect((self.gr_complex_to_mag_0, 0), (self.gr_nlog10_ff_0, 0))
		self.connect((self.gr_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.gr_complex_to_mag_0, 0))
Exemple #18
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Fhss Sync")

        ##################################################
        # Variables
        ##################################################
        self.samp_sym = samp_sym = 64
        self.tone_freq = tone_freq = 2000
        self.samp_rate = samp_rate = 800e3
        self.init = init = 1, 1, 1, 1
        self.generator = generator = 1, 1, 0, 0, 1
        self.code_rate = code_rate = int(samp_sym * 10000)

        ##################################################
        # Blocks
        ##################################################
        _tone_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tone_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_tone_freq_sizer,
        	value=self.tone_freq,
        	callback=self.set_tone_freq,
        	label="Tone Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._tone_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_tone_freq_sizer,
        	value=self.tone_freq,
        	callback=self.set_tone_freq,
        	minimum=-1 * samp_rate / 2,
        	maximum=samp_rate / 2,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_tone_freq_sizer)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	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="Received Spread Spectrum ",
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Error Rate",
        	peak_hold=False,
        	show_gauge=False,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	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="Despread Signal",
        	peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 0, 2, 2, 4)
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.1,
        	frequency_offset=1 / samp_rate,
        	epsilon=1 + 0.0000,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blks2_error_rate_0 = grc_blks2.error_rate(
        	type='BER',
        	win_size=1000,
        	bits_per_symbol=2,
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, tone_freq, 2, 0)
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True)
        self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init))
        self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer(code_rate, 
                                      samp_sym, 
                                      samp_rate, 
                                      12000, 
                                      50000, 
                                      0.16, 
                                      (generator), 
                                      (init))
        self.Spread_cpfsk_mod_0 = Spread.cpfsk_mod(samp_sym)
        self.Spread_cpfsk_demod_0 = Spread.cpfsk_demod(samp_sym)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_rx_synthesizer_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.Spread_rx_synthesizer_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.Spread_cpfsk_demod_0, 0))
        self.connect((self.Spread_cpfsk_mod_0, 0), (self.Spread_synthesizer_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.blks2_error_rate_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.Spread_cpfsk_mod_0, 0))
        self.connect((self.Spread_cpfsk_demod_0, 0), (self.blks2_error_rate_0, 1))
        self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.Spread_synthesizer_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.channels_channel_model_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.Spread_rx_synthesizer_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="DVBT Scanner")

        ##################################################
        # Variables
        ##################################################
        self.threshold = threshold = -60
        self.signal_level = signal_level = 0
        self.samp_rate = samp_rate = 2048000
        self.freq = freq = 525200000
        self.fft_size = fft_size = 1024
        self.detected = detected = 0

        ##################################################
        # Blocks
        ##################################################
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	label="Threshold",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._threshold_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	minimum=-100,
        	maximum=0,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_threshold_sizer, 2, 0, 1, 1)
        self.probe_signal_lvl = blocks.probe_signal_f()
        self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Spektrum")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Output")
        self.GridAdd(self.notebook, 0, 0, 1, 1)
        _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="Frequency",
        	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=478000000,
        	maximum=862000000,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_freq_sizer, 1, 0, 1, 1)
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
        	self.notebook.GetPage(1).GetWin(),
        	unit="Signal present",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=0,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Signal Detection",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.notebook.GetPage(1).Add(self.wxgui_numbersink2_1.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.notebook.GetPage(1).GetWin(),
        	unit="dB",
        	minval=-120,
        	maxval=0,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=0.03,
        	label="Level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.notebook.GetPage(1).Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=fft_size,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	title="FFT Plot",
        	peak_hold=False,
        	win=window.flattop,
        )
        self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        def _signal_level_probe():
            while True:
                val = self.probe_signal_lvl.level()
                try:
                    self.set_signal_level(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (5))
        _signal_level_thread = threading.Thread(target=_signal_level_probe)
        _signal_level_thread.daemon = True
        _signal_level_thread.start()
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "hackrf=0" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(14, 0)
        self.rtlsdr_source_0.set_if_gain(24, 0)
        self.rtlsdr_source_0.set_bb_gain(12, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.probe_detected = blocks.probe_signal_f()
        self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.rectangular(fft_size)), True, 1)
        def _detected_probe():
            while True:
                val = self.probe_detected.level()
                try:
                    self.set_detected(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (5))
        _detected_thread = threading.Thread(target=_detected_probe)
        _detected_thread.daemon = True
        _detected_thread.start()
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, fft_size)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(threshold, threshold, threshold)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(1000, 0.001, 4000)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_size)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1048580)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0))    
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_threshold_ff_0, 0))    
        self.connect((self.blocks_moving_average_xx_0, 0), (self.probe_signal_lvl, 0))    
        self.connect((self.blocks_moving_average_xx_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_moving_average_xx_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.probe_detected, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_1, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))    
Exemple #20
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.freq = freq = 500e06

        ##################################################
        # 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=400e06,
            maximum=600e06,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="Units",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=False,
            avg_alpha=None,
            label="real",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_c(
            self.GetWin(),
            unit="Units",
            minval=-100,
            maxval=100,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=False,
            avg_alpha=None,
            label="complex",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_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, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.blackmanharris(1024)),
                                     True, 1)
        self.dc_blocker_xx_0 = filter.dc_blocker_cc(32, True)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, 1024)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 1024)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_float * 1, "/home/nitr/Sagnik/gnuradio_data/cyclo_1.dat",
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_real_1 = blocks.complex_to_real(1)
        self.baz_delay_0_0 = baz.delay(gr.sizeof_gr_complex * 1, 1)
        self.baz_delay_0 = baz.delay(gr.sizeof_gr_complex * 1, -1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.baz_delay_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.baz_delay_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_real_1, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_complex_to_real_1, 0),
                     (self.wxgui_numbersink2_0_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0), (self.baz_delay_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_complex_to_real_1, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.wxgui_numbersink2_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.baz_delay_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.dc_blocker_xx_0, 0))
Exemple #21
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.thresh = thresh = 900*10**-3
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        _thresh_sizer = wx.BoxSizer(wx.VERTICAL)
        self._thresh_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_thresh_sizer,
        	value=self.thresh,
        	callback=self.set_thresh,
        	label='thresh',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._thresh_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_thresh_sizer,
        	value=self.thresh,
        	callback=self.set_thresh,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_thresh_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=200*10**-3,
        	v_offset=0,
        	t_scale=100*10**-3,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.digital_glfsr_source_x_0 = digital.glfsr_source_b(6, True, 0, 1)
        self.blocks_xor_xx_0 = blocks.xor_bb()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(thresh, thresh, 0)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((0.5, ))
        self.blks2_error_rate_0 = grc_blks2.error_rate(
        	type='BER',
        	win_size=1280,
        	bits_per_symbol=1,
        )
        self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_UNIFORM, 0.5, 32)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blks2_error_rate_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_threshold_ff_0, 0))    
        self.connect((self.blocks_float_to_char_0, 0), (self.blocks_xor_xx_0, 1))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_char_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_scopesink2_0, 1))    
        self.connect((self.blocks_throttle_0, 0), (self.blks2_error_rate_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_xor_xx_0, 0))    
        self.connect((self.blocks_xor_xx_0, 0), (self.blks2_error_rate_0, 1))    
        self.connect((self.digital_glfsr_source_x_0, 0), (self.blocks_throttle_0, 0))    
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.variable_slider_1 = variable_slider_1 = 2
		self.variable_slider_0 = variable_slider_0 = 2
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		_variable_slider_1_sizer = wx.BoxSizer(wx.VERTICAL)
		self._variable_slider_1_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_variable_slider_1_sizer,
			value=self.variable_slider_1,
			callback=self.set_variable_slider_1,
			label='variable_slider_1',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._variable_slider_1_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_variable_slider_1_sizer,
			value=self.variable_slider_1,
			callback=self.set_variable_slider_1,
			minimum=0,
			maximum=100,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_variable_slider_1_sizer)
		_variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
		self._variable_slider_0_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_variable_slider_0_sizer,
			value=self.variable_slider_0,
			callback=self.set_variable_slider_0,
			label='variable_slider_0',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._variable_slider_0_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_variable_slider_0_sizer,
			value=self.variable_slider_0,
			callback=self.set_variable_slider_0,
			minimum=0,
			maximum=100,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_variable_slider_0_sizer)
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="Units",
			minval=-100,
			maxval=100,
			factor=1.0,
			decimal_places=10,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=False,
			avg_alpha=None,
			label="Number Plot",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.power_xy_power_0 = gnuradio.power.power()
		self.const_source_x_1 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, variable_slider_1)
		self.const_source_x_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, variable_slider_0)

		##################################################
		# Connections
		##################################################
		self.connect((self.const_source_x_0, 0), (self.power_xy_power_0, 0))
		self.connect((self.const_source_x_1, 0), (self.power_xy_power_0, 1))
		self.connect((self.power_xy_power_0, 0), (self.wxgui_numbersink2_0, 0))
Exemple #23
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="USRP LRIT Receiver")

		##################################################
		# Variables
		##################################################
		self.config_filename = config_filename = "usrp_rx_lrit.cfg"
		self._saved_decim_config = ConfigParser.ConfigParser()
		self._saved_decim_config.read(config_filename)
		try: saved_decim = self._saved_decim_config.getint("main", "decim")
		except: saved_decim = 160
		self.saved_decim = saved_decim
		self.decim = decim = saved_decim
		self.symbol_rate = symbol_rate = 293e3
		self._saved_gain_mu_config = ConfigParser.ConfigParser()
		self._saved_gain_mu_config.read(config_filename)
		try: saved_gain_mu = self._saved_gain_mu_config.getfloat("main", "gain_mu")
		except: saved_gain_mu = 0.005
		self.saved_gain_mu = saved_gain_mu
		self._saved_gain_config = ConfigParser.ConfigParser()
		self._saved_gain_config.read(config_filename)
		try: saved_gain = self._saved_gain_config.getfloat("main", "gain")
		except: saved_gain = 33
		self.saved_gain = saved_gain
		self._saved_freq_config = ConfigParser.ConfigParser()
		self._saved_freq_config.read(config_filename)
		try: saved_freq = self._saved_freq_config.getfloat("main", "freq")
		except: saved_freq = 137e6
		self.saved_freq = saved_freq
		self._saved_costas_alpha_config = ConfigParser.ConfigParser()
		self._saved_costas_alpha_config.read(config_filename)
		try: saved_costas_alpha = self._saved_costas_alpha_config.getfloat("main", "costas_alpha")
		except: saved_costas_alpha = 0.005
		self.saved_costas_alpha = saved_costas_alpha
		self.samp_rate = samp_rate = 64e6/decim
		self.sps = sps = samp_rate/symbol_rate
		self.gain_mu = gain_mu = saved_gain_mu
		self.gain = gain = saved_gain
		self.freq = freq = saved_freq
		self.costas_alpha = costas_alpha = saved_costas_alpha

		##################################################
		# Notebooks
		##################################################
		self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.displays.AddPage(grc_wxgui.Panel(self.displays), "USRP RX")
		self.displays.AddPage(grc_wxgui.Panel(self.displays), "Costas Output")
		self.GridAdd(self.displays, 2, 0, 1, 3)

		##################################################
		# Controls
		##################################################
		self._decim_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.decim,
			callback=self.set_decim,
			label="Decim",
			converter=forms.int_converter(),
		)
		self.GridAdd(self._decim_text_box, 0, 0, 1, 1)
		_gain_mu_sizer = wx.BoxSizer(wx.VERTICAL)
		self._gain_mu_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_gain_mu_sizer,
			value=self.gain_mu,
			callback=self.set_gain_mu,
			label="Gain Mu",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._gain_mu_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_gain_mu_sizer,
			value=self.gain_mu,
			callback=self.set_gain_mu,
			minimum=0,
			maximum=0.5,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_gain_mu_sizer, 1, 1, 1, 1)
		_gain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._gain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_gain_sizer,
			value=self.gain,
			callback=self.set_gain,
			label="Gain",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._gain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_gain_sizer,
			value=self.gain,
			callback=self.set_gain,
			minimum=0,
			maximum=115,
			num_steps=115,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_gain_sizer, 0, 1, 1, 1)
		_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="Frequency",
			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=135e6,
			maximum=139e6,
			num_steps=400,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_freq_sizer, 0, 2, 1, 1)
		_costas_alpha_sizer = wx.BoxSizer(wx.VERTICAL)
		self._costas_alpha_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_costas_alpha_sizer,
			value=self.costas_alpha,
			callback=self.set_costas_alpha,
			label="Costas Alpha",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._costas_alpha_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_costas_alpha_sizer,
			value=self.costas_alpha,
			callback=self.set_costas_alpha,
			minimum=0,
			maximum=0.5,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_costas_alpha_sizer, 1, 0, 1, 1)

		##################################################
		# Blocks
		##################################################
		self.gr_add_const_vxx_0 = gr.add_const_vff((48.0, ))
		self.gr_agc_xx_0 = gr.agc_cc(1e-6, 1.0, 1.0/32767.0, 1.0)
		self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb()
		self.gr_char_to_float_0 = gr.char_to_float()
		self.gr_complex_to_real_0 = gr.complex_to_real(1)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "bits.dat")
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "lrit.dat", False)
		self.gr_float_to_char_0 = gr.float_to_char()
		self.gr_mpsk_receiver_cc_0 = gr.mpsk_receiver_cc(2, 0, costas_alpha, costas_alpha*costas_alpha/4.0, -0.05, 0.05, 0.5, gain_mu, sps, gain_mu*gain_mu/4.0, 0.05)
		self.gr_probe_mpsk_snr_c_0 = grc_blks2.probe_mpsk_snr_c(
			type='snr',
			alpha=0.0001,
			probe_rate=10,
		)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.displays.GetPage(0).GetWin(),
			baseband_freq=freq,
			y_per_div=10,
			y_divs=10,
			ref_level=50,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=30,
			average=False,
			avg_alpha=None,
			title="Spectrum",
			peak_hold=False,
		)
		self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1)
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.displays.GetPage(1).GetWin(),
			unit="dB",
			minval=0,
			maxval=30,
			factor=1.0,
			decimal_places=1,
			ref_level=0,
			sample_rate=10,
			number_rate=10,
			average=False,
			avg_alpha=None,
			label="SNR",
			peak_hold=False,
			show_gauge=True,
		)
		self.displays.GetPage(1).GridAdd(self.wxgui_numbersink2_0.win, 2, 0, 1, 1)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
			self.displays.GetPage(0).GetWin(),
			title="Waveform",
			sample_rate=samp_rate,
			v_scale=0.5,
			t_scale=20.0/samp_rate,
			ac_couple=False,
			xy_mode=True,
			num_inputs=1,
		)
		self.displays.GetPage(0).GridAdd(self.wxgui_scopesink2_0.win, 1, 0, 1, 1)
		self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
			self.displays.GetPage(1).GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0.4,
			t_scale=20.0/samp_rate,
			ac_couple=False,
			xy_mode=True,
			num_inputs=1,
		)
		self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_1.win, 0, 0, 1, 1)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_agc_xx_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_agc_xx_0, 0))
		self.connect((self.gr_probe_mpsk_snr_c_0, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_probe_mpsk_snr_c_0, 0))
		self.connect((self.gr_agc_xx_0, 0), (self.gr_mpsk_receiver_cc_0, 0))
		self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.wxgui_scopesink2_1, 0))
		self.connect((self.gr_agc_xx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_mpsk_receiver_cc_0, 0), (self.gr_complex_to_real_0, 0))
		self.connect((self.gr_complex_to_real_0, 0), (self.gr_binary_slicer_fb_0, 0))
		self.connect((self.gr_binary_slicer_fb_0, 0), (self.gr_char_to_float_0, 0))
		self.connect((self.gr_char_to_float_0, 0), (self.gr_add_const_vxx_0, 0))
		self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_char_0, 0))
		self.connect((self.gr_float_to_char_0, 0), (self.gr_file_sink_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.freq_0 = freq_0 = 525.2e6
        self.threshold = threshold = -60
        self.samp_rate = samp_rate = 2.048e6
        self.freq = freq = freq_0

        ##################################################
        # Blocks
        ##################################################
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	label="threshold",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._threshold_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	minimum=-100,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_threshold_sizer)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="signal present",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=2.048e6,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Signal detection",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-120,
        	maxval=0,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=2048000,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=2048000,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=0.030,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(2.048e6)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(75, 0)
        self.rtlsdr_source_0.set_if_gain(75, 0)
        self.rtlsdr_source_0.set_bb_gain(5, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab1")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab2")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab3")
        self.Add(self.notebook_0)
        _freq_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_0_sizer,
        	value=self.freq_0,
        	callback=self.set_freq_0,
        	label='freq_0',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_0_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_0_sizer,
        	value=self.freq_0,
        	callback=self.set_freq_0,
        	minimum=478e6,
        	maximum=862e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_0_sizer)
        self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.rectangular(1024)), True, 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, 1024)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 2048000,True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, -60)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_int*1, "/media/ubuntu/01D165566F075780/Q3/wireless networking/GNU/out1.txt", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1024)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1.04858e6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))    
	def __init__(self, side="A", gain=35, decim=32, sync_check=False, satellite='METEOR-M-1', frames_file=os.environ['HOME'] + '/METEOR-M-1.hrpt', freq=1700e6):
		grc_wxgui.top_block_gui.__init__(self, title="USRP NOAA HRPT Receiver")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.side = side
		self.gain = gain
		self.decim = decim
		self.sync_check = sync_check
		self.satellite = satellite
		self.frames_file = frames_file
		self.freq = freq

		##################################################
		# Variables
		##################################################
		self.sym_rate = sym_rate = 600*1109
		self.samp_rate = samp_rate = 64e6/decim
		self.config_filename = config_filename = os.environ['HOME']+'/.gnuradio/mn1_hrpt.conf'
		self.sps = sps = samp_rate/sym_rate
		self._saved_pll_alpha_config = ConfigParser.ConfigParser()
		self._saved_pll_alpha_config.read(config_filename)
		try: saved_pll_alpha = self._saved_pll_alpha_config.getfloat("satname", 'pll_alpha')
		except: saved_pll_alpha = 0.005
		self.saved_pll_alpha = saved_pll_alpha
		self._saved_clock_alpha_config = ConfigParser.ConfigParser()
		self._saved_clock_alpha_config.read(config_filename)
		try: saved_clock_alpha = self._saved_clock_alpha_config.getfloat("satname", 'clock_alpha')
		except: saved_clock_alpha = 0.001
		self.saved_clock_alpha = saved_clock_alpha
		self.sync_check_txt = sync_check_txt = sync_check
		self.side_text = side_text = side
		self._saved_gain_config = ConfigParser.ConfigParser()
		self._saved_gain_config.read(config_filename)
		try: saved_gain = self._saved_gain_config.getfloat("satname", 'gain')
		except: saved_gain = gain
		self.saved_gain = saved_gain
		self.satellite_text = satellite_text = satellite
		self.sample_rate_text = sample_rate_text = samp_rate
		self.pll_alpha = pll_alpha = saved_pll_alpha
		self.max_clock_offset = max_clock_offset = 0.1
		self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/samp_rate
		self.hs = hs = int(sps/2.0)
		self.gain_slider = gain_slider = gain
		self.freq_tb = freq_tb = freq
		self.frames_outfile_text = frames_outfile_text = frames_file
		self.decim_tb = decim_tb = decim
		self.datetime_text = datetime_text = strftime("%A, %B %d %Y %H:%M:%S", localtime())
		self.clock_alpha = clock_alpha = saved_clock_alpha

		##################################################
		# Notebooks
		##################################################
		self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX Meteor M N1 HRPT")
		self.displays.AddPage(grc_wxgui.Panel(self.displays), "Information")
		self.Add(self.displays)

		##################################################
		# Controls
		##################################################
		self._sync_check_txt_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.sync_check_txt,
			callback=self.set_sync_check_txt,
			label="Sync check",
			converter=forms.float_converter(),
		)
		self.GridAdd(self._sync_check_txt_static_text, 0, 2, 1, 1)
		self._side_text_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.side_text,
			callback=self.set_side_text,
			label="USRP Side",
			converter=forms.str_converter(),
		)
		self.GridAdd(self._side_text_static_text, 0, 0, 1, 1)
		self._satellite_text_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.satellite_text,
			callback=self.set_satellite_text,
			label="Satellite",
			converter=forms.str_converter(),
		)
		self.GridAdd(self._satellite_text_static_text, 0, 1, 1, 1)
		self._sample_rate_text_static_text = forms.static_text(
			parent=self.displays.GetPage(1).GetWin(),
			value=self.sample_rate_text,
			callback=self.set_sample_rate_text,
			label="Sample rate",
			converter=forms.float_converter(),
		)
		self.displays.GetPage(1).GridAdd(self._sample_rate_text_static_text, 3, 0, 1, 1)
		_pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL)
		self._pll_alpha_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_pll_alpha_sizer,
			value=self.pll_alpha,
			callback=self.set_pll_alpha,
			label="PLL Alpha",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._pll_alpha_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_pll_alpha_sizer,
			value=self.pll_alpha,
			callback=self.set_pll_alpha,
			minimum=0.005,
			maximum=0.5,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_pll_alpha_sizer, 2, 1, 1, 1)
		_gain_slider_sizer = wx.BoxSizer(wx.VERTICAL)
		self._gain_slider_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_gain_slider_sizer,
			value=self.gain_slider,
			callback=self.set_gain_slider,
			label="Gain",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._gain_slider_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_gain_slider_sizer,
			value=self.gain_slider,
			callback=self.set_gain_slider,
			minimum=0,
			maximum=100,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.GridAdd(_gain_slider_sizer, 2, 0, 1, 1)
		self._freq_tb_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.freq_tb,
			callback=self.set_freq_tb,
			label="Frequency",
			converter=forms.float_converter(),
		)
		self.GridAdd(self._freq_tb_text_box, 1, 1, 1, 1)
		self._frames_outfile_text_static_text = forms.static_text(
			parent=self.displays.GetPage(1).GetWin(),
			value=self.frames_outfile_text,
			callback=self.set_frames_outfile_text,
			label="Frames filename",
			converter=forms.str_converter(),
		)
		self.displays.GetPage(1).GridAdd(self._frames_outfile_text_static_text, 4, 0, 1, 1)
		self._decim_tb_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.decim_tb,
			callback=self.set_decim_tb,
			label="Decimation",
			converter=forms.int_converter(),
		)
		self.GridAdd(self._decim_tb_text_box, 1, 0, 1, 1)
		self._datetime_text_static_text = forms.static_text(
			parent=self.displays.GetPage(1).GetWin(),
			value=self.datetime_text,
			callback=self.set_datetime_text,
			label="Acquisition start",
			converter=forms.str_converter(),
		)
		self.displays.GetPage(1).GridAdd(self._datetime_text_static_text, 2, 0, 1, 1)
		_clock_alpha_sizer = wx.BoxSizer(wx.VERTICAL)
		self._clock_alpha_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_clock_alpha_sizer,
			value=self.clock_alpha,
			callback=self.set_clock_alpha,
			label="Clock alpha",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._clock_alpha_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_clock_alpha_sizer,
			value=self.clock_alpha,
			callback=self.set_clock_alpha,
			minimum=0.001,
			maximum=0.1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_clock_alpha_sizer, 2, 2, 1, 1)

		##################################################
		# Blocks
		##################################################
		self.agc = gr.agc_cc(1e-5, 1.0, 1.0/32768.0, 1.0)
		self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb()
		self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_ff(sps/2.0, clock_alpha**2/4.0, 0.5, clock_alpha, max_clock_offset)
		self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_short*1, frames_file)
		self.gr_file_sink_0_0.set_unbuffered(False)
		self.gr_interleaved_short_to_complex_0 = gr.interleaved_short_to_complex()
		self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0/hs, 4000)
		self.gr_rms_xx_0 = gr.rms_cf(0.2)
		self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset)
		self.poesweather_mn1_hrpt_deframer_0 = poesweather.mn1_hrpt_deframer(sync_check)
		self.usrp_simple_source_x_0 = grc_usrp.simple_source_s(which=0, side=side, rx_ant="RXA")
		self.usrp_simple_source_x_0.set_decim_rate(decim)
		self.usrp_simple_source_x_0.set_frequency(freq, verbose=True)
		self.usrp_simple_source_x_0.set_gain(gain)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.displays.GetPage(0).GetWin(),
			baseband_freq=0,
			y_per_div=5,
			y_divs=10,
			ref_level=45,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=30,
			average=True,
			avg_alpha=0.1,
			title="Meteor M N1 HRPT FFT Spectrum",
			peak_hold=False,
		)
		self.displays.GetPage(0).Add(self.wxgui_fftsink2_0.win)
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="Units",
			minval=0,
			maxval=5000,
			factor=1.0,
			decimal_places=4,
			ref_level=0,
			sample_rate=samp_rate,
			number_rate=15,
			average=True,
			avg_alpha=0.07,
			label="S-Meter",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_binary_slicer_fb_0, 0), (self.poesweather_mn1_hrpt_deframer_0, 0))
		self.connect((self.usrp_simple_source_x_0, 0), (self.gr_interleaved_short_to_complex_0, 0))
		self.connect((self.gr_interleaved_short_to_complex_0, 0), (self.agc, 0))
		self.connect((self.gr_clock_recovery_mm_xx_0, 0), (self.gr_binary_slicer_fb_0, 0))
		self.connect((self.agc, 0), (self.pll, 0))
		self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0))
		self.connect((self.gr_moving_average_xx_0, 0), (self.gr_clock_recovery_mm_xx_0, 0))
		self.connect((self.gr_interleaved_short_to_complex_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_interleaved_short_to_complex_0, 0), (self.gr_rms_xx_0, 0))
		self.connect((self.gr_rms_xx_0, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.poesweather_mn1_hrpt_deframer_0, 0), (self.gr_file_sink_0_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Wifi Loopback Ah")

        ##################################################
        # Variables
        ##################################################
        self.snr = snr = 20
        self.pdu_length = pdu_length = 500
        self.out_buf_size = out_buf_size = 96000
        self.interval = interval = 100
        self.encoding = encoding = 0
        self.chan_est = chan_est = 1

        ##################################################
        # Blocks
        ##################################################
        _snr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._snr_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_snr_sizer,
        	value=self.snr,
        	callback=self.set_snr,
        	label='snr',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._snr_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_snr_sizer,
        	value=self.snr,
        	callback=self.set_snr,
        	minimum=-15,
        	maximum=30,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_snr_sizer)
        _pdu_length_sizer = wx.BoxSizer(wx.VERTICAL)
        self._pdu_length_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_pdu_length_sizer,
        	value=self.pdu_length,
        	callback=self.set_pdu_length,
        	label='pdu_length',
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._pdu_length_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_pdu_length_sizer,
        	value=self.pdu_length,
        	callback=self.set_pdu_length,
        	minimum=0,
        	maximum=1500,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_pdu_length_sizer)
        _interval_sizer = wx.BoxSizer(wx.VERTICAL)
        self._interval_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_interval_sizer,
        	value=self.interval,
        	callback=self.set_interval,
        	label="PDU Interval (ms)",
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._interval_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_interval_sizer,
        	value=self.interval,
        	callback=self.set_interval,
        	minimum=10,
        	maximum=1000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Add(_interval_sizer)
        self._encoding_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.encoding,
        	callback=self.set_encoding,
        	label="Encoding",
        	choices=[0,1,2,3,4,5,6,7,8],
        	labels=["BPSK 1/2", "QPSK 1/2", "QPSK 3/4",  "16QAM 1/2", "16QAM 3/4", "64QAM 2/3", "64QAM 3/4", "64QAM 5/6", "256QAM 3/4"  ],
        	style=wx.RA_HORIZONTAL,
        )
        self.Add(self._encoding_chooser)
        self._chan_est_chooser = forms.radio_buttons(
        	parent=self.GetWin(),
        	value=self.chan_est,
        	callback=self.set_chan_est,
        	label='chan_est',
        	choices=[0, 1],
        	labels=["LMS", "Linear Comb"],
        	style=wx.RA_HORIZONTAL,
        )
        self.Add(self._chan_est_chooser)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=12500,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="%",
        	minval=0,
        	maxval=100,
        	factor=1.0,
        	decimal_places=2,
        	ref_level=0,
        	sample_rate=1,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.02,
        	label="Frame Error Rate",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.wifi_phy_hier_ah_0 = wifi_phy_hier_ah(
            chan_est=chan_est,
            encoding=encoding,
            sensitivity=0.56,
        )
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(False, True)
        self.ieee802_11_ofdm_mac_0 = ieee802_11.ofdm_mac(([0x23, 0x23, 0x23, 0x23, 0x23, 0x23]), ([0x42, 0x42, 0x42, 0x42, 0x42, 0x42]), ([0xff, 0xff, 0xff, 0xff, 0xff, 0xff]))
        self.foo_packet_pad2_0 = foo.packet_pad2(False, False, 0.001, 500, 0)
        (self.foo_packet_pad2_0).set_min_output_buffer(96000)
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=1,
        	frequency_offset=0,
        	epsilon=1.0,
        	taps=(1.0, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.float_t, "packet_len")
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(((10**(snr/10.0))**.5, ))
        self.blocks_message_strobe_0 = blocks.message_strobe(pmt.intern("".join("x" for i in range(pdu_length))), interval)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_message_strobe_0, 'strobe'), (self.ieee802_11_ofdm_mac_0, 'app in'))    
        self.msg_connect((self.ieee802_11_ofdm_mac_0, 'phy out'), (self.wifi_phy_hier_ah_0, 'mac_in'))    
        self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))    
        self.msg_connect((self.wifi_phy_hier_ah_0, 'mac_out'), (self.ieee802_11_ofdm_parse_mac_0, 'in'))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0))    
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.wifi_phy_hier_ah_0, 0))    
        self.connect((self.foo_packet_pad2_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.wifi_phy_hier_ah_0, 0), (self.foo_packet_pad2_0, 0))    
        self.connect((self.wifi_phy_hier_ah_0, 1), (self.wxgui_scopesink2_0, 0))    
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Decoder 433Mhz")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.variable_function_probe_0 = variable_function_probe_0 = 0
        self.target_rate_IM = target_rate_IM = 50000
        self.target_rate = target_rate = 1200
        self.samp_rate = samp_rate = 2000000
        self.xlate_offset = xlate_offset = -47000
        self.variable_text_box_0 = variable_text_box_0 = variable_function_probe_0
        self.variable_static_text_0 = variable_static_text_0 = target_rate
        self.samp_per_sym = samp_per_sym = 5
        self.gain = gain = 1
        self.firdes_tap = firdes_tap = firdes.low_pass(1, samp_rate, 2000, target_rate_IM/4, firdes.WIN_HAMMING, 6.76)

        ##################################################
        # Blocks
        ##################################################
        _target_rate_sizer = wx.BoxSizer(wx.VERTICAL)
        self._target_rate_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_target_rate_sizer,
        	value=self.target_rate,
        	callback=self.set_target_rate,
        	label='target_rate',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._target_rate_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_target_rate_sizer,
        	value=self.target_rate,
        	callback=self.set_target_rate,
        	minimum=1000,
        	maximum=2000,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_target_rate_sizer)
        _xlate_offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._xlate_offset_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_xlate_offset_sizer,
        	value=self.xlate_offset,
        	callback=self.set_xlate_offset,
        	label="xlate_offset",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._xlate_offset_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_xlate_offset_sizer,
        	value=self.xlate_offset,
        	callback=self.set_xlate_offset,
        	minimum=-samp_rate/10,
        	maximum=samp_rate/10,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_xlate_offset_sizer, 2, 2, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0.01,
        	maximum=10,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_gain_sizer, 3, 2, 1, 1)
        self.ask_demod_my_ask_clock_detector_0 = ask_demod.my_ask_clock_detector(0.01, target_rate, samp_per_sym)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=0,
        	maxval=10,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=target_rate*samp_per_sym,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Max level",
        	peak_hold=True,
        	show_gauge=True,
        )
        self.GridAdd(self.wxgui_numbersink2_0.win, 4, 2, 1, 1)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=target_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=True,
        )
        self.GridAdd(self.wxgui_fftsink2_1.win, 1, 2, 1, 1)
        self._variable_text_box_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.variable_text_box_0,
        	callback=self.set_variable_text_box_0,
        	label="te",
        	converter=forms.int_converter(),
        )
        self.Add(self._variable_text_box_0_text_box)
        self._variable_static_text_0_static_text = forms.static_text(
        	parent=self.GetWin(),
        	value=self.variable_static_text_0,
        	callback=self.set_variable_static_text_0,
        	label="Sample rate out (target_rate * samp_pre_sym)",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._variable_static_text_0_static_text, 6, 2, 1, 1)
        def _variable_function_probe_0_probe():
            while True:
                val = self.ask_demod_my_ask_clock_detector_0.samp_adjust()
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1))
        _variable_function_probe_0_thread = threading.Thread(target=_variable_function_probe_0_probe)
        _variable_function_probe_0_thread.daemon = True
        _variable_function_probe_0_thread.start()
        self.freq_xlating_fir_filter_xxx_1 = filter.freq_xlating_fir_filter_ccc(int(samp_rate/target_rate_IM), (firdes_tap), xlate_offset, samp_rate)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(0, (target_rate_IM)/(target_rate*samp_per_sym))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((gain, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/ubuntu/433/2M_sample_record", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, "/tmp/gnu_radio_out", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.ask_demod_my_ask_clock_detector_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_1, 0))    
        self.connect((self.fractional_resampler_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.fractional_resampler_xx_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_1, 0), (self.wxgui_fftsink2_1, 0))    
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Power")

        ##################################################
        # Variables
        ##################################################
        self.vect_len = vect_len = 1024
        self.samp_rate = samp_rate = 100e3
        self.mean_length = mean_length = 5e3
        self.freq = freq = 5.8e09
        self.MuteTx = MuteTx = False

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="RXScope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_1.win)
	###
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="mW",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=2,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=1,
        	average=True,
        	avg_alpha=1,
        	label="RX mag",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_1.win)
	###
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_subdev_spec("A:B", 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(56, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
	###
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("A:A", 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(56, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
	###
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1e3, ))
	###        
	self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1)
	###        
	self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, mean_length, 1, 0)
	###        
	self._MuteTx_check_box = forms.check_box(
        	parent=self.GetWin(),
        	value=self.MuteTx,
        	callback=self.set_MuteTx,
        	label='MuteTx',
        	true=True,
        	false=False,
        )
        self.Add(self._MuteTx_check_box)        
	self.Mute = blocks.mute_cc(bool(MuteTx))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Mute, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.Mute, 0))    
        self.connect((self.blocks_complex_to_mag_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.wxgui_numbersink2_1, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_1, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_scopesink2_1, 0))    
    def __init__(self,
                 satellite='NOAA-XX',
                 frames_file=os.environ['HOME'] + '/NOAA-XX.hrpt',
                 side="A",
                 gain=35,
                 freq=1698e6,
                 decim=32,
                 sync_check=False):
        grc_wxgui.top_block_gui.__init__(self, title="USRP NOAA HRPT Receiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Parameters
        ##################################################
        self.satellite = satellite
        self.frames_file = frames_file
        self.side = side
        self.gain = gain
        self.freq = freq
        self.decim = decim
        self.sync_check = sync_check

        ##################################################
        # Variables
        ##################################################
        self.sym_rate = sym_rate = 600 * 1109
        self.samp_rate = samp_rate = 64e6 / decim
        self.config_filename = config_filename = os.environ[
            'HOME'] + '/.gnuradio/noaa_hrpt.conf'
        self.sps = sps = samp_rate / sym_rate
        self._saved_pll_alpha_config = ConfigParser.ConfigParser()
        self._saved_pll_alpha_config.read(config_filename)
        try:
            saved_pll_alpha = self._saved_pll_alpha_config.getfloat(
                "satname", 'pll_alpha')
        except:
            saved_pll_alpha = 0.005
        self.saved_pll_alpha = saved_pll_alpha
        self._saved_clock_alpha_config = ConfigParser.ConfigParser()
        self._saved_clock_alpha_config.read(config_filename)
        try:
            saved_clock_alpha = self._saved_clock_alpha_config.getfloat(
                "satname", 'clock_alpha')
        except:
            saved_clock_alpha = 0.001
        self.saved_clock_alpha = saved_clock_alpha
        self.sync_check_txt = sync_check_txt = sync_check
        self.side_text = side_text = side
        self._saved_gain_config = ConfigParser.ConfigParser()
        self._saved_gain_config.read(config_filename)
        try:
            saved_gain = self._saved_gain_config.getfloat("satname", 'gain')
        except:
            saved_gain = gain
        self.saved_gain = saved_gain
        self.satellite_text = satellite_text = satellite
        self.sample_rate_text = sample_rate_text = samp_rate
        self.pll_alpha = pll_alpha = saved_pll_alpha
        self.max_clock_offset = max_clock_offset = 0.1
        self.max_carrier_offset = max_carrier_offset = 2 * math.pi * 100e3 / samp_rate
        self.hs = hs = int(sps / 2.0)
        self.gain_slider = gain_slider = gain
        self.freq_tb = freq_tb = freq
        self.frames_outfile_text = frames_outfile_text = frames_file
        self.decim_tb = decim_tb = decim
        self.datetime_text = datetime_text = strftime("%A, %B %d %Y %H:%M:%S",
                                                      localtime())
        self.clock_alpha = clock_alpha = saved_clock_alpha

        ##################################################
        # Notebooks
        ##################################################
        self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX NOAA HRPT")
        self.displays.AddPage(grc_wxgui.Panel(self.displays), "Information")
        self.Add(self.displays)

        ##################################################
        # Controls
        ##################################################
        self._sync_check_txt_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.sync_check_txt,
            callback=self.set_sync_check_txt,
            label="Sync check",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._sync_check_txt_static_text, 0, 2, 1, 1)
        self._side_text_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.side_text,
            callback=self.set_side_text,
            label="USRP Side",
            converter=forms.str_converter(),
        )
        self.GridAdd(self._side_text_static_text, 0, 0, 1, 1)
        self._satellite_text_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.satellite_text,
            callback=self.set_satellite_text,
            label="Satellite",
            converter=forms.str_converter(),
        )
        self.GridAdd(self._satellite_text_static_text, 0, 1, 1, 1)
        self._sample_rate_text_static_text = forms.static_text(
            parent=self.displays.GetPage(1).GetWin(),
            value=self.sample_rate_text,
            callback=self.set_sample_rate_text,
            label="Sample rate",
            converter=forms.float_converter(),
        )
        self.displays.GetPage(1).GridAdd(self._sample_rate_text_static_text, 3,
                                         0, 1, 1)
        _pll_alpha_sizer = wx.BoxSizer(wx.VERTICAL)
        self._pll_alpha_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_pll_alpha_sizer,
            value=self.pll_alpha,
            callback=self.set_pll_alpha,
            label="PLL Alpha",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._pll_alpha_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_pll_alpha_sizer,
            value=self.pll_alpha,
            callback=self.set_pll_alpha,
            minimum=0.005,
            maximum=0.5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_pll_alpha_sizer, 2, 1, 1, 1)
        _gain_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_slider_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_slider_sizer,
            value=self.gain_slider,
            callback=self.set_gain_slider,
            label="Gain",
            converter=forms.int_converter(),
            proportion=0,
        )
        self._gain_slider_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_slider_sizer,
            value=self.gain_slider,
            callback=self.set_gain_slider,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.GridAdd(_gain_slider_sizer, 2, 0, 1, 1)
        self._freq_tb_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.freq_tb,
            callback=self.set_freq_tb,
            label="Frequency",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_tb_text_box, 1, 1, 1, 1)
        self._frames_outfile_text_static_text = forms.static_text(
            parent=self.displays.GetPage(1).GetWin(),
            value=self.frames_outfile_text,
            callback=self.set_frames_outfile_text,
            label="Frames filename",
            converter=forms.str_converter(),
        )
        self.displays.GetPage(1).GridAdd(self._frames_outfile_text_static_text,
                                         4, 0, 1, 1)
        self._decim_tb_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.decim_tb,
            callback=self.set_decim_tb,
            label="Decimation",
            converter=forms.int_converter(),
        )
        self.GridAdd(self._decim_tb_text_box, 1, 0, 1, 1)
        self._datetime_text_static_text = forms.static_text(
            parent=self.displays.GetPage(1).GetWin(),
            value=self.datetime_text,
            callback=self.set_datetime_text,
            label="Acquisition start",
            converter=forms.str_converter(),
        )
        self.displays.GetPage(1).GridAdd(self._datetime_text_static_text, 2, 0,
                                         1, 1)
        _clock_alpha_sizer = wx.BoxSizer(wx.VERTICAL)
        self._clock_alpha_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_clock_alpha_sizer,
            value=self.clock_alpha,
            callback=self.set_clock_alpha,
            label="Clock alpha",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._clock_alpha_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_clock_alpha_sizer,
            value=self.clock_alpha,
            callback=self.set_clock_alpha,
            minimum=0.001,
            maximum=0.1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_clock_alpha_sizer, 2, 2, 1, 1)

        ##################################################
        # Blocks
        ##################################################
        self.agc = gr.agc_cc(1e-5, 1.0, 1.0 / 32768.0, 1.0)
        self.gr_binary_slicer_fb_0 = gr.binary_slicer_fb()
        self.gr_clock_recovery_mm_xx_0 = gr.clock_recovery_mm_ff(
            sps / 2.0, clock_alpha**2 / 4.0, 0.5, clock_alpha,
            max_clock_offset)
        self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_short * 1, frames_file)
        self.gr_file_sink_0_0.set_unbuffered(False)
        self.gr_interleaved_short_to_complex_0 = gr.interleaved_short_to_complex(
        )
        self.gr_moving_average_xx_0 = gr.moving_average_ff(hs, 1.0 / hs, 4000)
        self.gr_rms_xx_0 = gr.rms_cf(0.2)
        self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2 / 4.0,
                                    max_carrier_offset)
        self.poesweather_noaa_hrpt_deframer_0 = poesweather.noaa_hrpt_deframer(
            sync_check)
        self.usrp_simple_source_x_0 = grc_usrp.simple_source_s(which=0,
                                                               side=side,
                                                               rx_ant="RXA")
        self.usrp_simple_source_x_0.set_decim_rate(decim)
        self.usrp_simple_source_x_0.set_frequency(freq, verbose=True)
        self.usrp_simple_source_x_0.set_gain(gain)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.displays.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=5,
            y_divs=10,
            ref_level=45,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=30,
            average=True,
            avg_alpha=0.1,
            title="NOAA HRPT FFT Spectrum",
            peak_hold=False,
        )
        self.displays.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="Units",
            minval=0,
            maxval=5000,
            factor=1.0,
            decimal_places=4,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=True,
            avg_alpha=0.07,
            label="S-Meter",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_rms_xx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.gr_binary_slicer_fb_0, 0),
                     (self.poesweather_noaa_hrpt_deframer_0, 0))
        self.connect((self.poesweather_noaa_hrpt_deframer_0, 0),
                     (self.gr_file_sink_0_0, 0))
        self.connect((self.gr_interleaved_short_to_complex_0, 0),
                     (self.gr_rms_xx_0, 0))
        self.connect((self.gr_interleaved_short_to_complex_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_moving_average_xx_0, 0),
                     (self.gr_clock_recovery_mm_xx_0, 0))
        self.connect((self.pll, 0), (self.gr_moving_average_xx_0, 0))
        self.connect((self.agc, 0), (self.pll, 0))
        self.connect((self.gr_clock_recovery_mm_xx_0, 0),
                     (self.gr_binary_slicer_fb_0, 0))
        self.connect((self.gr_interleaved_short_to_complex_0, 0),
                     (self.agc, 0))
        self.connect((self.usrp_simple_source_x_0, 0),
                     (self.gr_interleaved_short_to_complex_0, 0))
Exemple #30
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.configured_frequency = configured_frequency = 500

        ##################################################
        # Blocks
        ##################################################
        _configured_frequency_sizer = wx.BoxSizer(wx.VERTICAL)
        self._configured_frequency_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_configured_frequency_sizer,
        	value=self.configured_frequency,
        	callback=self.set_configured_frequency,
        	label='configured_frequency',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._configured_frequency_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_configured_frequency_sizer,
        	value=self.configured_frequency,
        	callback=self.set_configured_frequency,
        	minimum=2,
        	maximum=2000,
        	num_steps=999,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_configured_frequency_sizer)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=500,
        	v_offset=0,
        	t_scale=2.5e-3,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.test1_freq_counter2_0 = test1.freq_counter2(samp_rate, 0.1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, configured_frequency, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.test1_freq_counter2_0, 0))
        self.connect((self.test1_freq_counter2_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.test1_freq_counter2_0, 0), (self.wxgui_scopesink2_0_0, 0))
Exemple #31
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.sym_rate = sym_rate = 32e3 
        self.samp_rate = samp_rate = 32000
        self.qe = qe = 0
        self.pj = pj = -40
        self.noise = noise = 0.01
        self.cs = cs = 0
        self.ai = ai = 0

        ##################################################
        # Blocks
        ##################################################
        _qe_sizer = wx.BoxSizer(wx.VERTICAL)
        self._qe_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_qe_sizer,
        	value=self.qe,
        	callback=self.set_qe,
        	label='qe',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._qe_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_qe_sizer,
        	value=self.qe,
        	callback=self.set_qe,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_qe_sizer, 1, 3, 1, 1)
        _pj_sizer = wx.BoxSizer(wx.VERTICAL)
        self._pj_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_pj_sizer,
        	value=self.pj,
        	callback=self.set_pj,
        	label='pj',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._pj_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_pj_sizer,
        	value=self.pj,
        	callback=self.set_pj,
        	minimum=-40,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_pj_sizer, 1, 0, 1, 1)
        _noise_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_noise_sizer,
        	value=self.noise,
        	callback=self.set_noise,
        	label='noise',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._noise_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_noise_sizer,
        	value=self.noise,
        	callback=self.set_noise,
        	minimum=0,
        	maximum=0.1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_noise_sizer, 1, 4, 1, 1)
        self.n_0 = self.n_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n_0.AddPage(grc_wxgui.Panel(self.n_0), "Constellation")
        self.n_0.AddPage(grc_wxgui.Panel(self.n_0), "Meassures")
        self.Add(self.n_0)
        _cs_sizer = wx.BoxSizer(wx.VERTICAL)
        self._cs_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_cs_sizer,
        	value=self.cs,
        	callback=self.set_cs,
        	label='cs',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._cs_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_cs_sizer,
        	value=self.cs,
        	callback=self.set_cs,
        	minimum=0,
        	maximum=0.5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_cs_sizer, 1, 1, 1, 1)
        _ai_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ai_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_ai_sizer,
        	value=self.ai,
        	callback=self.set_ai,
        	label='ai',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._ai_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_ai_sizer,
        	value=self.ai,
        	callback=self.set_ai,
        	minimum=0,
        	maximum=5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_ai_sizer, 1, 2, 1, 1)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
        	self.n_0.GetPage(0).GetWin(),
        	title="Constellation",
        	sample_rate=sym_rate,
        	v_scale=0.5,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=True,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.n_0.GetPage(0).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0, 1, 1)
        self.wxgui_numbersink2_1_1_1 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Amplitude Imbalance horizontal",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1_1.win, 1, 1, 1, 1)
        self.wxgui_numbersink2_1_1_0_1_0_0 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="",
        	minval=0,
        	maxval=100,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="SNR",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1_0_1_0_0.win, 3, 1, 1, 1)
        self.wxgui_numbersink2_1_1_0_1_0 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="",
        	minval=0,
        	maxval=0.1,
        	factor=1.0,
        	decimal_places=5,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Phase Jitter Variance",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1_0_1_0.win, 3, 0, 1, 1)
        self.wxgui_numbersink2_1_1_0_1 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="degrees",
        	minval=-10,
        	maxval=10,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Quadrature Horizontal Angle Error ",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1_0_1.win, 2, 0, 1, 1)
        self.wxgui_numbersink2_1_1_0_0 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="degrees",
        	minval=-10,
        	maxval=10,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Quadrature Vertical Angle Error",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1_0_0.win, 2, 1, 1, 1)
        self.wxgui_numbersink2_1_1_0 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="volts",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Amplitude Imbalance Vertical",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1_0.win, 1, 2, 1, 1)
        self.wxgui_numbersink2_1_1 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="power normalized to tx power",
        	minval=0,
        	maxval=0.1,
        	factor=1.0,
        	decimal_places=4,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="Carrier Suppression ",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_1.win, 1, 0, 1, 1)
        self.wxgui_numbersink2_1_0_1 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="normalized to tx power",
        	minval=0,
        	maxval=10,
        	factor=1.0,
        	decimal_places=3,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="STE average ",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_0_1.win, 0, 2, 1, 1)
        self.wxgui_numbersink2_1_0_0 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="normalized to tx power",
        	minval=0,
        	maxval=10,
        	factor=1.0,
        	decimal_places=3,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="STE desviation",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_0_0.win, 2, 2, 1, 1)
        self.wxgui_numbersink2_1_0 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="voltage",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=3,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="STE",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1_0.win, 0, 1, 1, 1)
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
        	self.n_0.GetPage(1).GetWin(),
        	unit="db",
        	minval=0,
        	maxval=100,
        	factor=1.0,
        	decimal_places=1,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=0.03,
        	label="MER",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.n_0.GetPage(1).GridAdd(self.wxgui_numbersink2_1.win, 0, 0, 1, 1)
        self.mer_probe_ste_cf_0 = mer.probe_ste_cf((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j), 0.05)
        self.mer_probe_qe_cf_0 = mer.probe_qe_cf((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j), 0.05)
        self.mer_probe_pj_cf_0 = mer.probe_pj_cf((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j), 0.05)
        self.mer_probe_mer_c_0 = mer.probe_mer_c((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j),0.05)
        self.mer_probe_cs_cf_0 = mer.probe_cs_cf((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j), 0.05)
        self.mer_probe_ai_cf_0 = mer.probe_ai_cf((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j), 0.05)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc((0.9487+0.9487j,0.9487+0.3162j, 0.3162+0.9487j, 0.3162 +0.3162j,0.9487-0.9487j,0.9487- 0.3162j, 0.3162-0.9487j, 0.3162- 0.3162j,-0.9487+0.9487j,-0.9487+ 0.3162j,- 0.3162+0.9487j,- 0.3162+ 0.3162j,-0.9487-0.9487j,-0.9487- 0.3162j,-0.3162-0.9487j,-0.3162- 0.3162j), 1)
        self.channels_impairments_0 = channels.impairments(pj, ai, qe, cs, 0, 0, 0, 0)
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=noise,
        	frequency_offset=0.0,
        	epsilon=1.0,
        	taps=(1, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, sym_rate,True)
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 16, 1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.mer_probe_ai_cf_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.mer_probe_cs_cf_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.mer_probe_mer_c_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.mer_probe_pj_cf_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.mer_probe_qe_cf_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.mer_probe_ste_cf_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.wxgui_scopesink2_0_0, 0))    
        self.connect((self.channels_impairments_0, 0), (self.channels_channel_model_0, 0))    
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.channels_impairments_0, 0))    
        self.connect((self.mer_probe_ai_cf_0, 1), (self.wxgui_numbersink2_1_1_0, 0))    
        self.connect((self.mer_probe_ai_cf_0, 0), (self.wxgui_numbersink2_1_1_1, 0))    
        self.connect((self.mer_probe_cs_cf_0, 0), (self.wxgui_numbersink2_1_1, 0))    
        self.connect((self.mer_probe_mer_c_0, 0), (self.wxgui_numbersink2_1, 0))    
        self.connect((self.mer_probe_pj_cf_0, 0), (self.wxgui_numbersink2_1_1_0_1_0, 0))    
        self.connect((self.mer_probe_pj_cf_0, 1), (self.wxgui_numbersink2_1_1_0_1_0_0, 0))    
        self.connect((self.mer_probe_qe_cf_0, 1), (self.wxgui_numbersink2_1_1_0_0, 0))    
        self.connect((self.mer_probe_qe_cf_0, 0), (self.wxgui_numbersink2_1_1_0_1, 0))    
        self.connect((self.mer_probe_ste_cf_0, 0), (self.wxgui_numbersink2_1_0, 0))    
        self.connect((self.mer_probe_ste_cf_0, 2), (self.wxgui_numbersink2_1_0_0, 0))    
        self.connect((self.mer_probe_ste_cf_0, 1), (self.wxgui_numbersink2_1_0_1, 0))    
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Output Window")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.threshold = threshold = -55
        self.samp_rate = samp_rate = 2.048e6
        self.freq = freq = 658e6
        self.fft_size = fft_size = 1.024e3

        ##################################################
        # Blocks
        ##################################################
        self.notebook = self.notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Spectrum")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Output")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Stream")
        self.Add(self.notebook)
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
        	parent=self.notebook.GetPage(1).GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	label="Threshold",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._threshold_slider = forms.slider(
        	parent=self.notebook.GetPage(1).GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	minimum=-100,
        	maximum=0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.notebook.GetPage(1).Add(_threshold_sizer)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.notebook.GetPage(0).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.notebook.GetPage(0).GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=10e6,
        	maximum=10e9,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.notebook.GetPage(0).Add(_freq_sizer)
        self.wxgui_numbersink2_1 = numbersink2.number_sink_f(
        	self.notebook.GetPage(1).GetWin(),
        	unit="signal present",
        	minval=0,
        	maxval=1,
        	factor=1,
        	decimal_places=0,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Signal Detection",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.notebook.GetPage(1).Add(self.wxgui_numbersink2_1.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.notebook.GetPage(1).GetWin(),
        	unit="dB",
        	minval=-120,
        	maxval=0,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=30e-3,
        	label="level",
        	peak_hold=False,
        	show_gauge=False,
        )
        self.notebook.GetPage(1).Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	y_per_div=5,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=30e-3,
        	title="Spectrum",
        	peak_hold=False,
        	win=window.rectangular,
        )
        self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(20, 0)
        self.rtlsdr_source_0.set_if_gain(10, 0)
        self.rtlsdr_source_0.set_bb_gain(5, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.fft_1 = fft.fft_vcc(1024, True, (window.rectangular(1024)), True, 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_float*1, 1024)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-100, threshold, 0)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 1024)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, "/media/shashwat/DATA/Q3/Wireless Networking/gnu codes/Outputs/db_498", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1024)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1.04858e6)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_divide_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.blocks_divide_xx_0, 0), (self.blocks_nlog10_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_threshold_ff_0, 0))    
        self.connect((self.blocks_nlog10_ff_0, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_1, 0))    
        self.connect((self.blocks_threshold_ff_0, 0), (self.wxgui_numbersink2_1, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_divide_xx_0, 0))    
        self.connect((self.fft_1, 0), (self.blocks_complex_to_mag_squared_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))    
Exemple #33
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="fhss_test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_sym = samp_sym = 64
        self.samp_rate = samp_rate = 400e3
        self.init = init = 1, 1, 1, 1
        self.generator = generator = 1, 1, 0, 0, 1
        self.code_rate = code_rate = int(samp_sym * 500)

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	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="Received Spread Spectrum ",
        )
        self.Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_numbersink2_0_0_0_0_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=-100e5,
        	maxval=100e5,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=60,
        	average=False,
        	avg_alpha=None,
        	label="Error",
        	peak_hold=False,
        	show_gauge=False,
        )
        self.Add(self.wxgui_numbersink2_0_0_0_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	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="Despread Signal",
        	peak_hold=False,
        )
        self.GridAdd(self.wxgui_fftsink2_0.win, 0, 2, 2, 4)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "serial=F54381")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_clock_source("internal", 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(500e6, 0)
        self.uhd_usrp_source_0.set_gain(47, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "serial=F54358")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_clock_source("internal", 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(500e6, 0)
        self.uhd_usrp_sink_0.set_gain(50, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.blocks_vector_source_x_0 = blocks.vector_source_b((1,1,1,1), True, 1, [])
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((.9, ))
        self.blks2_error_rate_0 = grc_blks2.error_rate(
        	type='BER',
        	win_size=1000,
        	bits_per_symbol=1,
        )
        self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 0, samp_rate, (generator), (init))
        self.Spread_rx_synthesizer_0 = Spread.rx_synthesizer(code_rate, 
                                      samp_sym, 
                                      samp_rate, 
                                      12000, 
                                      50000, 
                                      0.16, 
                                      (generator), 
                                      (init))
        self.Spread_cpfsk_mod_0 = Spread.cpfsk_mod(samp_sym)
        self.Spread_cpfsk_demod_0 = Spread.cpfsk_demod(samp_sym)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_error_rate_0, 0), (self.wxgui_numbersink2_0_0_0_0_0, 0))
        self.connect((self.Spread_cpfsk_demod_0, 0), (self.blks2_error_rate_0, 1))
        self.connect((self.blocks_vector_source_x_0, 0), (self.Spread_cpfsk_mod_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blks2_error_rate_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.Spread_rx_synthesizer_0, 0))
        self.connect((self.Spread_synthesizer_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.Spread_rx_synthesizer_0, 0), (self.Spread_cpfsk_demod_0, 0))
        self.connect((self.Spread_cpfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.Spread_synthesizer_0, 0))
        self.connect((self.Spread_rx_synthesizer_0, 0), (self.wxgui_fftsink2_0, 0))
    def __init__(self, subdev="A:0", devid="addr=192.168.10.2", frequency=1.4125e9, fftsize=8192):
        grc_wxgui.top_block_gui.__init__(self, title="Total Power Radiometer - N200")

        ##################################################
        # Parameters
        ##################################################
        self.subdev = subdev
        self.devid = devid
        self.frequency = frequency
        self.fftsize = fftsize

        ##################################################
        # Variables
        ##################################################
        self.GUI_samp_rate = GUI_samp_rate = 10e6
        self.samp_rate = samp_rate = int(GUI_samp_rate)
        self.prefix = prefix = "tpr_"
        self.text_samp_rate = text_samp_rate = GUI_samp_rate
        self.text_deviceID = text_deviceID = subdev
        self.text_Device_addr = text_Device_addr = devid
        self.spec_data_fifo = spec_data_fifo = "spectrum_" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.spavg = spavg = 1
        self.scope_rate = scope_rate = 2
        self.recfile_tpr = recfile_tpr = prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.recfile_kelvin = recfile_kelvin = prefix+"kelvin" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.rec_button_tpr = rec_button_tpr = 1
        self.rec_button_iq = rec_button_iq = 1
        self.noise_amplitude = noise_amplitude = .5
        self.integ = integ = 2
        self.gain = gain = 26
        self.freq = freq = frequency
        self.file_rate = file_rate = 2.0
        self.fftrate = fftrate = int(samp_rate/fftsize)
        self.det_rate = det_rate = int(20.0)
        self.dc_gain = dc_gain = 1
        self.calib_2 = calib_2 = -342.774
        self.calib_1 = calib_1 = 4.0755e3
        self.add_noise = add_noise = 0

        ##################################################
        # Blocks
        ##################################################
        self.Main = self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.Main.AddPage(grc_wxgui.Panel(self.Main), "N200 Control Panel")
        self.Main.AddPage(grc_wxgui.Panel(self.Main), "TPR Measurements")
        self.Add(self.Main)
        _spavg_sizer = wx.BoxSizer(wx.VERTICAL)
        self._spavg_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_spavg_sizer,
        	value=self.spavg,
        	callback=self.set_spavg,
        	label="Spectral Averaging (Seconds)",
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._spavg_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_spavg_sizer,
        	value=self.spavg,
        	callback=self.set_spavg,
        	minimum=1,
        	maximum=20,
        	num_steps=20,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_spavg_sizer, 1, 1, 1, 1)
        self._rec_button_tpr_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.rec_button_tpr,
        	callback=self.set_rec_button_tpr,
        	label="Record TPR Data",
        	choices=[0,1],
        	labels=['Stop','Start'],
        )
        self.Main.GetPage(0).GridAdd(self._rec_button_tpr_chooser, 4, 1, 1, 1)
        self._rec_button_iq_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.rec_button_iq,
        	callback=self.set_rec_button_iq,
        	label="Record I/Q Data",
        	choices=[0,1],
        	labels=['Stop','Start'],
        )
        self.Main.GetPage(0).GridAdd(self._rec_button_iq_chooser, 4, 0, 1, 1)
        _integ_sizer = wx.BoxSizer(wx.VERTICAL)
        self._integ_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_integ_sizer,
        	value=self.integ,
        	callback=self.set_integ,
        	label="Integration Time (Seconds)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._integ_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_integ_sizer,
        	value=self.integ,
        	callback=self.set_integ,
        	minimum=1,
        	maximum=60,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_integ_sizer, 0, 2, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="RF Gain (dB)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=50,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_gain_sizer, 0, 1, 1, 1)
        self._freq_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.freq,
        	callback=self.set_freq,
        	label="Center Frequency (Hz)",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._freq_text_box, 0, 0, 1, 1)
        self._dc_gain_chooser = forms.radio_buttons(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.dc_gain,
        	callback=self.set_dc_gain,
        	label="DC Gain",
        	choices=[1, 10, 100, 1000, 10000],
        	labels=[],
        	style=wx.RA_HORIZONTAL,
        )
        self.Main.GetPage(0).GridAdd(self._dc_gain_chooser, 1, 0, 1, 1)
        self._calib_2_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.calib_2,
        	callback=self.set_calib_2,
        	label="Calibration value 2",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._calib_2_text_box, 3, 1, 1, 1)
        self._calib_1_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.calib_1,
        	callback=self.set_calib_1,
        	label="Calibration value 1",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._calib_1_text_box, 3, 0, 1, 1)
        self._GUI_samp_rate_chooser = forms.radio_buttons(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.GUI_samp_rate,
        	callback=self.set_GUI_samp_rate,
        	label="Sample Rate (BW)",
        	choices=[1e6,2e6,5e6,10e6,25e6],
        	labels=['1 MHz','2 MHz','5 MHz','10 MHz','25 MHz'],
        	style=wx.RA_HORIZONTAL,
        )
        self.Main.GetPage(0).GridAdd(self._GUI_samp_rate_chooser, 1, 3, 1, 1)
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	title="Total Power",
        	sample_rate=2,
        	v_scale=.1,
        	v_offset=0,
        	t_scale=100,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_STRIPCHART,
        	y_axis_label="power level",
        )
        self.Main.GetPage(1).Add(self.wxgui_scopesink2_2.win)
        self.wxgui_numbersink2_2 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=GUI_samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_2.win)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	unit="",
        	minval=0,
        	maxval=.2,
        	factor=1,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=scope_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=.01,
        	label="Raw Power level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Main.GetPage(1).Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	unit="Kelvin",
        	minval=0,
        	maxval=400,
        	factor=1,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=scope_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Calibrated Temperature",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Main.GetPage(1).Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.Main.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=20,
        	ref_scale=2.0,
        	sample_rate=GUI_samp_rate,
        	fft_size=1024,
        	fft_rate=5,
        	average=True,
        	avg_alpha=0.1,
        	title="Spectrum",
        	peak_hold=False,
        	size=(800,400),
        )
        self.Main.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join((devid, "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(GUI_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        (self.uhd_usrp_source_0).set_processor_affinity([0])
        self._text_samp_rate_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.text_samp_rate,
        	callback=self.set_text_samp_rate,
        	label="Samp rate",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._text_samp_rate_static_text, 2, 0, 1, 1)
        self._text_deviceID_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.text_deviceID,
        	callback=self.set_text_deviceID,
        	label="SubDev",
        	converter=forms.str_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._text_deviceID_static_text, 2, 1, 1, 1)
        self._text_Device_addr_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.text_Device_addr,
        	callback=self.set_text_Device_addr,
        	label="Device Address",
        	converter=forms.str_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._text_Device_addr_static_text, 2, 2, 1, 1)
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/((samp_rate*integ)/2.0), 1)
        (self.single_pole_iir_filter_xx_0).set_processor_affinity([1])
        _noise_amplitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_amplitude_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_noise_amplitude_sizer,
        	value=self.noise_amplitude,
        	callback=self.set_noise_amplitude,
        	label='noise_amplitude',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._noise_amplitude_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_noise_amplitude_sizer,
        	value=self.noise_amplitude,
        	callback=self.set_noise_amplitude,
        	minimum=.01,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_noise_amplitude_sizer, 3, 2, 1, 1)
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
        	sample_rate=samp_rate,
        	fft_size=fftsize,
        	ref_scale=2,
        	frame_rate=fftrate,
        	avg_alpha=1.0/float(spavg*fftrate),
        	average=True,
        )
        self.blocks_peak_detector_xb_0 = blocks.peak_detector_fb(0.25, 0.40, 10, 0.001)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((calib_1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((dc_gain, ))
        self.blocks_keep_one_in_n_4 = blocks.keep_one_in_n(gr.sizeof_float*1, samp_rate/det_rate)
        self.blocks_keep_one_in_n_3 = blocks.keep_one_in_n(gr.sizeof_float*fftsize, fftrate)
        self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*1, int(det_rate/file_rate))
        self.blocks_file_sink_5 = blocks.file_sink(gr.sizeof_float*fftsize, spec_data_fifo, False)
        self.blocks_file_sink_5.set_unbuffered(True)
        self.blocks_file_sink_4 = blocks.file_sink(gr.sizeof_float*1, recfile_tpr, False)
        self.blocks_file_sink_4.set_unbuffered(True)
        self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, prefix+"iq_raw" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat", False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, recfile_kelvin, False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_1 = blocks.complex_to_mag_squared(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((calib_2, ))
        self.blks2_valve_2 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(rec_button_iq))
        self.blks2_valve_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(0))
        self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec_button_tpr))
        self._add_noise_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.add_noise,
        	callback=self.set_add_noise,
        	label="Noise Source",
        	choices=[0,1],
        	labels=['Off','On'],
        )
        self.Main.GetPage(0).GridAdd(self._add_noise_chooser, 3, 3, 1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_valve_0, 0), (self.blocks_file_sink_4, 0))    
        self.connect((self.blks2_valve_1, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blks2_valve_2, 0), (self.blocks_file_sink_1, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blks2_valve_1, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_char_to_float_0, 0), (self.wxgui_numbersink2_2, 0))    
        self.connect((self.blocks_complex_to_mag_squared_1, 0), (self.single_pole_iir_filter_xx_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_peak_detector_xb_0, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blks2_valve_0, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.wxgui_scopesink2_2, 0))    
        self.connect((self.blocks_keep_one_in_n_3, 0), (self.blocks_file_sink_5, 0))    
        self.connect((self.blocks_keep_one_in_n_4, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_keep_one_in_n_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_1, 0))    
        self.connect((self.blocks_peak_detector_xb_0, 0), (self.blocks_char_to_float_0, 0))    
        self.connect((self.logpwrfft_x_0, 0), (self.blocks_keep_one_in_n_3, 0))    
        self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_4, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blks2_valve_2, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_1, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.logpwrfft_x_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))    
Exemple #35
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2.5e6
        self.fft1 = fft1 = 128

        ##################################################
        # Blocks
        ##################################################
        self.sig_source = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit='Units',
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=5,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label='sig source',
        	peak_hold=True,
        	show_gauge=True,
        )
        self.Add(self.sig_source.win)
        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(467.562e6, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(1, 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(10, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.phase = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit='Units',
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label='Number Plot',
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.phase.win)
        self.high_pass_filter_0 = filter.fir_filter_ccf(1, firdes.high_pass(
        	1, samp_rate, 1000, 10000, firdes.WIN_HAMMING, 6.76))
        self.fft_vxx_0_0 = fft.fft_vcc(32, True, (window.blackmanharris(32)), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(128, True, (window.blackmanharris(128)), True, 1)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 32)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fft1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_sub_xx_0 = blocks.sub_ii(1)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, 32)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft1)
        self.blocks_skiphead_0_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 9)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_gr_complex*1, 9)
        self.blocks_keep_one_in_n_0_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*1, 1)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_gr_complex*1, 1)
        self.blocks_complex_to_mag_0_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_arg_0_0 = blocks.complex_to_arg(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, 467.563e6, 1, 0)
        self.actual_data = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit='Units',
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=5,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label='actual',
        	peak_hold=True,
        	show_gauge=True,
        )
        self.Add(self.actual_data.win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_stream_to_vector_0_0, 0))    
        self.connect((self.blocks_complex_to_arg_0, 0), (self.blocks_sub_xx_0, 0))    
        self.connect((self.blocks_complex_to_arg_0_0, 0), (self.blocks_sub_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.actual_data, 0))    
        self.connect((self.blocks_complex_to_mag_0_0, 0), (self.sig_source, 0))    
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_complex_to_arg_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_complex_to_arg_0_0, 0))    
        self.connect((self.blocks_keep_one_in_n_0_0, 0), (self.blocks_complex_to_mag_0_0, 0))    
        self.connect((self.blocks_skiphead_0, 0), (self.blocks_keep_one_in_n_0, 0))    
        self.connect((self.blocks_skiphead_0_0, 0), (self.blocks_keep_one_in_n_0_0, 0))    
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))    
        self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0_0, 0))    
        self.connect((self.blocks_sub_xx_0, 0), (self.phase, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_stream_to_vector_0, 0))    
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_skiphead_0, 0))    
        self.connect((self.blocks_vector_to_stream_0_0, 0), (self.blocks_skiphead_0_0, 0))    
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))    
        self.connect((self.fft_vxx_0_0, 0), (self.blocks_vector_to_stream_0_0, 0))    
        self.connect((self.high_pass_filter_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.high_pass_filter_0, 0))