discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] making gnuradio blocks entirely in python


From: Almohanad Fayez
Subject: Re: [Discuss-gnuradio] making gnuradio blocks entirely in python
Date: Mon, 26 Sep 2011 00:18:07 -0400 (EDT)


The "in" buffer should start at in[0] the history comes into play at allowing enough valid indices to perform the filtering operation over the entire buffer which allows N valid output data versus N-nTAPS.  When I looked at filtering in gnuradio the way I thought about it as and at the end I've included some ASCII art to demonstrate it, from the illustration you can see how the history comes into play.  I'm no DSP engineer but this seems to work for me someone can feel free to correct me if I'm wrong.

< adapted from gr_fir_fff_generic.cc>

for(i=0; i<n; i++)
  for(j=0; j< ntaps; j++)
    out[i] += taps[j] * input[i+j]

  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1   in2   in3   in4   in5
tap3   tap2   tap1   tap0

  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1   in2   in3   in4   in5
         tap3   tap2   tap1   tap0

  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1   in2   in3   in4   in5
                  tap3   tap2   tap1  tap0
 
  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1    in2   in3   in4   in5
                           tap3  tap2  tap1  tap0
 
  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1     in2   in3   in4   in5
                                    tap3  tap2  tap1  tap0
  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1   in2     in3   in4   in5
                                           tap3  tap2  tap1  tap0
 
  0      1         2       3      4     5      6      7       8      9
hist0  hist1  hist2  hist3  in0   in1   in2    in3    in4    in5
                                                   tap3  tap2  tap1  tap0


al fayez

-----Original Message-----
From: Josh Blum <address@hidden>
To: Discuss-gnuradio <address@hidden>
Sent: Sun, Sep 25, 2011 6:59 pm
Subject: [Discuss-gnuradio] making gnuradio blocks entirely in python

So there is a useful feature I think gnuradio is missing, and thats the
ability to rapidly prototype signal processing in python. It would be
great if a python block would have access to all the facilities
available to a block written in a c++ environment.

So I put together pyblock (not to be confused with those other project
by the same name). Its a stand-alone build that links against gnuradio.
https://github.com/guruofquality/pyblock

Theres a few demos: an adder, using tags, interp and decim blocks.
https://github.com/guruofquality/pyblock/tree/master/examples

The interesting thing is that the work functions just call into numpy
routines, so there is a chance that the implementations can be
reasonably fast.

I would like to be able to support history so i can implement a filter
using numpy but I am a little lacking in the basic understanding so fill
me in if you know. Suppose I have this work function:

int work(int noutput_items, gr_vector_const_void_star
&input_items,gr_vector_void_star &output_items){
const float *in = reinterpret_cast<const float *>(input_items[0]);

I am assuming history is on the input buffer.
Is the vector "in" ninput_items + history() items long? Where
ninput_items = noutput_items*/some_factor.
Whats the first index of the first item? Is in[0] or in[0-history()]?

-Josh

_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

reply via email to

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