Monday, July 11, 2022

How to set minimum noutput_items for python custom blocks

Hello guys!
I'm trying to implement a python custom (general) block with the following in/out signature:
- in_sig=[(np.complex64, M)]
- out_sig=[np.complex64]
The block has three parameters: M, N and L.
The idea is to get 2D frames (N,M), do some signal processing, and output N*M+L serial samples for each frame.
I'm managing the input buffer using the following forecast function:
    def forecast(self, noutput_items, ninputs):
        noutput_frames = noutput_items//(self.M*self.N+self.L)
        ninput_items_required = [noutput_frames*self.N]
        return ninput_items_required
The problem I have is to force noutput_items greater or equal to N*M+L.
I tried self.set_min_noutput_items(N*M+L) running raises the following error:
self.set_min_noutput_items(N*M+L)

  File "/usr/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 129, in __getattr__

    if not hasattr(self, "gateway"):

  File "/usr/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 129, in __getattr__

    if not hasattr(self, "gateway"):

  File "/usr/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 129, in __getattr__

    if not hasattr(self, "gateway"):

  [Previous line repeated 494 more times]

RecursionError: maximum recursion depth exceeded
Is it possible to set minimum noutput_items also for python blocks?
Thanks a lot.
Ivan

No comments:

Post a Comment