Blks2.synthesis_filterbank

Hey guys,

I was wondering if the whole hier_block2 thing was working yet. I tried
to
run the blks2.synthesis_filterbank in a manner that seemed appropriate
and
got the following error:

terminate called after throwing an instance of ‘std::runtime_error’
what(): streams_to_stream(5): insufficient connected output ports (2
needed, 1 connected)

Is this a bug in the filterbank code, or does this have to do with
hier_block2 not working yet?

Any help would be greatly appreciated. Thanks!

-Ben

Here’s the source code:

#!/usr/bin/env python

from gnuradio import gr,blks2
import time
class PTestMe(gr.top_block):
def init(self):
gr.top_block.init(self)
sample_rate = 200

    mpoints = 4;
    taps = gr.firdes.low_pass(1,   # gain
                          1,   # rate
                          1.0/mpoints * 0.5,  # cutoff
                          1.0/mpoints * 0.1,  # trans width
                          gr.firdes.WIN_HANN)



    self.synth = blks2.synthesis_filterbank(mpoints,taps)
    self.src0 = gr.sig_source_c (sample_rate, gr.GR_SIN_WAVE, 10, 

1.0)
self.src1 = gr.null_source(gr.sizeof_gr_complex)
self.src2 = gr.null_source(gr.sizeof_gr_complex)
self.src3 = gr.null_source(gr.sizeof_gr_complex)

    self.thr = gr.throttle(gr.sizeof_gr_complex, sample_rate)

    self.dst = gr.file_sink( gr.sizeof_gr_complex,'bentest.dat')
    #self.dst = gr.vector_sink_c()

    self.connect(self.src0,(self.synth,0))
    self.connect(self.src1,(self.synth,1))
    self.connect(self.src2,(self.synth,2))
    self.connect(self.src3,(self.synth,3))
    self.connect(self.synth,self.thr,self.dst)

if name == ‘main’:
test = PTestMe();
test.start()
time.sleep(1)
test.stop()

View this message in context:
http://www.nabble.com/blks2.synthesis_filterbank-tp14833066p14833066.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Mon, Jan 14, 2008 at 11:18:15PM -0800, benjar wrote:

Is this a bug in the filterbank code, or does this have to do with
hier_block2 not working yet?

Any help would be greatly appreciated. Thanks!

-Ben

Hi Ben,

looks like there are at least two (probably unrelated)
problems. The first is a problem we’ve been seeing lately with
SWIG related exception handling. That’s why you’re seeing it terminate
instead of entering the python exception handler. It’s independent of
the hier_block2 stuff, e.g.,

$ python
Python 2.5 (r25:51908, Nov  6 2007, 16:54:01)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type "help", "copyright", "credits" or "license" for more 

information.
>>> from gnuradio import gr
>>> gr.firdes.hilbert(5, -1)
terminate called after throwing an instance of ‘std::out_of_range’
what(): gr_firdes:window: type out of range
Aborted

FYI, it’s ticket:181

Not sure what the other problem is.
Johnathan, can you take a look at this?

Eric

Eric B. wrote:

On Mon, Jan 14, 2008 at 11:18:15PM -0800, benjar wrote:

Hey guys,

I was wondering if the whole hier_block2 thing was working yet.

To answer this particular question–yes. The new top_block/hier_block2
code has been in the stable branch since 3.1.0, and all our examples and
QA code have been switched over to use it on our development trunk. So
it gets exercised quite frequently.

Is this a bug in the filterbank code

I suspect that when the block was switched to use the new
top_block/hier_block2 code, a bug was introduced.

However, the gr-pager scripts use blks2.analysis_filterbank
successfully.

From Eric:

Not sure what the other problem is.
Johnathan, can you take a look at this?

Will do.


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com

So, interesting things. Incidentally, I was the guy who posted about
the segfault in top_block.

  1. On my laptop runing ubuntu 7.10 natively with latest stuff installed,
    I got the segfault. On my virtualized ubuntu on my macbook, I got a
    real error message (btw & fyi, ubuntu + parallels does not work with the
    USRP).
  2. The error message that I got as that was segfaulting the native
    ubuntu was the same error message I was getting for the
    blks2.synthesis_filterbank:

“insufficient connected output ports (2 needed, 1 connected)”

The difference is that I’m getting the error because of my C++ block
(either because of the C++ code, or how it was connected in the python).

It might be the case that if I fix my own code, I can also fix the
blks2.synthesis_filterbank.

Cheers,

-Ben


I was wondering if the whole hier_block2 thing was working yet.


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com


Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008

On 1/18/08, beezle bub [email protected] wrote:

It might be the case that if I fix my own code, I can also fix the blks2.synthesis_filterbank.

Let me know what you find. I haven’t looked at your bug report yet.


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com/

Hey there,

Problem solved. As it turns out, it was just a connect issue–things
were being hooked up wrong in both my code and
blks2.synthesis_filterbank. I am not sure how to check in code to the
branch. Could one of you check this in?

The file is “filterbank.py”, found on my system in
/usr/local/lib/python2.5/site-packages/gnuradio/blksimpl2

lines 110 - 118

Used to be this:

    self.connect(self.ss2v, self.ifft, self.v2ss, self)

    # build mpoints fir filters...
    for i in range(mpoints):
        f = gr.fft_filter_ccc(1, sub_taps[i])
        self.connect((self.v2ss, i), f)
        self.connect(f, (self.ss2s, i))

Now, the corrected version is this:

    self.connect(self.ss2v, self.ifft, self.v2ss)

    # build mpoints fir filters...
    for i in range(mpoints):
        f = gr.fft_filter_ccc(1, sub_taps[i])
        self.connect((self.v2ss, i), f)
        self.connect(f, (self.ss2s, i))

    self.connect(self.ss2s,self)

I tested it and it seems to work.

Cheers,

-Ben

beezle bub wrote:

Problem solved. As it turns out, it was just a connect issue–things
were being hooked up wrong in both my code and
blks2.synthesis_filterbank. I am not sure how to check in code to the
branch. Could one of you check this in?

Thanks, this has been tested and checked into the trunk in r7476. In
addition, the old test programs for this have been resurrected from
limbo, upgraded to use blks2, and put back into the USRP examples.


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com