discuss-gnuradio
[Top][All Lists]
Advanced

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

QA test inexplicably goes into infinite loop


From: George Edwards
Subject: QA test inexplicably goes into infinite loop
Date: Fri, 2 Jul 2021 13:07:28 -0500

Happy 4th to everyone!

I am doing a QA test and it goes into an infinite loop and there is nothing in my code to explain this, except my misunderstanding of writing code for Gnuradio.

I am working with the general model because I have M input samples to every N output samples (M and N are not equal and the ratio of M:N does not allow me to use the decimator, the ratio can be anything, let's choose a ratio say 5:4). In the forecast method I tried to inform GnuRadio of the relationship between input and output samples as follows:
ninput_items_required[i] = noutput_items + self.delta
where self.delta was defined in the class initialization
def __init__(self,......):       
      ...
      ...
      self.delta = delta = 2

Here is a simplified version of my code in the general_work method:
 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
     reg = np.array([1,1,1,1])
     input = in[n:n+4]
     reg = reg + input
     print('reg = { }'.format(reg))
     for k in range(0,2)
          out[jj] = reg[k]
          jj = jj+1

return len(output_items[0]) 

The QA input vector is [0,1,2,3,4,5,6,7]

When I ran the QA test, the program ended up in an infinite loop (I cannot see how this happens). I put a print statement to see what was happening with reg and saw the following results:
reg = [1, 2, 3, 4, 5 ]
reg = [4, 5, 6, 7, 8],  and, it keeps repeating these values (infinite loop somewhere).

Q1. It is computing reg correctly, but acts like the input vector [0,1,2,3,4,5,6,7] which occurs once in the QA test file repeat infinitely, why is this happening, the code loop looks good to me? 
,
Q2. Can the forecast method be messing things up, in the way that I am trying to pass the relationship between the number of inputs (M) to outputs (N) ?
 
Will appreciate any help pointing me in the right direction.

Regards
George

reply via email to

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