hi, can anyone point me towards some example code using gr-buffer? I need to read a sample stream from HD (not very fast..) and afterwards re send it towards the usrp significantly faster (8complex Msps). is gr-buffer a good candidate to do this? thanks

on 2007-07-19 08:40

on 2007-07-19 11:56

2007/7/19, Vincenzo Pellegrini <wwvince@gmail.com>: > hi, > can anyone point me towards some example code using gr-buffer? > I need to read a sample stream from HD (not very fast..) > and afterwards re send it towards the usrp significantly faster (8complex > Msps). > is gr-buffer a good candidate to do this? You could either use gr.file_source_x or gr.vector_source_x. -- Trond Danielsen

on 2007-09-25 23:04

thanks Trond, I went your way, and actually my stream gets loaded right into the ram as I wanted..:) my problem is now that.. doing: data = fromfile("/root/Desktop/ofdm_encode_1H.dump", dtype="complex64") vector_source = gr.vector_source_c(data,True) self.connect(vector_source,gain) self.connect (gain, self.u) I get an error relating to the number of arguments I pass to gr.vector_source_c vector_source = gr.vector_source_c(data,True) File "/usr/local/lib/python2.4/site-packages/gnuradio/gr/gnuradio_swig_py_gengen.py", line 6695, in vector_source_c return _gnuradio_swig_py_gengen.vector_source_c(*args) NotImplementedError: Wrong number of arguments for overloaded function 'vector_source_c'. Possible C/C++ prototypes are: gr_make_vector_source_c(std::vector<gr_complex,std::allocator<gr_complex > > const &,bool) gr_make_vector_source_c(std::vector<gr_complex,std::allocator<gr_complex > > const &) what am I doing wrong? sorry for bothering.. and thanks for help vincenzo

on 2007-09-25 23:04

i think my problem is that numpy's fromfile() provides this as an output [ -1.38586906e+38 +1.12948992e+32j 1.43605805e+30 -4.40817649e-09j 8.78218944e+08 -1.98631123e-14j ..., 4.88822397e+23 +2.90330289e +13j 5.91237359e-02 +4.88047634e+23j -5.31466166e+33 -3.25484218e-18j] which gets refused from gr.vector_source instead of this [ -1.38586906e+38 +1.12948992e+32j , 1.43605805e+30 -4.40817649e-09j 8.78218944e+08 -1.98631123e-14j , 4.88822397e+23 +2.90330289e+13j 5.91237359e-02 +4.88047634e+23j , -5.31466166e+33 -3.25484218e-18j] which works fine. I haven't been able to find much documentation about numpy so I don't know how to convert between these data types.. does anyone know where to look? thanks vincenzo

on 2007-09-25 23:05

2007/7/19, Vincenzo Pellegrini <wwvince@gmail.com>: > anything like: > > gr.file_source--->data=gr.vector_sink > gr.vector_source(data, repeat=true)--->usrp_sink > > would be correct? No, if you use vector_source, you should not use the gr.file_source to load the data. How you read the data from the file depends on the format is is stored in, but if it data recorded with GNU Radio, I personally use numpy/scipy. Python example: from numpy import * # Use complex64 for gr.gr_complex and float32 for gr.float data = fromfile("filename.dat", dtype="complex64") src = gr.vector_source(data, repeat=True)

on 2007-09-25 23:05

2007/7/24, Eric Blossom <eb@comsec.com>: > > self.connect(vector_source,gain) > > 'vector_source_c'. > > > > sorry for bothering.. > > and thanks for help > > > > vincenzo > > What is the type of the "data" result? The type of data is a numpy array. It can be converted to an ordinary python list: a_list = data.tolist() However, whenever a list is expected, a numpy array can always be used. > vector_source_c expects a Python list or tuple of complex. -- Trond Danielsen

on 2007-09-25 23:07

On Tue, Jul 24, 2007 at 12:36:10PM +0200, Vincenzo Pellegrini wrote: > thanks Trond, > I went your way, and actually my stream gets loaded right into the ram > as I wanted..:) > my problem is now that.. doing: > > data = fromfile("/root/Desktop/ofdm_encode_1H.dump", > dtype="complex64") > vector_source = gr.vector_source_c(data,True) You might want to try dtype="complex32" Eric

on 2007-09-25 23:08

On Wed, Jul 25, 2007 at 12:14:42PM +0200, Vincenzo Pellegrini wrote: > but what is the usual good way in gnuradio to fill a vector with data > from files? > is there an alternative to this? > the only thing I need is to set up my vector source for feeding the usrp > with samples If you're reading binary data from files, the usual way it to just use gr.file_source(gr.sizeof_gr_complex, 'my-filename') Eric

on 2007-09-25 23:10

On Tue, Jul 24, 2007 at 12:36:10PM +0200, Vincenzo Pellegrini wrote: > self.connect (gain, self.u) > Possible C/C++ prototypes are: > sorry for bothering.. > and thanks for help > > vincenzo What is the type of the "data" result? vector_source_c expects a Python list or tuple of complex. Eric

on 2007-09-25 23:10

my fromfile (file, dtype) numpy function does not accept d type = complex32... data = fromfile("/root/Desktop/rx.dat", dtype="complex32") TypeError: data type not understood but what is the usual good way in gnuradio to fill a vector with data from files? is there an alternative to this? the only thing I need is to set up my vector source for feeding the usrp with samples thanks Eric vincenzo

on 2007-09-25 23:11

2007/7/25, Vincenzo Pellegrini <wwvince@gmail.com>: > > [ -1.38586906e+38 +1.12948992e+32j , 1.43605805e+30 -4.40817649e-09j > 8.78218944e+08 -1.98631123e-14j , 4.88822397e+23 +2.90330289e+13j > 5.91237359e-02 +4.88047634e+23j , -5.31466166e+33 -3.25484218e-18j] > > which works fine. > > I haven't been able to find much documentation about numpy so I don't > know how to convert between these data types.. > > does anyone know where to look? http://www.scipy.org -- Trond Danielsen