Imported Upstream version 3.2.2
[debian/gnuradio] / gnuradio-examples / python / multi-antenna / multi_fft.py
index ca9c614a88f19c590228b1882fead9d68b1f3327..54444586046eaec8727739c0990cd8a7d82a8e22 100755 (executable)
@@ -6,9 +6,9 @@ from gnuradio.eng_option import eng_option
 from gnuradio import eng_notation
 from gnuradio import optfir
 from optparse import OptionParser
-from gnuradio.wxgui import stdgui, fftsink, waterfallsink, scopesink, form, slider
+from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form, slider
 import wx
-import usrp_dbid
+from usrpm import usrp_dbid
 import time
 import os.path
 import sys
@@ -16,10 +16,10 @@ import sys
 # required FPGA that can do 4 rx channels.
 
 
-class my_graph(stdgui.gui_flow_graph):
+class my_graph(stdgui2.std_top_block):
 
     def __init__(self, frame, panel, vbox, argv):
-        stdgui.gui_flow_graph.__init__(self)
+        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
 
         self.frame = frame
         self.panel = panel
@@ -49,9 +49,9 @@ class my_graph(stdgui.gui_flow_graph):
             sw_decim = 1
 
         self.u = usrp.source_c(0, options.decim, fpga_filename="std_4rx_0tx.rbf")
-        if self.u.nddc() < nchan:
+        if self.u.nddcs() < nchan:
             sys.stderr.write('This code requires an FPGA build with %d DDCs.  This FPGA has only %d.\n' % (
-                nchan, self.u.nddc()))
+                nchan, self.u.nddcs()))
             raise SystemExit
                              
         if not self.u.set_nchannels(nchan):
@@ -62,11 +62,11 @@ class my_graph(stdgui.gui_flow_graph):
         print "USB data rate   = %s" % (eng_notation.num_to_str(input_rate),)
         print "Scope data rate = %s" % (eng_notation.num_to_str(input_rate/sw_decim),)
 
-        self.subdev = self.u.db[0] + self.u.db[1]
+        self.subdev = self.u.db(0) + self.u.db(1)
 
-        if (len (self.subdev) != 4 or
-            self.u.db[0][0].dbid() != usrp_dbid.BASIC_RX or
-            self.u.db[1][0].dbid() != usrp_dbid.BASIC_RX):
+        if (len (self.subdev) < 4 or
+            self.u.db(0, 0).dbid() != usrp_dbid.BASIC_RX or
+            self.u.db(0, 0).dbid() != usrp_dbid.BASIC_RX):
             sys.stderr.write('This code requires a Basic Rx board on Sides A & B\n')
             sys.exit(1)
 
@@ -89,9 +89,9 @@ class my_graph(stdgui.gui_flow_graph):
         #print len(chan_filt_coeffs)
 
         for i in range(nchan):
-            scope = fftsink.fft_sink_c(self, panel, sample_rate=input_rate/sw_decim,
-                                       title="Input %d" % (i,),
-                                       ref_level=80, y_per_div=20)
+            scope = fftsink2.fft_sink_c(panel, sample_rate=input_rate/sw_decim,
+                                        title="Input %d" % (i,),
+                                        ref_level=80, y_per_div=20)
             vbox.Add(scope.win, 10, wx.EXPAND)
 
             if options.filter:
@@ -121,7 +121,7 @@ class my_graph(stdgui.gui_flow_graph):
 
 
 def main ():
-    app = stdgui.stdapp(my_graph, "Multi Scope", nstatus=1)
+    app = stdgui2.stdapp(my_graph, "Multi Scope", nstatus=1)
     app.MainLoop()
 
 if __name__ == '__main__':