Usrp_spectrum_sense and gr_bin_statistics_f

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

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