discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: consume method not defined error


From: George Edwards
Subject: Re: consume method not defined error
Date: Sun, 4 Jul 2021 16:14:41 -0500

Good evening Marcus,

Thanks again for your earlier insight on consume.

Sorry to bother you again and hope you can give me some further insight to my solution! My OOT model is supposed to read in data from the scheduler and break it into groups of M samples. Then, perform signal processing on each group of M input samples to produce N output samples (where M/N is not necessarily an integer). Here is a trivial version of my OOT code (where the selection of M and N were small numbers and M/N  was an integer). This code has problems! 

In the general_work method I have:
in = input_items[0]
out = output_items[0]
jj =0
for n in range(0, len(in)-4, 4):   # read in 4 samples at a time so M=4
     input = in[n:n+4]
     for k in range(0,2)
          out[jj] = reg[k]                # write to output to the first 2 input samples, N=2
          jj = jj+1
self.consume(0, len(input_items[0]))
return len(output_items[0]) , 

In the forecast method for loop, I set input_items_required[i] = noutput_items*M/N   where M=4 and N =2

When I ran the QA code with input vectors [0,1,2,3] and [0,1,2,3,4,5,6,7], it provides outputs of [0,1] and [0,1,4,5], respectively which are correct.
When I changed the QA input vector to [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], it bombs and states handler caught exception: index 4 is out of bounds for axis 0 which is size 4. I think it is telling me that out has length 4 and can only take 4 values.  How can this be? I did not set a size for out, I am letting the program write into out and that should determine its size. 

I think my simple code in the general_work method is correct and the problem lies with how I am defining the relationship between input and output samples in the forecast method. Any nuggets of insight?

Thanks again for your help.
George 


On Sat, Jul 3, 2021 at 5:17 PM Marcus Müller <mueller@kit.edu> wrote:
Hey George,

did you maybe forget that `consume` is a member of the class, and not just a freestanding
name? You'd want to use `self.consume`, not just `consume`.

Best regards
Marcus

On 02.07.21 22:33, George Edwards wrote:
> Hello,
>
> I am working with Gnuradio 3.8. 
>
> In response to my recent question, I think I found out why my program ran away in an
> infinite loop. It was because I was not consuming the inputs. So at the end of the loop in
> the general_work method when I used all the incoming data, I added the following line:
> consume(0,len(input_items[0])
> Gnuradio seems to have a problem with this and issues an error that the consume method was
> not defined. How can I fix this? 
>
> Thank you!
>
> Regards,
> George
>
>


reply via email to

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