Forum: GNU Radio save date and value to an rotating file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Markus F. (Guest)
on 2009-05-14 09:32
(Received via mailing list)
Hi All,

i want to save my incoming values of peaks to a file, but with
the depending date. The file should also limited to size X or
to a number of samples.

I still read to make my own c++ and grc module, but i am
not very familiar with c++. i want to make it in python
and the the grc module to insert it into my grc App.

And i still read in the thread <Suitable Sink required> something
about <gr.message_sink and gr.msg_queues>.
Both are written in c++, not python, further on <gr.message_sink>
is a sink and can not connected to another sink.
Is the gr.msg_queues a sink and source ?

Any Ideas or hints ?

regards markus
Jason U. (Guest)
on 2009-05-14 16:59
(Received via mailing list)
> And i still read in the thread <Suitable Sink required> something
> about <gr.message_sink and gr.msg_queues>.
> Both are written in c++, not python, further on <gr.message_sink>
> is a sink and can not connected to another sink.
> Is the gr.msg_queues a sink and source ?

message_sink, message_source, and msg_queues operate hand in hand to
create a procedure for transferring your packets (arrays in python)
into the streams used in gnuradio modulation blocks.  Basically, when
you call the function (instance of: blks2.mod_pkts).send_pkt(payload,
eof), it creates the packet with the necessary headers and footers
then places into the message queue.  The modulator is then connected
to an instance of gr.message_source to read the packets from the
queue, serialized them and stream them to the modulator.  The setup
for message_source is the opposite of this.

I would have a look at 'blks2impl/pkt.py' for more information.


From your questions on the board I'm starting to wonder if your
application isn't complex enough that it would warrant being built in
strict python rather than GRC, it would certainly make your life
easier in terms of doing things like this:

> i want to save my incoming values of peaks to a file, but with
> the depending date. The file should also limited to size X or
> to a number of samples.

Jason
feldmaus (Guest)
on 2009-05-14 17:35
(Received via mailing list)
Jason U. <jasonuher <at> gmail.com> writes:

> From your questions on the board I'm starting to wonder if your
> application isn't complex enough that it would warrant being built in
> strict python rather than GRC, it would certainly make your life
> easier in terms of doing things like this:
>
Yes, my application is not complex, but not general. So there is no
support i think in grc.
Further on, if you make grc moduls, you have to use the sink and source
elements from gnuradio and can not process the input data through some
python functions.
connect(SOURCE(Gnuradio Source) ---> SINK(Gnuradio Sink))
Thats it ! No Python between this connection.

It would be nice to make all in GRC, but there is no module in GRC to
limit the size of an file. Further on i need to save the creation time
and the
finish time of the saved file. This simple task is only be done by
python or c++.

There are many simple function not realized in grc like the
mathematical root operation.

Many doesn't work, and so you have to do many by hand !

Thanks for your reply
regards Markus
Josh B. (Guest)
on 2009-05-14 21:43
(Received via mailing list)
> finish time of the saved file. This simple task is only be done by
> python or c++.
>

There is a block called gr.head (misc->head) that shuts-off after N
samples pass through.

and you can always add custom blocks that you write:
http://gnuradio.org/trac/wiki/GNURadioCompanion#Ad...

> There are many simple function not realized in grc like the
> mathematical root operation.
>
> Many doesn't work, and so you have to do many by hand !

Anything that you can fit into a line of python is possible, so for
square root:

1)
x**.5

2)
add an import block: import math
math.sqrt(x)

-Josh
Markus F. (Guest)
on 2009-05-15 00:53
(Received via mailing list)
Josh B. schrieb:

>
> There is a block called gr.head (misc->head) that shuts-off after N
> samples pass through.
I mean to cut off the last line in the file and append the new data
to the file. But as i saw this is still a performance problem, however
it would work for me, because i do not save as much data to the file.

>
> and you can always add custom blocks that you write:
> http://gnuradio.org/trac/wiki/GNURadioCompanion#Ad...
But Custom Blocks rely on custom sinks and sources. I need to
process the data through an own python file sink method, with rotate
and time feature.
Or is this still possible ?
As i understood, processing of data is made in c++ and the
connection+gui is made in python.
> x**.5
Thanks for the hint.
But which grc modul apply this mathematical function on incoming data
and outputs it ?
I mean to apply mathematical function to incoming data from an Usrp
Source not a constant variable.
>
> 2)
> add an import block: import math
> math.sqrt(x)
Do you mean,
import math; math.sqrt(x)

In one line with a semicolon ?
Yes thats working. I still tested it.

Regards Markus
Josh B. (Guest)
on 2009-05-15 01:13
(Received via mailing list)
>> and you can always add custom blocks that you write:
>> http://gnuradio.org/trac/wiki/GNURadioCompanion#Ad...
> But Custom Blocks rely on custom sinks and sources. I need to
> process the data through an own python file sink method, with rotate
> and time feature.
> Or is this still possible ?
> As i understood, processing of data is made in c++ and the
> connection+gui is made in python.

You can do it all in python by making a hier block, and using gr message
sinks and sources. See pkt.py as an example:

http://gnuradio.org/trac/browser/gnuradio/trunk/gn...

>> x**.5
> Thanks for the hint.
> But which grc modul apply this mathematical function on incoming data
> and outputs it ?
> I mean to apply mathematical function to incoming data from an Usrp
> Source not a constant variable.
>>


I think there is a block for this gr_feval_cc, gr_feval_ll, gr_feval_dd.
I have never used it, but I think the idea is that you can inherit from
this class and override the eval function in python.

-Josh
feldmaus (Guest)
on 2009-05-15 13:47
(Received via mailing list)
Josh B. <josh <at> joshknows.com> writes:

> You can do it all in python by making a hier block, and using gr message
> sinks and sources. See pkt.py as an example:
>
>
http://gnuradio.org/trac/browser/gnuradio/trunk/gn...

Thanks for your answer.

Can this block be used in grc ?
Further on this example has only a send method.

Would be nice if somebody work out some discription to
this module.

regards Markus
This topic is locked and can not be replied to.