Merge branch 'wip/gr-noaa' of http://gnuradio.org/git/jcorgan into master
[debian/gnuradio] / gr-noaa / apps / usrp_rx_hrpt.py
index 7efbecd3a389bf654ed66639f59e18c1a8865388..ae70f25c8ce0d3733b2a10ca392207d323d4185f 100755 (executable)
@@ -2,7 +2,7 @@
 ##################################################
 # Gnuradio Python Flow Graph
 # Title: USRP HRPT Receiver
-# Generated: Wed Sep 23 11:32:04 2009
+# Generated: Sun Sep 27 13:37:23 2009
 ##################################################
 
 from gnuradio import eng_notation
@@ -62,6 +62,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                try: saved_freq = self._saved_freq_config.getfloat('usrp', 'freq')
                except: saved_freq = 1698e6
                self.saved_freq = saved_freq
+               self.hs = hs = int(sps/2.0)
                self.sync_alpha = sync_alpha = saved_sync_alpha
                self.side_text = side_text = side
                self.pll_alpha = pll_alpha = saved_pll_alpha
@@ -70,9 +71,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                try: output_filename = self._output_filename_config.get('output', 'filename')
                except: output_filename = 'frames.dat'
                self.output_filename = output_filename
+               self.mf_taps = mf_taps = [-0.5/hs,]*hs+[0.5/hs]*hs
                self.max_sync_offset = max_sync_offset = 0.01
                self.max_carrier_offset = max_carrier_offset = 2*math.pi*100e3/sample_rate
-               self.hs = hs = int(sps/2.0)
                self.gain = gain = saved_gain
                self.freq = freq = saved_freq
                self.decim_text = decim_text = decim
@@ -189,11 +190,11 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self.decoder = noaa.hrpt_decoder()
                self.deframer = noaa.hrpt_deframer()
                self.frame_sink = gr.file_sink(gr.sizeof_short*1, output_filename)
-               self.matched_filter = gr.moving_average_cc(hs, 1.0/hs, 4000)
+               self.gr_fir_filter_xxx_0 = gr.fir_filter_ccc(1, (mf_taps))
                self.pll = noaa.hrpt_pll_cf(pll_alpha, pll_alpha**2/4.0, max_carrier_offset)
                self.pll_scope = scopesink2.scope_sink_f(
                        self.displays.GetPage(1).GetWin(),
-                       title="Post-PLL",
+                       title="Demod Waveform",
                        sample_rate=sample_rate,
                        v_scale=0.5,
                        t_scale=20.0/sample_rate,
@@ -211,7 +212,7 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                        ref_scale=2.0,
                        sample_rate=sample_rate,
                        fft_size=1024,
-                       fft_rate=30,
+                       fft_rate=15,
                        average=True,
                        avg_alpha=0.1,
                        title="RX Spectrum",
@@ -244,9 +245,9 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self.connect((self.pll, 0), (self.pll_scope, 0))
                self.connect((self.agc, 0), (self.rx_scope, 0))
                self.connect((self.agc, 0), (self.rx_fft, 0))
-               self.connect((self.agc, 0), (self.matched_filter, 0))
-               self.connect((self.matched_filter, 0), (self.pll, 0))
                self.connect((self.deframer, 0), (self.decoder, 0))
+               self.connect((self.agc, 0), (self.gr_fir_filter_xxx_0, 0))
+               self.connect((self.gr_fir_filter_xxx_0, 0), (self.pll, 0))
                self.connect((self.usrp_source, 0), (self.agc, 0))
 
        def set_config_filename(self, config_filename):
@@ -348,6 +349,10 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self.saved_freq = saved_freq
                self.set_freq(self.saved_freq)
 
+       def set_hs(self, hs):
+               self.hs = hs
+               self.set_mf_taps([-0.5/self.hs,]*self.hs+[0.5/self.hs]*self.hs)
+
        def set_sync_alpha(self, sync_alpha):
                self.sync_alpha = sync_alpha
                self._sync_alpha_slider.set_value(self.sync_alpha)
@@ -387,6 +392,10 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self._output_filename_config.set('output', 'filename', str(self.output_filename))
                self._output_filename_config.write(open(self.config_filename, 'w'))
 
+       def set_mf_taps(self, mf_taps):
+               self.mf_taps = mf_taps
+               self.gr_fir_filter_xxx_0.set_taps((self.mf_taps))
+
        def set_max_sync_offset(self, max_sync_offset):
                self.max_sync_offset = max_sync_offset
                self.sync.set_max_offset(self.max_sync_offset)
@@ -395,10 +404,6 @@ class usrp_rx_hrpt(grc_wxgui.top_block_gui):
                self.max_carrier_offset = max_carrier_offset
                self.pll.set_max_offset(self.max_carrier_offset)
 
-       def set_hs(self, hs):
-               self.hs = hs
-               self.matched_filter.set_length_and_scale(self.hs, 1.0/self.hs)
-
        def set_gain(self, gain):
                self.gain = gain
                self._gain_slider.set_value(self.gain)