Re: [Discuss-gnuradio] Python block help

2017-05-29 Thread Marcus Müller
Hi Zach, On 29.05.2017 22:57, Zach Morris wrote: > Hi Marcus, > > Sorry about the trouble with Nabble, I see that my code got cut off. I > will communicate via the mailing list from now on. > > If I understand your explanation correctly, the forecast function > below tells the scheduler that this

Re: [Discuss-gnuradio] Python block help

2017-05-28 Thread Marcus Müller
Hi Zach, sorry it took me so long to react: so, let's dissect a few things: First, the general purposes of these functions: * forecast() is called by the *scheduler* to ask your block "hey, if I'd need you to produce N items, how much would you need on your 0. (and 1., and 2.,… if existing) inpu

Re: [Discuss-gnuradio] Python block help

2017-05-28 Thread Marcus Müller
Hi Zach, sorry, the interesting part of your mail seem to have been swallowed; _don't_ use Nabble; it's much easier (and considering you're using a GMail address, anyway, which comes with good mailing list sorting, much, much more comfortable) to directly subscribe to the mailing list, and create

Re: [Discuss-gnuradio] Python block help

2017-05-26 Thread Zach Morris
I'm not sure I understand the forecast(), consume() and produce() functions, but this code seems to work: This passes any part of the signal above the threshold. -- View this message in context: http://gnuradio.4.n7.nabble.com/Python-block-help-tp51706p64064.html Sent from the GnuRadio maili

Re: [Discuss-gnuradio] Python block help

2017-05-26 Thread Zach Morris
That worked to create a general block, but I'm still having some trouble with implementing the forecast(), consume() and produce() functions. The goal of the block is to discard elements in an input vector that are below a certain threshold, and eventually update some statistics based on the rema

Re: [Discuss-gnuradio] Python block help

2017-05-26 Thread Marcus Müller
I spoke too soon – general blocks seem to be well-supported in python. My memory might come from a time where gr_modtool didn't have a template for general blocks. So, yeah, you're right, we have the magic in place needed to let Python classes build upon the simple block (non-fixed-rate). So, what

Re: [Discuss-gnuradio] Python block help

2017-05-25 Thread Marcus Müller
Hi Zach, not sure the Python interface supports general blocks (ie. blocks where the number of output items is not a multiple of the input items), I hope someone else can comment; I'd recommend implementing this as a C++ block; the "Guided Tutorials" on http://tutorials.gnuradio.org should prepare

Re: [Discuss-gnuradio] Python block help

2017-05-25 Thread Zach Morris
Hello Marcus, I realize this is a couple years later but I am attempting to do the same type of arbitrary ratio block, where samples above a threshold are passed and samples below that threshold are dropped. When I tried to subclass gr.block (as below, and in this tutorial from 2014

Re: [Discuss-gnuradio] Python block help

2014-12-26 Thread Marcus Müller
Hi Bob, I think you've introduced the "j" variable to keep count of how many items you're going to produce, but then just tell the scheduler you've produced as many items as he offered you to do. Replace self.produce(0,len(out0)) by self.produce(0,j). Also, you consume ninput_items every f