commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4459 - gnuradio/branches/developers/nldudok1/general-


From: nldudok1
Subject: [Commit-gnuradio] r4459 - gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna
Date: Mon, 12 Feb 2007 15:15:51 -0700 (MST)

Author: nldudok1
Date: 2007-02-12 15:15:51 -0700 (Mon, 12 Feb 2007)
New Revision: 4459

Added:
   
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff.py
   
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff_fm.py
   
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/multi_phasediff.py
Modified:
   
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/Makefile.am
Log:
added examples which graphically show phasediff between multi-antennas

Modified: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/Makefile.am
        2007-02-12 21:55:06 UTC (rev 4458)
+++ 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/Makefile.am
        2007-02-12 22:15:51 UTC (rev 4459)
@@ -22,4 +22,7 @@
 EXTRA_DIST =           \
     multi_fft.py       \
     multi_file.py      \
-    multi_scope.py
+    multi_scope.py     \
+    multi_phasediff.py \
+    double_phasediff.py        \
+    double_phasediff_fm.py

Added: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff.py
===================================================================
--- 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff.py
                                (rev 0)
+++ 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff.py
        2007-02-12 22:15:51 UTC (rev 4459)
@@ -0,0 +1,158 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, eng_notation
+from gnuradio import usrp
+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, 
numbersink,form, slider
+import wx
+import usrp_dbid
+import time
+import os.path
+import sys
+
+from math import *
+
+# required FPGA that can do 4 rx channels.
+
+
+class my_graph(stdgui.gui_flow_graph):
+
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui.gui_flow_graph.__init__(self)
+
+        self.frame = frame
+        self.panel = panel
+
+        parser = OptionParser (option_class=eng_option)
+        #parser.add_option("-S", "--subdev", type="subdev", default=(0, None),
+        #                  help="select USRP Rx side A or B (default=A)")
+        parser.add_option("-d", "--decim", type="int", default=128,
+                          help="set fgpa decimation rate to DECIM 
[default=%default]")
+        parser.add_option("-f", "--freq", type="eng_float", default=146.585e6,
+                          help="set frequency to FREQ [default=%default])", 
metavar="FREQ")
+        parser.add_option("-g", "--gain", type="eng_float", default=20,
+                          help="set gain in dB [default=%default]")
+        parser.add_option("-F", "--filter", action="store_true", default=True,
+                          help="Enable channel filter")
+        (options, args) = parser.parse_args()
+
+        if len(args) != 0:
+            parser.print_help()
+            raise SystemExit
+
+        nchan = 2
+
+        if options.filter:
+            sw_decim = 4
+        else:
+            sw_decim = 1
+
+        self.u = usrp.source_c(0, options.decim)#, 
fpga_filename="std_4rx_0tx.rbf")
+        if self.u.nddc() < nchan:
+            sys.stderr.write('This code requires an FPGA build with %d DDCs.  
This FPGA has only %d.\n' % (
+                nchan, self.u.nddc()))
+            raise SystemExit
+                             
+        if not self.u.set_nchannels(nchan):
+            sys.stderr.write('set_nchannels(%d) failed\n' % (nchan,))
+            raise SystemExit
+        
+        input_rate = self.u.adc_freq() / self.u.decim_rate()
+        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]
+
+        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):
+            sys.stderr.write('This code requires a Basic Rx board on Sides A & 
B\n')
+            sys.exit(1)
+
+        self.u.set_mux(gru.hexint(0xf2f0f2f0))
+
+        # deinterleave four channels from FPGA
+        di = gr.deinterleave(gr.sizeof_gr_complex)
+
+        self.connect(self.u, di)
+        
+        # our destination (8 float inputs)
+        #self.scope = scopesink.scope_sink_f(self, panel, 
sample_rate=input_rate/sw_decim)
+
+        # taps for channel filter
+        chan_filt_coeffs = optfir.low_pass (1,           # gain
+                                            input_rate,  # sampling rate
+                                            80e3,        # passband cutoff
+                                            115e3,       # stopband cutoff
+                                            0.1,         # passband ripple
+                                            60)          # stopband attenuation
+        #print len(chan_filt_coeffs)
+        conj=gr.conjugate_cc()
+
+        # bust the deinterleaved complex channels into floats
+        for i in range(nchan):
+          if 0==i:
+            if options.filter:
+              chan_filt = gr.fir_filter_ccf(sw_decim, chan_filt_coeffs)
+              self.connect((di, 0),chan_filt,conj)
+            else:
+              self.connect((di, 0),conj)
+          else:
+            mult=gr.multiply_cc()
+            arg=gr.complex_to_arg()
+            if options.filter:
+                chan_filt = gr.fir_filter_ccf(sw_decim, chan_filt_coeffs)
+                self.connect(conj,(mult,0))
+                self.connect((di, i), chan_filt, (mult,1))
+                self.connect(mult,arg)
+            else:
+                self.connect(conj,(mult,0))
+                self.connect((di, i), (mult,1))
+                self.connect(mult,arg)
+
+            numsink = numbersink.number_sink_f (self, panel, 
unit='degrees',label="phasediff", avg_alpha=1.0e-5,average=True,
+                          sample_rate=input_rate/sw_decim, 
factor=360.0/(2.0*pi),base_value=0,
+                          minval=-180.0,maxval=180.0,
+                          ref_level=0, decimal_places=5,number_rate=15)
+            vbox.Add (numsink.win, 1, wx.EXPAND)
+            self.connect(arg,numsink)
+
+            #self.connect((c2f, 0), (self.scope, 2*i + 0))
+            #self.connect((c2f, 1), (self.scope, 2*i + 1))
+
+
+        #self._build_gui(vbox)
+
+        self.set_gain(options.gain)
+        self.set_freq(options.freq)
+
+    def set_gain(self, gain):
+        for i in range(len(self.subdev)):
+            self.subdev[i].set_gain(gain)
+
+    def set_freq(self, target_freq):
+        ok = True
+        for i in range(len(self.subdev)): #we just tune all (max 4 ) subdevs 
and channels to the same freq 
+            print i
+            r = usrp.tune(self.u, i, self.subdev[i], target_freq)
+            if not r:
+                ok = False
+                print "set_freq: failed to set subdev[%d] freq to %f" % (
+                    i, target_freq)
+        return ok
+
+
+    def _build_gui(self, vbox):
+        vbox.Add(self.scope.win, 10, wx.EXPAND)
+        
+
+
+def main ():
+    app = stdgui.stdapp(my_graph, "Multi Antenna phase diff", nstatus=1)
+    app.MainLoop()
+
+if __name__ == '__main__':
+    main ()


