Help To Compute Average

Hello all

I am new to GNUradio software. I would like to compute the average
energy and display it in the status message in real time.

To achieve this I tried to write a simple Python code attached
(Simple2.pyw). However, I am not able to retrieve data from the

self.c2ms=gr.complex_to_mag_squared(NFFT) block

  1. Could you please help me what method should I use to retrieve the
    data contents of self.c2ms

  2. And perform averaging (This could be performed easily using the
    function below)

  3. Display the average in the right status message (i.e., in
    self._set_status_msg(“Put average here!!!”, 1)).

Finally for any given block, how can I see and modify the methods
easily.

Note that I am using windows command line to run the python file.

A.

get average_energy(data):
avg1=0
for i in data
avg1=avg1+i
return avg1/len(data)

I believe you need to use a probe. I’m doing something similar in the
attached *.grc. I use complex_to_mag_squared then integrate with
decimation
down to 100 Hz. Take the Log10 and offset to get it in dBm, resulting
in an
RSSI (Received Strength Signal Indicator) The Probe Signal pulls the
RSSI
from the flow at 10 Hz and is displayed by a QT GUI label, but I suppose
you
could print it to the console too, or average it outside the flow per
your
pseudo-code. They key point though is getting that low rate data
outside
the GR flow so you can access it in python.

Note you must tweak both knobs to get the audio to work after you
initially
start it. This is used for direction finding of WBFM signals, as it
computes the RSSI and generates a scaled audio tone that is useful when
manipulating a directional antenna:
https://dl.dropboxusercontent.com/u/49570443/b200_wbfm_df.grc

You can also do it using message queues per this tutorial, but from what
I
have read this method is deprecated.

I used the above to do a little performance testing, to pull FFTs out
the
flow and so see how fast the queue would fill up:
https://dl.dropboxusercontent.com/u/49570443/msgpass2.py

Thanks,
Lou
KD4HSO

Andr Jakob wrote

Note that I am using windows command line to run the python file.

get average_energy(data):
avg1=0
for i in data
avg1=avg1+i
return avg1/len(data)


View this message in context:
http://gnuradio.4.n7.nabble.com/Help-To-Compute-Average-tp49722p49732.html
Sent from the GnuRadio mailing list archive at Nabble.com.