commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6094 - gnuradio/trunk/gr-radio-astronomy/src/python


From: mleech
Subject: [Commit-gnuradio] r6094 - gnuradio/trunk/gr-radio-astronomy/src/python
Date: Tue, 31 Jul 2007 22:09:51 -0600 (MDT)

Author: mleech
Date: 2007-07-31 22:09:50 -0600 (Tue, 31 Jul 2007)
New Revision: 6094

Modified:
   gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py
Log:
Made --notches code more robust--error checks, and it now also "tracks"
  frequency changes.


Modified: gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py
===================================================================
--- gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py    
2007-07-31 22:09:18 UTC (rev 6093)
+++ gnuradio/trunk/gr-radio-astronomy/src/python/usrp_ra_receiver.py    
2007-08-01 04:09:50 UTC (rev 6094)
@@ -341,30 +341,9 @@
             self.cal_offs = gr.add_const_ff(self.calib_offset*4000);
 
             if self.use_notches == True:
-                NOTCH_TAPS = 256
-                tmptaps = Numeric.zeros(NOTCH_TAPS,Numeric.Complex64)
-                binwidth = self.bw / NOTCH_TAPS
+                self.compute_notch_taps(self.notches)
+                self.notch_filt = gr.fft_filter_ccc(1, self.notch_taps)
 
-                for i in range(0,NOTCH_TAPS):
-                    tmptaps[i] = complex(1.0,0.0)
-
-                for i in self.notches:
-                    diff = i - self.observing
-                    if i == 0:
-                        break
-                    if (diff > 0):
-                        idx = diff / binwidth
-                        idx = idx + 1
-                        tmptaps[int(idx)] = complex(0.0, 0.0)
-                    if (diff < 0):
-                        idx = -diff / binwidth
-                        idx = (NOTCH_TAPS/2) - idx
-                        idx = int(idx+(NOTCH_TAPS/2))
-                        tmptaps[idx] = complex(0.0, 0.0)
-    
-                    self.notch_taps = FFT.inverse_fft(tmptaps)
-                    self.notch_filt = gr.fft_filter_ccc(1, self.notch_taps)
-
         #
         # Start connecting configured modules in the receive chain
         #
@@ -648,6 +627,10 @@
             self.myform['baseband'].set_value(r.baseband_freq)
             self.myform['ddc'].set_value(r.dxc_freq)
 
+            if self.use_notches == True:
+                self.compute_notch_taps(self.notches)
+                self.notch_filt.set_taps(self.notch_taps)
+
             return True
 
         return False
@@ -1026,6 +1009,35 @@
          self.cal_mult.set_k(gain*0.01)
          self.calib_coeff = gain
 
+    def compute_notch_taps(self,notchlist):
+         NOTCH_TAPS = 256
+         tmptaps = Numeric.zeros(NOTCH_TAPS,Numeric.Complex64)
+         binwidth = self.bw / NOTCH_TAPS
+ 
+         for i in range(0,NOTCH_TAPS):
+             tmptaps[i] = complex(1.0,0.0)
+ 
+         for i in notchlist:
+             diff = i - self.observing
+             if i == 0:
+                 break
+             if (diff > 0):
+                 idx = diff / binwidth
+                 idx = int(idx)
+                 if (idx < 0 or idx > (NOTCH_TAPS/2)):
+                     break
+                 tmptaps[idx] = complex(0.0, 0.0)
+
+             if (diff < 0):
+                 idx = -diff / binwidth
+                 idx = (NOTCH_TAPS/2) - idx
+                 idx = int(idx+(NOTCH_TAPS/2))
+                 if (idx < 0 or idx > (NOTCH_TAPS)):
+                     break
+                 tmptaps[idx] = complex(0.0, 0.0)
+
+         self.notch_taps = FFT.inverse_fft(tmptaps)
+
 def main ():
     app = stdgui.stdapp(app_flow_graph, "RADIO ASTRONOMY SPECTRAL/CONTINUUM 
RECEIVER: $Revision$", nstatus=1)
     app.MainLoop()





reply via email to

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