diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-09-04 02:43:56 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-09-04 02:43:56 +0000 |
commit | 54d6b9281dc233e0b2acf26884073d973b7663de (patch) | |
tree | 15cd1fa40207e68c5035a50fd7d54536831c4599 /gnuradio-examples/python/usrp/am_rcv.py | |
parent | 2c37e57fe4626ac30eb8c042e4d7daf64a0d45f5 (diff) |
Merged r6271:6278 from jcorgan/t182 into trunk. Implements ticket:182.
Created new top-level component, gr-utils, to hold commonly used utility
scripts (originally in gnuradio-examples). These now install into the
system path, allowing their use from wherever.
Reorganization of gnuradio-examples component:
* Commonly used utility scripts moved from python/usrp into gr-utils.
* Examples now install into $(prefix)/share/gnuradio/examples/...
* Channel coding examples moved into gr-trellis/src/examples, now install
from there, only if gr-atsc itself is going to built and installed.
* ATSC example scripts now install into example hierarchy
* Cruft has been moved into 'limbo' in repository, do not get installed
Trunk passes 'make distcheck'.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6279 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-examples/python/usrp/am_rcv.py')
-rwxr-xr-x | gnuradio-examples/python/usrp/am_rcv.py | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/gnuradio-examples/python/usrp/am_rcv.py b/gnuradio-examples/python/usrp/am_rcv.py deleted file mode 100755 index 2908dcbf54..0000000000 --- a/gnuradio-examples/python/usrp/am_rcv.py +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, eng_notation -from gnuradio import audio -from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys -import math - -from gnuradio.wxgui import stdgui, fftsink -import wx - -class am_rx_graph (stdgui.gui_flow_graph): - def __init__(self,frame,panel,vbox,argv): - stdgui.gui_flow_graph.__init__ (self,frame,panel,vbox,argv) - - station = parseargs(argv[1:]) - offset_freq = 30e3 - IF_freq = offset_freq - station - - adc_rate = 64e6 - usrp_decim = 250 - if_rate = adc_rate / usrp_decim # 256 kHz - if_decim = 4 - demod_rate = if_rate / if_decim # 64 kHz - audio_decimation = 2 - audio_rate = demod_rate / audio_decimation # 16 kHz - - # usrp is data source - src = usrp.source_c (0, usrp_decim) - src.set_rx_freq (0, IF_freq) - actual_IF_freq =src.rx_freq(0) - actual_offset = actual_IF_freq + station - - #print actual_IF_freq - #print actual_offset - - src.set_pga(0,20) - # sound card as final sink - audio_sink = audio.sink (int (audio_rate)) - - channel_coeffs = \ - gr.firdes.low_pass (1.0, # gain - if_rate, # sampling rate - 9e3, # low pass cutoff freq - 10e3, # width of trans. band - gr.firdes.WIN_HANN) - - ddc = gr.freq_xlating_fir_filter_ccf (if_decim,channel_coeffs,-actual_offset,if_rate) - - magblock = gr.complex_to_mag() - volumecontrol = gr.multiply_const_ff(.003) - - # Deemphasis. Is this necessary on AM? - TAU = 75e-6 # 75us in US, 50us in EUR - fftaps = [ 1 - math.exp(-1/TAU/if_rate), 0] - fbtaps= [ 0 , math.exp(-1/TAU/if_rate) ] - - deemph = gr.iir_filter_ffd(fftaps,fbtaps) - - # compute FIR filter taps for audio filter - width_of_transition_band = audio_rate / 8 - audio_coeffs = gr.firdes.low_pass (1.0, # gain - if_rate, # sampling rate - 9e3, #audio_rate/2 - width_of_transition_band, - 4e3, # width_of_transition_band, - gr.firdes.WIN_HANN) - - # input: float; output: float - audio_filter = gr.fir_filter_fff (audio_decimation, audio_coeffs) - - - - - print len(channel_coeffs) - print len(audio_coeffs) - - # now wire it all together - self.connect (src, ddc) - self.connect (ddc, magblock) - self.connect (magblock, volumecontrol) - self.connect (volumecontrol,deemph) - self.connect (deemph,audio_filter) - self.connect (audio_filter, (audio_sink, 0)) - - if 1: - pre_demod = fftsink.fft_sink_c (self, panel, title="Pre-Demodulation", fft_size=128, sample_rate=if_rate) - self.connect (src, pre_demod) - vbox.Add (pre_demod.win, 1, wx.EXPAND) - - if 0: - post_demod = fftsink.fft_sink_c (self, panel, title="Post Demodulation", fft_size=256, sample_rate=demod_rate) - self.connect (ddc, post_demod) - vbox.Add (post_demod.win, 1, wx.EXPAND) - - if 0: - post_filt = fftsink.fft_sink_f (self, panel, title="Post Filter", fft_size=512, sample_rate=audio_rate) - self.connect (magblock,post_filt) - vbox.Add (post_filt.win, 1, wx.EXPAND) - -def parseargs (args): - nargs = len (args) - if nargs == 1: - freq1 = float (args[0]) * 1e3 - else: - sys.stderr.write ('usage: am_rcv freq1\n') - sys.exit (1) - - return freq1 - -if __name__ == '__main__': - app = stdgui.stdapp (am_rx_graph, "AM RX") - app.MainLoop () - |