I assume m.data is a list of FFT magnitude-squared data; it can't be complex otherwise math.log10() won't work. It must be magnitude-squared since it is using 10*math.log10(), otherwise it needs to be 20*math.log10().
It finds the minimum out of all the bins and calls that the noise floor. For each bin it subtracts the noise floor and calls that the power. Although this is calculation is really the SNR, not the power. It needs to be calibrated against a known reference to give the power. Problem is you would have to do that for each hardware. It's also assuming the lowest valued bin is noise (which isn't necessarily true). It's scaling the values by the usrp_rate, probably since it's using a fixed-length FFT, therefore if the usrp_rate increases, then the bandwidth for each bin increases. They want the noise level to stay constant with bandwidth, so it is really calculating power-spectral-density. I'd do it like so: power_dbm_per_Hz = 10*math.log10(m.data[i_bin]/tb.usrp_rate) + cal_factor_dBm Lou Leo Yang wrote > I found one modified example from usrp_spectrum_sense.py which mentioned > the power and noise calculation, could u plz help me figure out how it > works? > > for i_bin in range(bin_start, bin_stop): > > center_freq = m.center_freq > freq = bin_freq(i_bin, center_freq) > #noise_floor_db = -174 + 10*math.log10(tb.channel_bandwidth) > noise_floor_db = 10*math.log10(min(m.data)/tb.usrp_rate) > power_db = 10*math.log10(m.data[i_bin]/tb.usrp_rate) > -noise_floor_db -- View this message in context: http://gnuradio.4.n7.nabble.com/Received-Signal-Power-question-tp51409p51414.html Sent from the GnuRadio mailing list archive at Nabble.com. _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio