discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Modifying vectors


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] Modifying vectors
Date: Fri, 17 Mar 2006 11:50:55 -0800
User-agent: Mutt/1.5.9i

On Fri, Mar 17, 2006 at 10:27:45AM +0100, Patrick Strasser wrote:
> Hello!
> 
> I've following working code:
> 
>         src = audio.source (sample_rate, options.audio_input)
>         dst = audio.sink (sample_rate, options.audio_output)
> 
>         fft_size = 1024
> 
>         s2p = gr.serial_to_parallel(gr.sizeof_float, fft_size)
> 
>         fft = gr.fft_vfc(fft_size, True, window.hanning(fft_size))
>         ifft = gr.fft_vcc(fft_size, False, window.hanning(fft_size))
> 
>         abs = gr.complex_to_mag()
>         p2s = gr.parallel_to_serial(gr.sizeof_gr_complex, fft_size)
> 
>       self.connect((src, 0), s2p )
>         self.connect(s2p, fft      )
>         self.connect(fft, ifft     )
>         self.connect(ifft, p2s     )
>         self.connect(p2s, abs, (dst, 0))
>       self.connect((src, 1), (dst, 1))
> 
> now I want to modify data between fft and ifft.
> Do I have to make a custom block in python (I'd like to do this anyway...)?

Depends on what you want to do.  A few of the blocks support an
optional "vlen" constructor argument.  These will apply the given
operation to a vector of items.

If for example you want to independently filter the bins, you could
use gr.stream_to_streams, a bunch of filter blocks, then
gr.streams_to_stream.  See
gnuradio-core/src/python/gnuradio/blksimpl/filterbank.py 

This isn't completely sorted out.  Besides adding the "vlen" attribute
to many blocks, we've also considered using a Numeric  / NumPy / SciPy
"ufunc" (universal function) mechanism and then a small number of
GNU Radio blocks that know how to apply ufuncs across streams.
"ufuncs" would probably be easier to write in the common cases than
full GNU Radio blocks.

We probably need to give this some thought and come up with a
rationalized system for applying operations across/between vectors.

Eric




reply via email to

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