M.data in usrp_spectrum_sense.py

I have been running usrp_spectrum_sense.py for hours now and I cannot
figure out where it is getting its power_db from. I narrowed it down to
m.data. My end goal is to have the program scan frequencies from a
list that I have created and output its power. usrp_spectrum_sense.py
frequencies in a range and I have been successful in reading a file of
known frequencies in usrp_spectrum_sense.py. I what to be able to pass a
list of frenquencies (floats) into the program and let it scan for the
power. But the program computes power from m.data and now from its own
variable ‘freq’. Can someone explain to me what these numbers (m.data)

Hi Ashraf,

that’s no real power – it’s the absolute magnitude of the FFT in each
bin, in dB relative to 1.
If you need numbers in real power (ie. numbers on your screen that
directly relate to a signal power in real physics), you will need to
calibrate your system with an external signal of which you know the
(physical) power of. This will only apply for a short time, for a given
configuration of frequency, sampling rate, gain.
I don’t know what you mean with m.data, but I think you’re on to nothing

Best regards,

m.data is what they use to calculate power_db (i.e. power_db = 10*
math.log10(m.data[i_bin]/tb.usrp_rate) - noise_floor_db) from this code

line 303.
How would I calibrate my system with an external signal? I don’t
what you mean by this.

On Wed, Jun 10, 2015 at 5:01 PM, Marcus Müller
[email protected]

ah! the meaning of m.data is explained a few lines before, line 284[1]:

m.data are the mag_squared of the fft output

As I explained, the value that gets displayed is just the squared
magnitude of the FFT – that means that values displayed are somehow
proportional to the powers in individual frequency spans, but they are
/just proportional/ – which means the relationship between the dB
displayed (dB relative to the digital value of 1) and real world power
(relative to for example 1mW, which could then be displayed as dBm) is
something that you will have to calibrate yourself.

Best regards,


Hi Ashraf,

Oh I see. That can be done, I believe. Thank you so much for helping
me understand.
You’re welcome!
I do have another question about modify usrp_spectrum_sense.py
And that would be?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs