From c95b26a7d8f04140d2371c075016c39c45b92580 Mon Sep 17 00:00:00 2001
From: jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Date: Sat, 12 May 2007 23:50:46 +0000
Subject: Added ability to log receive path power to file in digital examples.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5461 221aa14e-8319-0410-a670-987f0aec2ac5
---
 gnuradio-examples/python/digital/receive_path.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'gnuradio-examples/python')

diff --git a/gnuradio-examples/python/digital/receive_path.py b/gnuradio-examples/python/digital/receive_path.py
index 03e623f9fd..06a63095d3 100644
--- a/gnuradio-examples/python/digital/receive_path.py
+++ b/gnuradio-examples/python/digital/receive_path.py
@@ -105,8 +105,14 @@ class receive_path(gr.hier_block):
         # Carrier Sensing Blocks
         alpha = 0.001
         thresh = 30   # in dB, will have to adjust
-        self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
-        fg.connect(self.chan_filt, self.probe)
+
+        if options.log_rx_power == True:
+            self.probe = gr.probe_avg_mag_sqrd_cf(thresh,alpha)
+            self.power_sink = gr.file_sink(gr.sizeof_float, "rxpower.dat")
+            fg.connect(self.chan_filt, self.probe, self.power_sink)
+        else:
+            self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
+            fg.connect(self.chan_filt, self.probe)
 
         # Display some information about the setup
         if self._verbose:
@@ -220,6 +226,8 @@ class receive_path(gr.hier_block):
                           help="set fpga decimation rate to DECIM [default=%default]")
         expert.add_option("", "--log", action="store_true", default=False,
                           help="Log all parts of flow graph to files (CAUTION: lots of data)")
+        expert.add_option("", "--log-rx-power", action="store_true", default=False,
+                          help="Log receive signal power to file (CAUTION: lots of data)")
 
     # Make a static method to call before instantiation
     add_options = staticmethod(add_options)
@@ -238,7 +246,7 @@ class receive_path(gr.hier_block):
         print "decim:           %3d"   % (self._decim)
         print "Rx Frequency:    %s"    % (eng_notation.num_to_str(self._rx_freq))
         # print "Rx Frequency:    %f"    % (self._rx_freq)
-
+            
 def add_freq_option(parser):
     """
     Hackery that has the -f / --freq option set both tx_freq and rx_freq
-- 
cgit v1.2.3