# About usrp\_spectrum\_sense.py

**URL:** <https://www.ruby-forum.com/t/about-usrp-spectrum-sense-py/190209>\
**Category:** GNU Radio\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/about-usrp-spectrum-sense-py/190209 "2010-06-17T16:22:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lishan\_wh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/edb3f5/32.png) [@lishan\_wh](https://www.ruby-forum.com/u/lishan_wh)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/about-usrp-spectrum-sense-py/190209/1 "2010-06-17T16:22:20Z")

</div>

Hi,

I have some difficulties in unserstanding the statements belowin  
usrp\_spectrum\_sense.py.

fft = gr.fft\_vcc(self.fft\_size, True, mywindow)

power = 0

for tap in my wondow:

```
power += tap*tap

```

What is stored in window and what is tap? Where is the FFT data stored?  
I turned to C++ file gr\_fft\_vcc.cc. And also I can not understand what  
is stored in the out[]? Can anybody help me? Thank you!

---

<div class="post-metadata">

**Author:** ![lishan\_wh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/edb3f5/32.png) [@lishan\_wh](https://www.ruby-forum.com/u/lishan_wh)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/about-usrp-spectrum-sense-py/190209/2 "2010-06-17T16:22:35Z")

</div>

Hey Lishan … or Wh … or whatever your name is…,

The part you posted from usrp\_spectrum\_sense.py is taken from  
gr-wxgui/src/python/fftsink\_nongl.py. There are some comments in the  
code which tries to explain the gr.nlog10\_ff-block: the variable  
“power” is mentioned there.

The window is used to reduce the leakage [1, 2].

You have “self.connect(self.u, s2v, fft, c2mag, stats)”, where “stats”  
is a gr.bin\_statistics\_f block. Thus you find the squared magnitudes  
of the fft data in the msg-queue which “stats” uses.  
gr.bin\_statistics\_f accumulates the incoming data over some time  
(“dwell\_delay”), which results in maximized bins of the squared  
magnitudes: Please have a look at  
gnuradio-core/src/lib/general/gr\_bin\_statistics\_f.cc

Regards,  
Gregor

[1] [http://en.wikipedia.org/wiki/Spectral\_leakage](http://en.wikipedia.org/wiki/Spectral_leakage)  
[2] [http://www.ee.iitm.ac.in/~nitin/\_media/ee462/fftwindows.pdf](http://www.ee.iitm.ac.in/~nitin/_media/ee462/fftwindows.pdf)

2010/6/14 lishan\_wh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
