diff options
author | mleech | 2007-08-01 04:09:50 +0000 |
---|---|---|
committer | mleech | 2007-08-01 04:09:50 +0000 |
commit | 4df7abce00fbd7817ed87d3a2ac8a6be4df35f03 (patch) | |
tree | 40760ab4b92c5b708ea5515f8726531aac6e6cc7 /gr-radio-astronomy/src | |
parent | 1b5ffab02fdeb78b055e8b60371e776f320010ef (diff) | |
download | gnuradio-4df7abce00fbd7817ed87d3a2ac8a6be4df35f03.tar.gz gnuradio-4df7abce00fbd7817ed87d3a2ac8a6be4df35f03.tar.bz2 gnuradio-4df7abce00fbd7817ed87d3a2ac8a6be4df35f03.zip |
Made --notches code more robust--error checks, and it now also "tracks"
frequency changes.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6094 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-radio-astronomy/src')
-rwxr-xr-x | gr-radio-astronomy/src/python/usrp_ra_receiver.py | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/gr-radio-astronomy/src/python/usrp_ra_receiver.py b/gr-radio-astronomy/src/python/usrp_ra_receiver.py index 31475f57c..1e0088301 100755 --- a/gr-radio-astronomy/src/python/usrp_ra_receiver.py +++ b/gr-radio-astronomy/src/python/usrp_ra_receiver.py @@ -341,29 +341,8 @@ class app_flow_graph(stdgui.gui_flow_graph): 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 - - 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) + self.compute_notch_taps(self.notches) + self.notch_filt = gr.fft_filter_ccc(1, self.notch_taps) # # Start connecting configured modules in the receive chain @@ -648,6 +627,10 @@ class app_flow_graph(stdgui.gui_flow_graph): 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 @@ class app_flow_graph(stdgui.gui_flow_graph): 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() |