discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] output of gr.argmax & gr.max?


From: Brook Lin
Subject: [Discuss-gnuradio] output of gr.argmax & gr.max?
Date: Tue, 11 Mar 2008 21:46:44 -0700 (PDT)

Hi All,

I tried to access the output of FFT by using self.dst1 = gr.vector_sink_s()
and use gr.argmax_fs(self.fft_size) to find the index of the maximum value. 
However, I can not get the output, dst1.data(). I attached the code below.
Actually, I also want to find the maximum value using dst2 =
gr.vector_sink_f() and valmax = gr.max_ff(self.fft_size), but it doesn't
work. Can anyone help me with this?

Thanks,
Brook

###### start ##########                 
self.s2p = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,max(1,
int(input_rate/self.fft_size/self.fft_size)))
mywindow = window.blackmanharris(self.fft_size)
self.fft = gr.fft_vcc(self.fft_size, True, mywindow)
power = 0
for tap in mywindow:
    power += tap*tap
self.c2mag = gr.complex_to_mag(self.fft_size)
self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
# FIXME  We need to add 3dB to all bins but the DC bin
self.log = gr.nlog10_ff(20,
self.fft_size,-20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size))
self.dst1 = gr.vector_sink_s()# (gr.sizeof_short, "out1.txt")
argmax = gr.argmax_fs(self.fft_size)
#dst2 = gr.vector_sink_f()      
#valmax = gr.max_ff(self.fft_size)
self.connect(self.u, self.s2p, self.one_in_n, self.fft, self.c2mag,
self.avg, self.log)
self.connect(self.log, (argmax, 0))
self.connect((argmax, 0), self.dst1)
#self.connect(self.log, (valmax, 0))
#self.connect((valmax, 0), dst2)
self.index = dst1.data()
print 'index AAA', self.index   however, the output is printed out like
index AAA (), why I can not get the exact number
#####end################################################
-- 
View this message in context: 
http://www.nabble.com/output-of-gr.argmax---gr.max--tp15997864p15997864.html
Sent from the GnuRadio mailing list archive at Nabble.com.





reply via email to

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