Question on output of FFT block

Hi All,

I am not familiar with Python. I got confused on the output of FFT
block. I
can record the raw data coming to the USRP. However, I also need the
data
coming outof FFT block. For example, when usrp_fft.py is running, it
calls
fftsink2.py and give the spectrum plot. I found that in class fft_window
in
fftsink2.py file, def set_data() gives the data after FFT block, which
is
points[:,1]. Am I right? How can I show the maximum value of points[:,1]
in
status bar of FFT_GUI window?

If I change the def set_data() which I attached below, I can print that
max
value in the terminal, but I can not update the frequency from GUI
window.
Can I do both things, updating freq and updating the max(points[:,1])
value
in GUI status bar not the terminal?

I also tried adding a vector sink in class fft_sink_c,
self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag,
self.avg,
self.log, self.sink)

    self.win = fft_window(self, parent, size=size)
    self.set_average(self.average)

self.dst2 = gr.vector_sink_f ()
self.connect(self.log, self.dst2)
However, it doesn’t work.

I was stcuk here for a long time. If anyone can help me with this
question,
I really appreciate!

Brook
##############
def set_data (self, evt):
dB = evt.data
L = len (dB)

    if self.peak_hold:
        if self.peak_vals is None:
            self.peak_vals = dB
        else:
            self.peak_vals = numpy.maximum(dB, self.peak_vals)
            dB = self.peak_vals

    x = max(abs(self.fftsink.sample_rate),

abs(self.fftsink.baseband_freq))
#if x >= 1e9:
# sf = 1e-9
# units = “GHz”
if x >= 1e6: #elif
sf = 1e-6
units = “MHz”
else:
sf = 1e-3
units = “kHz”

    if self.fftsink.input_is_real:     # only plot 1/2 the points
        x_vals = ((numpy.arange (L/2)
                   * (self.fftsink.sample_rate * sf / L))
                  + self.fftsink.baseband_freq * sf)
        points = numpy.zeros((len(x_vals), 2), numpy.float64)
        points[:,0] = x_vals
        points[:,1] = dB[0:L/2]
    else:
        # the "negative freqs" are in the second half of the array
        x_vals = ((numpy.arange (-L/2, L/2)
                   * (self.fftsink.sample_rate * sf / L))
                  + self.fftsink.baseband_freq * sf)
        points = numpy.zeros((len(x_vals), 2), numpy.float64)
        points[:,0] = x_vals
        points[:,1] = numpy.concatenate ((dB[L/2:], dB[0:L/2]))
    lines = plot.PolyLine (points, colour='BLUE')

    graphics = plot.PlotGraphics ([lines],
                                  title=self.fftsink.title,
                                  xLabel = units, yLabel = "dB")

    self.Draw (graphics, xAxis=None, yAxis=self.y_range)
    self.update_y_range ()

allpoints=[]
allpoints=points[:,1]

#print ‘x_vals’,x_vals, len(x_vals)
print ‘points’,allpoints, len(allpoints)
print ‘max_point’,max(allpoints)

mag_max=0
for idx in range(len(allpoints)):
if allpoints[idx]>mag_max:
mag_max = allpoints[idx]
idx_mag_max = idx
print 'mag_max is ', mag_max
print 'ndx_mag_max is ', idx_mag_max
deltafreq = (2e6)(256(512**(-1)))
if mag_max>10:
print ‘There is a signal @ delta’,deltafreq/1e6, ‘MHz’
###########################

View this message in context:
http://www.nabble.com/Question-on-output-of-FFT-block-tp15951020p15951020.html
Sent from the GnuRadio mailing list archive at Nabble.com.