Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-04 Thread Marcus Müller

I can't really test this right now,
but you could insert
  %include 
into your project's swig file[1]; this should generate a python method
   cdata(ptr, length)
that you can feed your blob_data() to. I'm not quite sure that WILL
work as is, maybe you will need a C(++) wrapper that simply returns
an array of known type (that is, int* instead of void*) that you can
yourself wrap into a SWIG array_class (like in the linked document).

Greetings
Marcus

[1] http://www.swig.org/Doc1.3/Library.html#Library_nn7
On 08/04/2013 04:37 AM, Peter Horvath wrote:

Hi,

can I convert a blob created by my C++ code (unsigned chars) to a Python
list or NumPy array?

pmt.blob_data() returns a 'SwigPyObject' with which I can't do anything.
Passing it to a NumPy array constructor doesn't seem to do the job.

The blobs are in a tuple:
pmt::pmt_t b1 = pmt::make_blob(a, a_length);
pmt::pmt_t b2 = pmt::make_blob(b, b_length);
return pmt::make_tuple(b1, b2);

And I try to check the contents of b1 in QA code like this:
res = my_test_function()
b1 = pmt.blob_data(pmt.tuple_ref(res, 0))
b1_len = pmt.blob_length(pmt.tuple_ref(res, 0))

Thanks,
Peter

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


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


[Discuss-gnuradio] channel estimation

2013-08-04 Thread Eslam Ahmed
Dear All,

I am trying to implement channel estimation in ofdm. I made the attached
flow graph and also python file is attached. I used ofdm_mod and demod.
blocks, and I edited the "ofdm frame acquistion.cc" to print channel coff.
but the displayed taps is incorrect.


Regards,

Eslam ahmed


trial3.grc
Description: Binary data


trial.py
Description: Binary data
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-04 Thread Marcus Müller

On second thought: Does using pmt.make_vector solve your problem?
in C++:
p = pmt::make_u8vector(length, fill);
(do stuff like pmt::u8vector_set(p, index, value), or even unsigned char* p_vec 
= pmt::u8vector_writable_elements(p,length). The later can summon hell if you 
use the same PMT object in multiple places.)

in python:
myvec= pmt.u8vector_elements(p)
Note, however, that this will inherently copy each individual uchar to a python 
(long) int.

If you really want the raw bytes,  you can always get really dependent on PMT 
structure (which is basically fine, as long as you know that PMT won't change 
during the lifetime of your application), and use
pmt.serialize_str(p)
in python, as this will give you a string.

Thinking about that, there is yet another option, that suddendly blob's  into 
mind.
in C++ , generate a std::string, and assign your char data to it:
std::string looks_like_it_s_text_but_is_data s();
s.assign(reinterpret_cast(mydata), length);
pmt::pmt_t p = pmt::intern(s);

In python, you can use pmt.to_string(p) to get back the string, in case you 
want to use
it for a buffer.

PLEASE, be aware that this is NOT a good idea for high data volume or high 
throughput;
string_to_symbol hashes the string, and saves the hash as well as the pmt_t in 
a table.


On 08/04/2013 12:08 PM, Marcus Müller wrote:

I can't really test this right now,
but you could insert
  %include 
into your project's swig file[1]; this should generate a python method
   cdata(ptr, length)
that you can feed your blob_data() to. I'm not quite sure that WILL
work as is, maybe you will need a C(++) wrapper that simply returns
an array of known type (that is, int* instead of void*) that you can
yourself wrap into a SWIG array_class (like in the linked document).

Greetings
Marcus

[1] http://www.swig.org/Doc1.3/Library.html#Library_nn7
On 08/04/2013 04:37 AM, Peter Horvath wrote:

Hi,

can I convert a blob created by my C++ code (unsigned chars) to a Python
list or NumPy array?

pmt.blob_data() returns a 'SwigPyObject' with which I can't do anything.
Passing it to a NumPy array constructor doesn't seem to do the job.

The blobs are in a tuple:
pmt::pmt_t b1 = pmt::make_blob(a, a_length);
pmt::pmt_t b2 = pmt::make_blob(b, b_length);
return pmt::make_tuple(b1, b2);

And I try to check the contents of b1 in QA code like this:
res = my_test_function()
b1 = pmt.blob_data(pmt.tuple_ref(res, 0))
b1_len = pmt.blob_length(pmt.tuple_ref(res, 0))

Thanks,
Peter

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




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


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


Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-04 Thread Peter Horvath
Hi Marcus,

pmt.u8vector_elements() did the trick. The result being a long array is
not a problem, I could compare its elements with a list using
assertSequenceEqual().
Thank you,
Peter

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


[Discuss-gnuradio] Students coming to GRCon!

2013-08-04 Thread Tom Rondeau
Students!

If you are coming or interested in coming to GRCon this year, Ettus
Research is once again offering to cover the cost of the conference
registration (a $250 offer).

We have set up a webpage to apply for this offer. Just fill out the
form and provide some proof of enrollment at a college or university
for fall of 2013.

http://www.trondeau.com/grcon2013-student-registration/

This is not a US-only offer. All students are eligible!

And please remember to thank Matt and Ettus Research for their
dedication and support of students working in software radio.

-- 
Tom
Visit us at GRCon13 Oct. 1 - 4
http://www.trondeau.com/grcon13

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


[Discuss-gnuradio] Low cost SDR compatible with openbts and gnuradio

2013-08-04 Thread James Jordan
Hi list,
I want to introduce an sdr which compatible with openbts and gnuradio.
the sdr have one tx and one rx in a sigle board. Use usb to connect to
computer.
the price is 450$ per unit.

Regards

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