Sunday, March 17, 2019

Re: [Discuss-gnuradio] Capturing maximum complex value

On Sun, Mar 17, 2019 at 8:10 AM John Ackermann N8UR <jra@febo.com> wrote:
Is there a probe or other function that can capture and hold the maximum
instantaneous value of a complex stream?  If not, is there a way to
create that capability out of other blocks?

One of the AGC blocks that has separate attack and decay rates (agc2_cc or agc3_cc) could be used to do this: set attack to 1, decay to 0, ignore the output, and read (1.0 / agc.gain()) to find the peak-hold magnitude.

In my own application, I am using this chain for peak detection without hold:
    blocks.complex_to_mag_squared(),
    blocks.stream_to_vector(itemsize=gr.sizeof_float, nitems_per_block=window),
    blocks.max_ff(window),
    blocks.probe_signal_f()
but you would need to separately poll (at the sample rate divided by the window length) and max-hold this to catch long-term peaks. On the upside, as I just found out, it uses less CPU time than running the AGC (on my processor).

That's what I'm currently doing -- actually, I do a constant mult of 
from 100 to 500 on the source signal (a file of 16 bit IQ recorded from 
an HF SDR).

If the only thing that affects the peak/gain is the recording, perhaps you could measure the peak in the file offline (that is, separately from running your real-time flowgraph) and use that to set the gain, instead of having to interactively monitor anything.

No comments:

Post a Comment