Property changes on: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff.py
___________________________________________________________________
Name: svn:executable
   + *

Added: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff_fm.py
===================================================================
--- 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff_fm.py
                             (rev 0)
+++ 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff_fm.py
     2007-02-12 22:15:51 UTC (rev 4459)
@@ -0,0 +1,233 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, eng_notation
+from gnuradio import usrp
+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, 
numbersink,form, slider
+import wx
+import usrp_dbid
+import time
+import os.path
+import sys
+
+
+from gnuradio import usrp1              # usrp Rev 1 and later
+from gnuradio import blks
+import usrp_prims
+
+from math import *
+
+# required FPGA that can do 4 rx channels.
+
+
+class my_graph(stdgui.gui_flow_graph):
+
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui.gui_flow_graph.__init__(self)
+
+        self.frame = frame
+        self.panel = panel
+        
self.freqs=[88.1,88.7,92.6,94.3,95,96.8,97.5,98.9,100.1,100.7,101.2,102.1,103,104.4,105.9,107.9]
+        self.freq_index=0
+        parser = OptionParser (option_class=eng_option)
+        #parser.add_option("-S", "--subdev", type="subdev", default=(0, None),
+        #                  help="select USRP Rx side A or B (default=A)")
+        parser.add_option("-d", "--decim", type="int", default=128,
+                          help="set fgpa decimation rate to DECIM 
[default=%default]")
+        #parser.add_option("-f", "--freq", type="eng_float", default=146.585e6,
+        #                  help="set frequency to FREQ [default=%default])", 
metavar="FREQ")
+        parser.add_option("-g", "--gain", type="eng_float", default=20,
+                          help="set gain in dB [default=%default]")
+        parser.add_option("-F", "--filter", action="store_true", default=True,
+                          help="Enable channel filter")
+        (options, args) = parser.parse_args()
+
+        if len(args) != 0:
+            parser.print_help()
+            raise SystemExit
+
+        nchan = 2
+
+        if options.filter:
+            sw_decim = 4
+        else:
+            sw_decim = 1
+
+        #self.u = usrp.source_c(0, options.decim)#, 
fpga_filename="std_4rx_0tx.rbf")
+        self.u = usrp.source_c(0, options.decim, 
fpga_filename="multi_2rxhb_2tx.rbf")
+        if self.u.nddc() < nchan:
+            sys.stderr.write('This code requires an FPGA build with %d DDCs.  
This FPGA has only %d.\n' % (
+                nchan, self.u.nddc()))
+            raise SystemExit
+                             
+        if not self.u.set_nchannels(nchan):
+            sys.stderr.write('set_nchannels(%d) failed\n' % (nchan,))
+            raise SystemExit
+        
+        input_rate = self.u.adc_freq() / self.u.decim_rate()
+        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]
+
+        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):
+            sys.stderr.write('This code requires a Basic Rx board on Sides A & 
B\n')
+            sys.exit(1)
+
+        self.u.set_mux(gru.hexint(0xf2f0f2f0))
+
+        # deinterleave four channels from FPGA
+        di = gr.deinterleave(gr.sizeof_gr_complex)
+
+        self.connect(self.u, di)
+        
+        # our destination (8 float inputs)
+        #self.scope = scopesink.scope_sink_f(self, panel, 
sample_rate=input_rate/sw_decim)
+
+        # taps for channel filter
+        chan_filt_coeffs = optfir.low_pass (1,           # gain
+                                            input_rate,  # sampling rate
+                                            80e3,        # passband cutoff
+                                            115e3,       # stopband cutoff
+                                            0.1,         # passband ripple
+                                            60)          # stopband attenuation
+        #print len(chan_filt_coeffs)
+        conj=gr.conjugate_cc()
+
+        # bust the deinterleaved complex channels into floats
+        for i in range(nchan):
+          if 0==i:
+            if options.filter:
+              chan_filt = gr.fir_filter_ccf(sw_decim, chan_filt_coeffs)
+              self.connect((di, 0),chan_filt,conj)
+            else:
+              self.connect((di, 0),conj)
+          else:
+            mult=gr.multiply_cc()
+            arg=gr.complex_to_arg()
+            mag=gr.complex_to_mag()
+            if options.filter:
+                chan_filt = gr.fir_filter_ccf(sw_decim, chan_filt_coeffs)
+                self.connect(conj,(mult,0))
+                self.connect((di, i), chan_filt, (mult,1))
+            else:
+                self.connect(conj,(mult,0))
+                self.connect((di, i), (mult,1))
+            self.connect(mult,arg)
+            self.connect(mult,mag)
+            self.numsink = numbersink.number_sink_f (self, panel, 
unit='degrees',label="phasediff", avg_alpha=1.0e-5,average=True,
+                          sample_rate=input_rate/sw_decim, 
factor=360.0/(2.0*pi),base_value=0,
+                          minval=-180.0,maxval=180.0,
+                          ref_level=0, decimal_places=5,number_rate=15)
+            vbox.Add (self.numsink.win, 1, wx.EXPAND)
+            self.connect(arg,self.numsink)
+            self.numsink_mag = numbersink.number_sink_f (self, panel, 
unit='magnitude',label="magnitude of cross-corr", avg_alpha=1.0e-5,average=True,
+                          sample_rate=input_rate/sw_decim, 
factor=1.0,base_value=0,
+                          minval=0.0,maxval=5000.0,
+                          ref_level=0, decimal_places=5,number_rate=15)
+            self.connect(mag,self.numsink_mag)
+            vbox.Add (self.numsink_mag.win, 1, wx.EXPAND)
+            #self.connect((c2f, 0), (self.scope, 2*i + 0))
+            #self.connect((c2f, 1), (self.scope, 2*i + 1))
+
+        vbox.Add(self.make_control_box(panel), 1, wx.EXPAND)
+        #self._build_gui(vbox)
+
+        self.set_gain(options.gain)
+        self.set_freq(self.freqs[0]*1.0e6)
+        self.last_time=time.time()
+        frame.Bind(wx.EVT_IDLE, self.onIdle)
+
+    def onIdle(self,evt):
+        if time.time() > self.last_time+10.0: #next freq every 10 seconds
+           self.next_freq(None)
+           self.last_time=time.time()
+
+    def make_control_box (self,panel):
+        ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+        self.print_button = wx.Button (panel, 1101, " print ", 
style=wx.BU_EXACTFIT)
+        self.print_button.SetToolTipString ("Print current value to stdout")
+        wx.EVT_BUTTON (panel, 1101, self.print_value) # ID matches button ID 
above
+
+        self.next_button  = wx.Button (panel, 1100, " > ", 
style=wx.BU_EXACTFIT)
+        self.next_button.SetToolTipString ("Go to next freq")
+        wx.EVT_BUTTON (panel, 1100, self.next_freq)
+
+        #self.v_scale_label = wx.StaticText (self, 1002, "None") # vertical 
/div
+        #self.update_v_scale_label ()
+
+        #self.autorange_checkbox = wx.CheckBox (self, 1102, "Autorange")
+        #self.autorange_checkbox.SetToolTipString ("Select autorange on/off")
+        #wx.EVT_CHECKBOX(self, 1102, self.autorange_checkbox_event)
+
+        ctrlbox.Add ((5,0) ,0) # left margin space
+        ctrlbox.Add (self.print_button, 0, wx.EXPAND)
+        ctrlbox.Add (self.next_button, 0, wx.EXPAND)
+        #ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER)
+        ctrlbox.Add ((20,0) ,0) # spacer
+        #ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER)
+
+        return ctrlbox
+
+    def print_value(self,evt):
+        self.numsink.print_current_value(self.current_freq/1e6)
+        print "----"
+        self.numsink_mag.print_current_value(self.current_freq)
+
+    def next_freq(self,evt):
+        self.print_value(None)
+        self.freq_index=self.freq_index+1
+        if(self.freq_index>=len(self.freqs)):
+           self.freq_index=0
+        self.set_freq((self.freqs[self.freq_index])*1.0e6)
+        self.sync1()
+
+    def set_gain(self, gain):
+        for i in range(len(self.subdev)):
+            self.subdev[i].set_gain(gain)
+
+    def sync1(self):
+        #abuse the multi_usrp code to sync the phases of the channels after 
the freqs have been set
+        result=False
+        result = self.u._u._write_fpga_reg_masked 
(usrp_prims.FR_RX_MASTER_SLAVE, usrp_prims.bmFR_RX_SYNC, 
usrp_prims.bmFR_RX_SYNC )
+        #There should be a small delay here, but the time it takes to get the 
sync to the usrp is long enough
+        #turn sync pulse off
+        result  = result & self.u._u._write_fpga_reg_masked 
(usrp_prims.FR_RX_MASTER_SLAVE,0 ,usrp_prims.bmFR_RX_SYNC);
+        return result;
+
+    def sync2(self):
+        #sync the phases of the channels by stopping and starting the flowgraph
+        self.frame.flow_graph().stop()
+        #time.sleep(1.0)
+        self.frame.flow_graph().start()
+        return True
+
+    def set_freq(self, target_freq):
+        ok = True
+        for i in range(len(self.subdev)): #we just tune all (max 4 ) subdevs 
and channels to the same freq 
+            r = usrp.tune(self.u, i, self.subdev[i], target_freq)
+            if not r:
+                ok = False
+                print "set_freq: failed to set subdev[%d] freq to %f" % (
+                    i, target_freq)
+        self.current_freq=target_freq
+        return ok
+
+
+    def _build_gui(self, vbox):
+        vbox.Add(self.scope.win, 10, wx.EXPAND)
+        
+
+
+def main ():
+    app = stdgui.stdapp(my_graph, "Multi Antenna phase diff", nstatus=1)
+    app.MainLoop()
+
+if __name__ == '__main__':
+    main ()


