Again, if one uses the vector-probe block, one can call the appropriate function from a function-probe, at that point, you have a variable with the contents of the FFT output vector in it, which can be used in a call to your
own Python code. On 2014-10-17 12:01, Brad Hein wrote: > This sounds interesting - do you have any sample code? > > Can anybody explain the concept of "size" of an fft (Arg 1 of fft.fft_vcc) > comes into play if the output of that FFT generates as many samples as it > receives? > > ------------------------- > > FROM: "John Malsbury" <jmalsbury.perso...@gmail.com> > TO: "Brad Hein" <k1...@comcast.net> > CC: "Martin Braun" <martin.br...@ettus.com>, discuss-gnuradio@gnu.org > SENT: Friday, October 17, 2014 1:50:31 AM > SUBJECT: Re: [Discuss-gnuradio] help accessing fft bins in python script > > Sometimes when I want to grab samples and perform some periodic operation > like CNR estimation, or fine-frequency estimation I sometimes use a > vector_sink, and then two function probe blocks - one to read the data and > one to reset it (yes I call the reset function from the function probe). This > seems to work wonderfully for certain corner cases where a vector sink > doesn't work well. And I mostly use this technique when I want to prototyping > something quickly before writing a block. But am I asking for trouble with > memory allocation issues??? > > ALSO, I WAS THINKING, IT WOULD BE GOOD TO HAVE THE OPTION, EITHER A BLOCK > PARAMETER OR AN OVERLOADED FUNCTION) TO RESET THE VECTOR_SINK, EACH TIME > .DATA() IS CALLED... I CAN CODE THIS UP UNLESS ANYONE THINKS THIS > FUNCTIONALITY WOULD LEAD TO REGRESSIONS. > > But I agree the vector sink block is much more convenient for FFTs... -John > > On Thu, Oct 16, 2014 at 5:37 PM, Brad Hein <k1...@comcast.net> wrote: > >> Is there any way to access the fft bins from python without writing a custom >> block? >> >> ------------------------- >> >> FROM: "Martin Braun" <martin.br...@ettus.com> >> TO: discuss-gnuradio@gnu.org >> SENT: Thursday, October 16, 2014 2:02:03 PM >> SUBJECT: Re: [Discuss-gnuradio] help accessing fft bins in python script >> >> A very simple way would just be to write your block downstream of the >> FFT in Python. You can then operate on the vectors in the work function. >> >> M >> >> On 10/16/2014 07:44 PM, mle...@ripnet.com wrote: >>> The vector sink is for debugging only. Don't use it in production code, >>> because there's no convenient way to >>> >>> vacuum it out, so it grows without bound. >>> >>> >>> >>> When I've had this problem, I use a vector-probe block, and have a >>> function probe running at a couple of Hz, >>> >>> and then leverage the dependency-tree evaluator to have my own >>> function called with the result of the >>> >>> function probe. There are other ways, that's the one I personally >>> find most convenient. But there are message >>> >>> queues and sundry other methods as well. >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> On 2014-10-16 13:36, Brad Hein wrote: >>> >>>> >>>> Using qa_fft.py for inspiration[1], I'm trying to feed a raw capture >>>> file into an fft of size 32 and then review the 32 fft bins at an >>>> instantaneous point in time[2]. I must be doing something wrong >>>> however because when I review the vector sink's data() method, it >>>> returns a rather large array (compared to the 32-element array I am >>>> expecting). data() seems to return an array with the same number of >>>> elements as samples fed into the fft. I just want an array of the 32 >>>> fft bins so I can calculate the relative power in the given band. >>>> >>>> Any help/pointers appreciated! >>>> Thanks >>>> >>>> >>>> [1] >>>> http://gnuradio.org/redmine/projects/gnuradio/repository/revisions/master/entry/gr-fft/python/fft/qa_fft.py >>>> [1] >>>> >>>> [2] >>>> https://github.com/regulatre/grfun/blob/9dbbf676d2fea013787720273af0b419699c75a4/hello-fft/decodeDump162.py >>>> [2] >>>> >>>> >>>> [Brad Hein] >>>> >>>> _______________________________________________ >>>> Discuss-gnuradio mailing list >>>> Discuss-gnuradio@gnu.org <mailto:Discuss-gnuradio@gnu.org> >>>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio [3] >>> >>> >>> _______________________________________________ >>> Discuss-gnuradio mailing list >>> Discuss-gnuradio@gnu.org >>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio [3] >>> >> >> _______________________________________________ >> Discuss-gnuradio mailing list >> Discuss-gnuradio@gnu.org >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio [3] >> >> _______________________________________________ >> Discuss-gnuradio mailing list >> Discuss-gnuradio@gnu.org >> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio [3] > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio [3] Links: ------ [1] http://gnuradio.org/redmine/projects/gnuradio/repository/revisions/master/entry/gr-fft/python/fft/qa_fft.py [2] https://github.com/regulatre/grfun/blob/9dbbf676d2fea013787720273af0b419699c75a4/hello-fft/decodeDump162.py [3] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio