diff options
author | n4hy | 2008-07-04 03:05:33 +0000 |
---|---|---|
committer | n4hy | 2008-07-04 03:05:33 +0000 |
commit | 2b77cc7bc535618c4bba6ce1f3d6fa388e843933 (patch) | |
tree | 1bc0fb845745408e1f6ab795bd22f61896e89afa /gr-msdd6000/src/python-examples/msdd_plot_psd.py | |
parent | f658162db53edff09fe4c843e05dc6f02e78adfa (diff) | |
download | gnuradio-2b77cc7bc535618c4bba6ce1f3d6fa388e843933.tar.gz gnuradio-2b77cc7bc535618c4bba6ce1f3d6fa388e843933.tar.bz2 gnuradio-2b77cc7bc535618c4bba6ce1f3d6fa388e843933.zip |
This completes the msdd6000 update with all example code and other utilities
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8786 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-msdd6000/src/python-examples/msdd_plot_psd.py')
-rwxr-xr-x | gr-msdd6000/src/python-examples/msdd_plot_psd.py | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/gr-msdd6000/src/python-examples/msdd_plot_psd.py b/gr-msdd6000/src/python-examples/msdd_plot_psd.py new file mode 100755 index 000000000..16869af1c --- /dev/null +++ b/gr-msdd6000/src/python-examples/msdd_plot_psd.py @@ -0,0 +1,74 @@ +#!/usr/bin/python + +address = "10.45.4.43"; +fc = 3.5; +decim = 8; +num_avg = 10 + +fs = 102.4; +packet_size=1400; +gain = 0; +port = 10001; + +import math; +import time; +import Numeric; +from gnuradio import msdd,gr,window,wimax; +from pylab import *; + +src = msdd.source_simple(address, port) # build source object + +fft_size = 2048; + +w = window.blackmanharris(fft_size); +s2v = gr.stream_to_vector(2*gr.sizeof_float, fft_size); +fft = gr.fft_vcc(fft_size, True, w, True); +conj = wimax.conj_vcc(fft_size); +mul = gr.multiply_vcc(fft_size); +norm = wimax.norm_cf(); +avg = wimax.average_vXX(gr.sizeof_float, 2*fft_size, num_avg); +v2s = gr.vector_to_stream(2*gr.sizeof_float, fft_size); +#sink = gr.vector_sink_f(); + +src.set_decim_rate(decim); + +src.set_pga(0,gain); +src.set_rx_freq(0,fc); + +q = gr.msg_queue(fft_size); +sink = gr.message_sink(gr.sizeof_float, q, True); + +tb = gr.top_block(); +tb.connect(src,s2v,fft,(mul,0),avg,v2s,norm,sink); +tb.connect(fft,conj,(mul,1)); + +tb.start(); + +print "running" + +v = [] +x = []; + +bw = fs/(pow(2,decim)); +for i in range(0,fft_size): + norm_freq = (i - fft_size/2.0)/fft_size; + bin_frequency = fc + norm_freq * bw; + x.append( norm_freq ); + + + +for i in range(0,fft_size): + + d = q.delete_head(); + d = d.to_string(); + d = Numeric.fromstring(d, Numeric.Float32); + d = 10*log10(d); + + print "plotting\n"; + plot(x,d); + show(); + print "done\n" + + + + |