The "additional checks" would be to find the min of input and output lengths, and to copy only that number of items. Something like:
nitems = min(len(input_items[0]), len(output_items[0])) out[:nitems] = in[:nitems] As your block gets more complex, the checks/limits may get more complex. On Wed, May 26, 2021 at 7:56 PM Elmore Family <[email protected]> wrote: > Jeff, > > This didn’t work – same error. > > Jim > > *From:* Jeff Long > *Sent:* Tuesday, May 25, 2021 5:22 PM > *To:* GNURadio Discussion List > *Subject:* Re: OOT Module with shape error > > The framework can give you different size input and output buffers. In > this case, you would: > > nitems = len(input_items[0]) > out[:nitems] = input_items[0] > > You may have to do more checks, of course, because input could be larger > than output. > > On Tue, May 25, 2021 at 5:03 PM Elmore's <[email protected]> wrote: > >> I am attempting to add an OOT module to my flowgraph. I have generated a >> General block which I want to place between an Audio Source and a Multiply >> Constant. >> >> The Audio Source is set at a 48K sample rate. Input and Output are float. >> >> As a test (I have never tried using an OOT module before) I said: >> out[:] = input_items[0] >> in an attempt to simply feed the input to the output unmodified. >> >> I get a run time error: >> ValueError: Could not broadcast input array from shape(4800) into >> shape(256) >> >> Obviously I don’t know how to perform the simplest possible operation. >> What is wrong here? >> >> I have tried looking on forums and reading some of the GNU docs but no >> joy. >> >> Thanks for any help. >> >> Jim >> >> >> >> >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> Virus-free. >> www.avg.com >> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> >> >
