discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Problem writing custom null sync block


From: Martin Braun (CEL)
Subject: Re: [Discuss-gnuradio] Problem writing custom null sync block
Date: Fri, 22 Feb 2013 15:44:53 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Feb 22, 2013 at 09:09:19AM -0500, Tom Rondeau wrote:
> > ####
> > class file_writer(gr.sync_block):
> >         ## CTOR
> >         #
> >         def __init__(self, filename, vec_size):
> >                 gr.sync_block.__init__(
> >                                 self,
> >                                 "file name block",
> >                                 in_sig = [np.dtype((np.float32, vec_size))],
> >                                 out_sig = None
> >                                 )
> >
> >                 self._fd = open(filename, 'w')
> >                 self._filename = filename
> >
> >
> >         def work(self, input_items, output_items):
> >                 in0 = input_items[0]
> >
> >                 print "###### ",  len(in0)
> >                 print in0
> >
> >                 return len(output_items)
> 
> What is the length of output_items? Because you don't have an output
> buffer attached to this block, I'd be concerned that len(output_items)
> == 0, so you're telling the scheduler that you aren't consuming any
> data. Maybe just replace that last line with 'return
> len(input_items)'?

It's probably 'len(in0)', as len(input_items) would return the number of
input ports. 'len(output_items[0])' would probably also work.

MB

-- 
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Attachment: pgpdv0Sm31EOu.pgp
Description: PGP signature


reply via email to

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