discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] waterfall_sink_c correction


From: James Smith
Subject: [Discuss-gnuradio] waterfall_sink_c correction
Date: Mon, 8 Aug 2005 10:05:51 -0700 (PDT)

Hi All,
I don't know how many people have used
waterfall_sink_c, but when I used it I noticed that
the spectrum was split up at 0.
| +    ++      +++ | ---    --    - |
instead of
| ---     --     - 0 +    ++    +++ |
which is how fft_sink_c displays it. 


I made the changes below to correct this.  I have
attached a corrected version of waterfallsink.py for
convenience.

James


        if self.fftsink.input_is_real:     # only plot
1/2 the points
            d_max = L/2
            p_width = 2
        else:
            d_max = L/2
            p_width = 1

        if self.fftsink.input_is_real:     # real fft
           for x_pos in range(0, d_max):
               value = int(dB[x_pos] * 5.0) #adjust
constant here for gain control
               if value > 255:
                  value = 255
               elif value < 0:
                  value = 0
               dc1.SetPen(self.pens[value])
               dc1.DrawRectangle(x_pos*p_width, 0,
p_width, 1) 
        else:                               # complex
fft
           for x_pos in range(0, d_max):
               value = int(dB[x_pos] * 5.0) #adjust
constant here for gain control
               if value > 255:
                  value = 255
               elif value < 0:
                  value = 0
               dc1.SetPen(self.pens[value])
               dc1.DrawRectangle(x_pos*p_width +
d_max, 0, p_width, 1) 
           for x_pos in range(0 , d_max):
               value = int(dB[x_pos+d_max] * 5.0)
#adjust constant here for gain control
               if value > 255:
                  value = 255
               elif value < 0:
                  value = 0
               dc1.SetPen(self.pens[value])
               dc1.DrawRectangle(x_pos*p_width, 0,
p_width, 1) 

        self.DoDrawing (None)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Attachment: waterfallsink.py
Description: 2136063517-waterfallsink.py


reply via email to

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