discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] usrp_spectrum_sense and gr_bin_statistics_f


From: devin kelly
Subject: [Discuss-gnuradio] usrp_spectrum_sense and gr_bin_statistics_f
Date: Fri, 23 Jul 2010 11:10:44 -0400

Hello,

I've been looking into how usrp_spectrum_sense works and I have a
question about my understanding of how it works.

The basic idea is that is that you tune, take FFT(s?), then retune,
etc.  This is done with the fft block and the stats block.  My
questions are:

1) What is input_items conceptually?  I think it is a vector of
pointers to different fft sweeps, but I could be wrong.

2) So, is this code taking several FFTs then the for loop and
accrue_stats finds the maximum magnitude of each of the FFT bins.  Is
that right?

3) Could I change dwell_time to change the number of FFTs that are taken?

4) If I wanted to do some averaging (instead of find the max
magnitude) could I would have to edit accrue_stats

Here's all the relevant code from
gnuradio-core/src/lib/general/gr_bin_statistics_f.cc

  const float *input = (const float *) input_items[0];
  size_t vlen = d_max.size();

  int n = 0;
  int t;

    while (n < noutput_items){
      switch (d_state)

           ...

         case ST_DWELL_DELAY:
           t = std::min(noutput_items - n, int(d_delay));
           for (int i = 0; i < t; i++){
               accrue_stats(&input[n * vlen]);
               n++;
            }
           d_delay -= t;
           assert(d_delay >= 0);
           if (d_delay == 0){
              leave_dwell_delay();
              enter_tune_delay();
          }
          break;

...

  void
  gr_bin_statistics_f::accrue_stats(const float *input)
  {
    for (size_t i = 0; i < vlen(); i++){
      d_max[i] = std::max(d_max[i], input[i]);    // compute per bin maxima
    }
  }



Thanks for any help,
Devin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]