Property changes on: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/double_phasediff_fm.py
___________________________________________________________________
Name: svn:executable
   + *

Added: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/multi_phasediff.py
===================================================================
--- 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/multi_phasediff.py
                         (rev 0)
+++ 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/multi_phasediff.py
 2007-02-12 22:15:51 UTC (rev 4459)
@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, gru, eng_notation
+from gnuradio import usrp
+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, 
numbersink,form, slider
+import wx
+import usrp_dbid
+import time
+import os.path
+import sys
+
+# required FPGA that can do 4 rx channels.
+
+
+class my_graph(stdgui.gui_flow_graph):
+
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui.gui_flow_graph.__init__(self)
+
+        self.frame = frame
+        self.panel = panel
+
+        parser = OptionParser (option_class=eng_option)
+        #parser.add_option("-S", "--subdev", type="subdev", default=(0, None),
+        #                  help="select USRP Rx side A or B (default=A)")
+        parser.add_option("-d", "--decim", type="int", default=128,
+                          help="set fgpa decimation rate to DECIM 
[default=%default]")
+        parser.add_option("-f", "--freq", type="eng_float", default=146.585e6,
+                          help="set frequency to FREQ [default=%default])", 
metavar="FREQ")
+        parser.add_option("-g", "--gain", type="eng_float", default=20,
+                          help="set gain in dB [default=%default]")
+        parser.add_option("-F", "--filter", action="store_true", default=True,
+                          help="Enable channel filter")
+        (options, args) = parser.parse_args()
+
+        if len(args) != 0:
+            parser.print_help()
+            raise SystemExit
+
+        nchan = 4
+
+        if options.filter:
+            sw_decim = 4
+        else:
+            sw_decim = 1
+
+        self.u = usrp.source_c(0, options.decim, 
fpga_filename="std_4rx_0tx.rbf")
+        if self.u.nddc() < nchan:
+            sys.stderr.write('This code requires an FPGA build with %d DDCs.  
This FPGA has only %d.\n' % (
+                nchan, self.u.nddc()))
+            raise SystemExit
+                             
+        if not self.u.set_nchannels(nchan):
+            sys.stderr.write('set_nchannels(%d) failed\n' % (nchan,))
+            raise SystemExit
+        
+        input_rate = self.u.adc_freq() / self.u.decim_rate()
+        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]
+
+        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):
+            sys.stderr.write('This code requires a Basic Rx board on Sides A & 
B\n')
+            sys.exit(1)
+
+        self.u.set_mux(gru.hexint(0xf3f2f1f0))
+
+        # deinterleave four channels from FPGA
+        di = gr.deinterleave(gr.sizeof_gr_complex)
+
+        self.connect(self.u, di)
+        
+        # our destination (8 float inputs)
+        self.scope = scopesink.scope_sink_f(self, panel, 
sample_rate=input_rate/sw_decim)
+
+        # taps for channel filter
+        chan_filt_coeffs = optfir.low_pass (1,           # gain
+                                            input_rate,  # sampling rate
+                                            80e3,        # passband cutoff
+                                            115e3,       # stopband cutoff
+                                            0.1,         # passband ripple
+                                            60)          # stopband attenuation
+        #print len(chan_filt_coeffs)
+        conj=gr.conjugate_cc()
+
+        # bust the deinterleaved complex channels into floats
+        for i in range(nchan):
+          if 0==i:
+            if options.filter:
+              chan_filt = gr.fir_filter_ccf(sw_decim, chan_filt_coeffs)
+              self.connect((di, 0),chan_filt,conj)
+            else:
+              self.connect((di, 0),conj)
+          else:
+            mult=gr.multiply_cc()
+            arg=gr.complex_to_arg()
+            if options.filter:
+                chan_filt = gr.fir_filter_ccf(sw_decim, chan_filt_coeffs)
+                self.connect(conj,(mult,0))
+                self.connect((di, i), chan_filt, (mult,1))
+                self.connect(mult,arg)
+            else:
+                self.connect(conj,(mult,0))
+                self.connect((di, i), (mult,1))
+                self.connect(mult,arg)
+
+            numsink = numbersink.number_sink_f (self, panel, 
unit='degrees',label="phasediff", avg_alpha=0.001,
+                          sample_rate=input_rate/sw_decim, 
factor=360.0/(2.0*3.141592653589793238463),base_value=0,
+                          ref_level=0, decimal_places=3)
+            vbox.Add (numsink.win, 1, wx.EXPAND)
+            self.connect(arg,numsink)
+
+            #self.connect((c2f, 0), (self.scope, 2*i + 0))
+            #self.connect((c2f, 1), (self.scope, 2*i + 1))
+
+
+        #self._build_gui(vbox)
+
+        self.set_gain(options.gain)
+        self.set_freq(options.freq)
+
+    def set_gain(self, gain):
+        for i in range(len(self.subdev)):
+            self.subdev[i].set_gain(gain)
+
+    def set_freq(self, target_freq):
+        ok = True
+        for i in range(len(self.subdev)):
+            r = usrp.tune(self.u, i, self.subdev[i], target_freq)
+            if not r:
+                ok = False
+                print "set_freq: failed to set subdev[%d] freq to %f" % (
+                    i, target_freq)
+
+        return ok
+
+
+    def _build_gui(self, vbox):
+        vbox.Add(self.scope.win, 10, wx.EXPAND)
+        
+
+
+def main ():
+    app = stdgui.stdapp(my_graph, "Multi Antenna phase diff", nstatus=1)
+    app.MainLoop()
+
+if __name__ == '__main__':
+    main ()


Property changes on: 
gnuradio/branches/developers/nldudok1/general-wip/gnuradio-examples/python/multi-antenna/multi_phasediff.py
___________________________________________________________________
Name: svn:executable
   + *





reply via email to

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