commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7514 - in gnuradio/branches/releases/3.1: gnuradio-co


From: jcorgan
Subject: [Commit-gnuradio] r7514 - in gnuradio/branches/releases/3.1: gnuradio-core/src/python/gnuradio/blks2impl gnuradio-examples/python/usrp
Date: Fri, 25 Jan 2008 08:26:00 -0700 (MST)

Author: jcorgan
Date: 2008-01-25 08:26:00 -0700 (Fri, 25 Jan 2008)
New Revision: 7514

Added:
   
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_analysis.py
   
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_synth.py
Modified:
   
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
   gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/Makefile.am
Log:
Applied changeset r7476 on trunk to release branch.

Modified: 
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
===================================================================
--- 
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
    2008-01-25 15:22:41 UTC (rev 7513)
+++ 
gnuradio/branches/releases/3.1/gnuradio-core/src/python/gnuradio/blks2impl/filterbank.py
    2008-01-25 15:26:00 UTC (rev 7514)
@@ -107,7 +107,7 @@
         for i in range(mpoints):
             self.connect((self, i), (self.ss2v, i))
             
-        self.connect(self.ss2v, self.ifft, self.v2ss, self)
+        self.connect(self.ss2v, self.ifft, self.v2ss)
 
         # build mpoints fir filters...
         for i in range(mpoints):
@@ -115,7 +115,8 @@
             self.connect((self.v2ss, i), f)
             self.connect(f, (self.ss2s, i))
 
