Sensed spectrum in dB?

Hi All,

I am using USRP+RFX2400+SUSI 10.3.

Many people have already discussed “usrp_spectrum_sense.py” and I read
all
those threads but unfortunately it didnt solve my problem and didnt help
me
to understand the file completely, I have two questions in this file and
will be thankful if some one can help me.

First, what is in m.data???

First, what the following piece of code is doing??? Is it converting
m.data
to power in dB?? If not please help me to find how this code can be
changed
so that I get power dB at any given center frequency.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
power = 0
for tap in mywindow:
power += tap*tap

    c2mag = gr.complex_to_mag_squared(self.fft_size)

    # FIXME the log10 primitive is dog slow
    log = gr.nlog10_ff(10, self.fft_size,

-20math.log10(self.fft_size)-10math.log10(power/self.fft_size))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Best Regards

Kaleem Ahmad

View this message in context:
http://www.nabble.com/sensed-spectrum-in-dB----tp19607819p19607819.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Mon, Sep 22, 2008 at 9:19 AM, kaleem ahmad [email protected]
wrote:

First, what is in m.data???

   # FIXME the log10 primitive is dog slow
   log = gr.nlog10_ff(10, self.fft_size,

-20math.log10(self.fft_size)-10math.log10(power/self.fft_size))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

It sure looks like it’s calculating power in dB with all those
log10’s. A quick Googling led me here for a discussion on FIR filters
and normalization:

http://www.hydrogenaudio.org/forums/index.php?showtopic=43195

Good luck!

Brian

Thanks Brian,

But I am still confused what this code is doing:

    power = 0
    for tap in mywindow:
        power += tap*tap

    # FIXME the log10 primitive is dog slow
    log = gr.nlog10_ff(10, self.fft_size,

-20math.log10(self.fft_size)-10math.log10(power/self.fft_size))

Especially why this factor
“20math.log10(self.fft_size)-10math.log10(power/self.fft_size)” is
used???

moreover nlog10_ff block actually computes → n*log10(input) + k, can
someone explain what this k is doing and how can we compare this
formulae to
traditional dB formulae i.e. 10log(input), or 20log(input).

Best Regards

Brian P. wrote:

those threads but unfortunately it didnt solve my problem and didnt help
so that I get power dB at any given center frequency.
-20math.log10(self.fft_size)-10math.log10(power/self.fft_size))
Brian


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://www.nabble.com/sensed-spectrum-in-dB----tp19607819p19627817.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Tue, Sep 23, 2008 at 9:35 AM, kaleem ahmad [email protected]
wrote:

   log = gr.nlog10_ff(10, self.fft_size,

-20math.log10(self.fft_size)-10math.log10(power/self.fft_size))

Especially why this factor
“20math.log10(self.fft_size)-10math.log10(power/self.fft_size)” is used???

The loop is calculating the gain of the window and subtracting to
maintain unity.

moreover nlog10_ff block actually computes → n*log10(input) + k, can
someone explain what this k is doing and how can we compare this formulae to
traditional dB formulae i.e. 10log(input), or 20log(input).

I haven’t read the code, but I suspect it’s for situations as stated
above.

Brian

PS - Top posting is a little bit of a waste of bandwidth. Please try
some inline posting as it maintains a bit more clarity:

http://en.wikipedia.org/wiki/Posting_style