commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11338 - gnuradio/branches/developers/trondeau/pfb/gnu


From: trondeau
Subject: [Commit-gnuradio] r11338 - gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb
Date: Sat, 4 Jul 2009 09:48:19 -0600 (MDT)

Author: trondeau
Date: 2009-07-04 09:48:18 -0600 (Sat, 04 Jul 2009)
New Revision: 11338

Modified:
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/decimate.py
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/interpolate.py
Log:
Using the matplotlib PSD function to plot. Gives a much better representation 
of the power levels. Also setting executable flags.


Property changes on: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/decimate.py
___________________________________________________________________
Added: svn:executable
   + *

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/interpolate.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/interpolate.py
       2009-07-04 11:27:30 UTC (rev 11337)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/interpolate.py
       2009-07-04 15:48:18 UTC (rev 11338)
@@ -75,16 +75,25 @@
         Ns = 10000
         Ne = 10000
 
+        fftlen = 8192
+        winfunc = scipy.blackman
+
         # Plot input signal
         fs = tb._fs
 
         d = tb.snk_i.data()[Ns:Ns+Ne]
-        f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(len(d)))
-        X_in = 10.0*scipy.log10(fftpack.fftshift(fftpack.fft(d)))
         sp1_f = fig1.add_subplot(2, 1, 1)
-        p1_f = sp1_f.plot(f_in, X_in)
-        sp1_f.set_ylim([-50.0, 50.0])
 
+        X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+                           window = lambda d: d*winfunc(fftlen),
+                           visible=False)
+        X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+        f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+        p1_f = sp1_f.plot(f_in, X_in, "b")
+        sp1_f.set_xlim([min(f_in), max(f_in)+1]) 
+        sp1_f.set_ylim([-200.0, 50.0]) 
+
+
         sp1_f.set_title("Input Signal", weight="bold")
         sp1_f.set_xlabel("Frequency (Hz)")
         sp1_f.set_ylabel("Power (dBW)")
@@ -107,12 +116,16 @@
         # Plot output of PFB interpolator
         fs_int = tb._fs*tb._interp
 
+        sp2_f = fig2.add_subplot(2, 1, 1)
         d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)]
-        f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(len(d)))
-        X_o = 10.0*scipy.log10(fftpack.fftshift(fftpack.fft(d)))
-        sp2_f = fig2.add_subplot(2, 1, 1)
-        p2_o = sp2_f.plot(f_o, X_o)
-        sp2_f.set_ylim([-50.0, 50.0])
+        X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+                           window = lambda d: d*winfunc(fftlen),
+                           visible=False)
+        X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+        f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size))
+        p2_f = sp2_f.plot(f_o, X_o, "b")
+        sp2_f.set_xlim([min(f_o), max(f_o)+1]) 
+        sp2_f.set_ylim([-200.0, 50.0]) 
 
         sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold")
         sp2_f.set_xlabel("Frequency (Hz)")
@@ -132,16 +145,26 @@
         sp2_t.set_xlabel("Time (s)")
         sp2_t.set_ylabel("Amplitude")
 
+
         # Plot output of PFB arbitrary resampler
         fs_aint = tb._fs * tb._ainterp
 
+        sp3_f = fig3.add_subplot(2, 1, 1)
         d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)]
-        f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(len(d)))
-        X_o = 10.0*scipy.log10(fftpack.fftshift(fftpack.fft(d)))
-        sp3_f = fig3.add_subplot(2, 1, 1)
-        p3_f = sp3_f.plot(f_o, X_o)
-        sp3_f.set_ylim([-50.0, 50.0])
+        X,freq = sp3_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+                           window = lambda d: d*winfunc(fftlen),
+                           visible=False)
+        X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
+        f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size))
+        p3_f = sp3_f.plot(f_o, X_o, "b")
+        sp3_f.set_xlim([min(f_o), max(f_o)+1]) 
+        sp3_f.set_ylim([-200.0, 50.0]) 
 
+        #f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(len(d)))
+        #X_o = 10.0*scipy.log10(fftpack.fftshift(fftpack.fft(d)))
+        #p3_f = sp3_f.plot(f_o, X_o)
+        #sp3_f.set_ylim([-50.0, 50.0])
+
         sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", 
weight="bold")
         sp3_f.set_xlabel("Frequency (Hz)")
         sp3_f.set_ylabel("Power (dBW)")


Property changes on: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-examples/python/pfb/interpolate.py
___________________________________________________________________
Added: svn:executable
   + *





reply via email to

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