commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11280 - gnuradio/branches/developers/trondeau/pfb/gnu


From: trondeau
Subject: [Commit-gnuradio] r11280 - gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter
Date: Wed, 24 Jun 2009 21:02:44 -0600 (MDT)

Author: trondeau
Date: 2009-06-24 21:02:44 -0600 (Wed, 24 Jun 2009)
New Revision: 11280

Modified:
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.cc
Log:
actually, it works fine; using the FFT makes more sense, though.

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
        2009-06-25 01:57:58 UTC (rev 11279)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/channelize.py
        2009-06-25 03:02:44 UTC (rev 11280)
@@ -3,18 +3,21 @@
 from gnuradio import gr
 import math
 import os
+import scipy, pylab
+from scipy import fftpack
 
-print os.getpid()
-raw_input()
+#print os.getpid()
+#raw_input()
 
 class pfb_top_block(gr.top_block):
     def __init__(self):
         gr.top_block.__init__(self)
 
         self._N = 200000
-        self._fs = 10000
+        self._fs = 9000
+        self._Tmax = self._N * (1.0/self._fs)
         self._M = 9
-        self._taps = gr.firdes.low_pass(1, self._fs, 200, 20)
+        self._taps = gr.firdes.low_pass(1, self._fs, 800, 20)
         fc = 200
 
         tpc = math.ceil(float(len(self._taps)) /  float(self._M))
@@ -36,25 +39,58 @@
 
         self.v2s = gr.vector_to_streams(gr.sizeof_gr_complex, self._M)
 
-        self.snk_i = gr.file_sink(gr.sizeof_gr_complex, "input.32c")
-        self.snk_o = gr.file_sink(gr.sizeof_gr_complex*self._M, "output.32c")
+        self.snk_i = gr.vector_sink_c()
 
         # Create a file sink for each of M output channels of the filter and 
connect it
         self.snks = list()
         for i in xrange(self._M):
-            self.snks.append(gr.file_sink(gr.sizeof_gr_complex, 
("output%d.32c" % i)))
+            self.snks.append(gr.vector_sink_c())
             self.connect((self.v2s, i), self.snks[i])
                              
         # Connect the rest
         self.connect(self.add, self.head, self.pfb)
         self.connect(self.pfb, self.v2s)
         self.connect(self.add, self.snk_i)
-        self.connect(self.pfb, self.snk_o)
 
 def main():
     tb = pfb_top_block()
     tb.run()
 
+    fig1 = pylab.figure(1, figsize=(16,9))
+    fig2 = pylab.figure(2, figsize=(16,9))
+
+    f_in = scipy.arange(-tb._fs/2.0, tb._fs/2.0, 
tb._fs/float(len(tb.snk_i.data())))
+    X_in = 10.0*scipy.log10(fftpack.fftshift(fftpack.fft(tb.snk_i.data(), 
f_in.size)))
+    sp1_in = fig1.add_subplot(4, 3, 1)
+    p1_in = sp1_in.plot(f_in, X_in)
+
+    t_in = scipy.arange(0, tb._Tmax, tb._Tmax/float(len(tb.snk_i.data())))
+    x_in = scipy.array(tb.snk_i.data())
+    sp2_in = fig2.add_subplot(4, 3, 1)
+    p2_in = sp2_in.plot(t_in, x_in.real, "b")
+    p2_in = sp2_in.plot(t_in, x_in.imag, "r")
+
+    fs_o = tb._fs / tb._M
+    for i in xrange(len(tb.snks)):
+        # remove issues with the transients at the beginning
+        # also remove some corruption at the end of the stream
+        #    this is a bug, probably due to the corner cases
+        d = tb.snks[i].data()[2000:10000]
+        f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(len(d)))
+        x_o = 10.0*scipy.log10(fftpack.fftshift(fftpack.fft(d)))
+        sp1_o = fig1.add_subplot(4, 3, 2+i)
+        p1_o = sp1_o.plot(f_o, x_o)
+
+        x_o = scipy.array(d)
+        t_o = scipy.arange(0, tb._Tmax, tb._Tmax/float(x_o.size))
+        sp2_o = fig2.add_subplot(4, 3, 2+i)
+        p2_o = sp2_o.plot(t_o, x_o.real, "b")
+        p2_o = sp2_o.plot(t_o, x_o.imag, "r")
+        
+
+    pylab.show()
+
+
 if __name__ == "__main__":
     try:
         main()

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.cc
 2009-06-25 01:57:58 UTC (rev 11279)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_filter_ccf.cc
 2009-06-25 03:02:44 UTC (rev 11280)
@@ -70,7 +70,7 @@
   }
   
   // Create the FFT to handle the output de-spinning of the channels
-  d_fft = new gri_fft_complex (d_numchans, true);
+  d_fft = new gri_fft_complex (d_numchans, false);
   
   set_history (d_taps_per_filter);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]