-
+       self.connect(self.ss2s, self)
+       
 class analysis_filterbank(gr.hier_block2):
     """
     Uniformly modulated polyphase DFT filter bank: analysis

Modified: 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/Makefile.am
===================================================================
--- gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/Makefile.am    
2008-01-25 15:22:41 UTC (rev 7513)
+++ gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/Makefile.am    
2008-01-25 15:26:00 UTC (rev 7514)
@@ -25,6 +25,8 @@
        fm_tx_2_daughterboards.py               \
        fm_tx4.py                               \
        max_power.py                            \
+       test_dft_analysis.py                    \
+       test_dft_synth.py                       \
        usrp_benchmark_usb.py                   \
        usrp_nbfm_ptt.py                        \
        usrp_nbfm_rcv.py                        \

Copied: 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_analysis.py
 (from rev 7476, 
gnuradio/trunk/gnuradio-examples/python/usrp/test_dft_analysis.py)
===================================================================
--- 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_analysis.py
                           (rev 0)
+++ 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_analysis.py
   2008-01-25 15:26:00 UTC (rev 7514)
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, blks2
+from gnuradio.wxgui import stdgui2, fftsink2, slider
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import wx
+
+class test_graph (stdgui2.std_top_block):
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
+
+        parser = OptionParser (option_class=eng_option)
+        (options, args) = parser.parse_args ()
+
+        sample_rate = 16e3
+        mpoints = 4
+        ampl = 1000
+        freq = 0
+
+        lo_freq = 1e6
+        lo_ampl = 1
+        
+        vbox.Add(slider.slider(panel,
+                               -sample_rate/2, sample_rate/2,
+                               self.set_lo_freq), 0, wx.ALIGN_CENTER)
+
+
+        src = gr.sig_source_c(sample_rate, gr.GR_CONST_WAVE,
+                              freq, ampl, 0)
+
+        self.lo = gr.sig_source_c(sample_rate, gr.GR_SIN_WAVE,
+                                  lo_freq, lo_ampl, 0)
+
+        mixer = gr.multiply_cc()
+        self.connect(src, (mixer, 0))
+        self.connect(self.lo, (mixer, 1))
+        
+        # We add these throttle blocks so that this demo doesn't
+        # suck down all the CPU available.  Normally you wouldn't use these.
+        thr = gr.throttle(gr.sizeof_gr_complex, sample_rate)
+
+        taps = gr.firdes.low_pass(1,   # gain
+                                  1,   # rate
+                                  1.0/mpoints * 0.4,  # cutoff
+                                  1.0/mpoints * 0.1,  # trans width
+                                  gr.firdes.WIN_HANN)
+        print len(taps)
+        analysis = blks2.analysis_filterbank(mpoints, taps)
+        
+        self.connect(mixer, thr)
+        self.connect(thr, analysis)
+
+        for i in range(mpoints):
+            fft = fftsink2.fft_sink_c(frame, fft_size=128,
+                                     sample_rate=sample_rate/mpoints,
+                                     fft_rate=5,
+                                     title="Ch %d" % (i,))
+            self.connect((analysis, i), fft)
+            vbox.Add(fft.win, 1, wx.EXPAND)
+
+    def set_lo_freq(self, freq):
+        self.lo.set_frequency(freq)
+        
+                                     
+
+def main ():
+    app = stdgui2.stdapp (test_graph, "Test DFT filterbank")
+    app.MainLoop ()
+
+if __name__ == '__main__':
+    main ()

Copied: 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_synth.py 
(from rev 7476, gnuradio/trunk/gnuradio-examples/python/usrp/test_dft_synth.py)
===================================================================
--- 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_synth.py  
                            (rev 0)
+++ 
gnuradio/branches/releases/3.1/gnuradio-examples/python/usrp/test_dft_synth.py  
    2008-01-25 15:26:00 UTC (rev 7514)
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, blks2
+from gnuradio.wxgui import stdgui2, fftsink2
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import wx
+import random
+
+
+def make_random_complex_tuple(L, gain=1):
+    result = []
+    for x in range(L):
+        result.append(gain * complex(random.gauss(0, 1),random.gauss(0, 1)))
+                      
+    return tuple(result)
+
+def random_noise_c(gain=1):
+    src = gr.vector_source_c(make_random_complex_tuple(32*1024, gain), True)
+    return src
+
+
+class test_graph (stdgui2.std_top_block):
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
+
+        parser = OptionParser (option_class=eng_option)
+        (options, args) = parser.parse_args ()
+
+        sample_rate = 16e6
+        mpoints = 16
+        ampl = 1000
+        
+        enable = mpoints/2 * [1, 0]
+        enable[0] = 1
+
+        taps = gr.firdes.low_pass(1,   # gain
+                                  1,   # rate
+                                  1.0/mpoints * 0.4,  # cutoff
+                                  1.0/mpoints * 0.1,  # trans width
+                                  gr.firdes.WIN_HANN)
+
+        synth = blks2.synthesis_filterbank(mpoints, taps)
+        
+        null_source = gr.null_source(gr.sizeof_gr_complex)
+        
+        if 1:
+            for i in range(mpoints):
+                s = gr.sig_source_c(sample_rate/mpoints, gr.GR_SIN_WAVE,
+                                    300e3, ampl * enable[i], 0)
+                self.connect(s, (synth, i))
+
+        else:
+            for i in range(mpoints):
+                if i == 1:
+                    #s = gr.sig_source_c(sample_rate/mpoints, gr.GR_SIN_WAVE,
+                    #                    300e3, ampl * enable[i], 0)
+                    s = random_noise_c(ampl)
+                    self.connect(s, (synth, i))
+                else:
+                    self.connect(null_source, (synth, i))
+            
+
+        # We add these throttle blocks so that this demo doesn't
+        # suck down all the CPU available.  Normally you wouldn't use these.
+        thr = gr.throttle(gr.sizeof_gr_complex, sample_rate)
+        fft = fftsink2.fft_sink_c(frame, fft_size=1024,sample_rate=sample_rate)
+        vbox.Add(fft.win, 1, wx.EXPAND)
+
+        self.connect(synth, thr, fft)
+
+
+def main ():
+    app = stdgui2.stdapp (test_graph, "Test DFT filterbank")
+    app.MainLoop ()
+
+if __name__ == '__main__':
+    main ()





reply via email to

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