Re: [Discuss-gnuradio] Calling functions from flowgraph ?
On Fri, Jun 6, 2014 at 12:07 AM, Activecat wrote: > Please stay on the list. > > On Thu, Jun 5, 2014 at 11:42 PM, Abouda Yassine > wrote: > >> Hi, >> Well,in fact that is not my question.I am going to explain with an >> example let's say I am using a random source which generates numbers >> between 0 and 255,and store them >> in a file sink.Then I would like to output the numbers above 100 in >> terminal.So I am going to need a small function containing an if >> condition.Suppose I wrote this function in a seperate python file and i >> would like to import it from the flowgraph without using the generated file >> you talked about(top_block.py).Is that possible?Does the GRC offer this >> kind of functionality.I hope that I you get the idea. >> >> regards, >> yassine >> > > > The top_block.py is a valid python file, you could amend it accordingly to > include additional "import XXX" statement, as long as it is valid in python > language. > > In this case you have to edit the top_block.py by hand, this cannot be > done from the GRC. > > Hope this answers your question. > Nevertheless this won't gain you any benefit, because you won't be able to use your function directly in the flowgraph. The correct way is explained in [1]. 1. http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Calling functions from flowgraph ?
Please stay on the list. On Thu, Jun 5, 2014 at 11:42 PM, Abouda Yassine wrote: > Hi, > Well,in fact that is not my question.I am going to explain with an example > let's say I am using a random source which generates numbers between 0 and > 255,and store them > in a file sink.Then I would like to output the numbers above 100 in > terminal.So I am going to need a small function containing an if > condition.Suppose I wrote this function in a seperate python file and i > would like to import it from the flowgraph without using the generated file > you talked about(top_block.py).Is that possible?Does the GRC offer this > kind of functionality.I hope that I you get the idea. > > regards, > yassine > The top_block.py is a valid python file, you could amend it accordingly to include additional "import XXX" statement, as long as it is valid in python language. In this case you have to edit the top_block.py by hand, this cannot be done from the GRC. Hope this answers your question. ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Calling functions from flowgraph ?
On Thu, Jun 5, 2014 at 5:07 PM, Abouda Yassine wrote: > Hi everybody, > > well,I had a python script which works with gnuradio and outputs results > on the terminal.To make it more visual,I made all the blocks on the > gnuradio-comapnion but now I would like to output the results on the > terminal which means I have to call the main loop in the python script from > the flowgraph to get the job done.In other words,when I hit the button > execute the flowgraph,I want to see the porgram running.I hope you > understood what I'm trying to do.So,how can I do that? > I think I understand your requirements. You just need to perform these steps: Step 1: In GRC (gnuradio-companion), open the flowgraph and then press F5 (or, click menu Build --> Generate) This will generate a new file: "top_block.py" The file is located at the same directory where your *.grc file is located. Step 2: Open a terminal, cd to directory of the top_block.py, execute it: python top_block.py With this you will see all python outputs at this terminal. Is this exactly what you asking for..? P/S: In fact Marcus Muller had already answered your question in above message. ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Calling functions from flowgraph ?
2014-06-05 11:07 GMT+02:00 Abouda Yassine : > Hi everybody, > > well,I had a python script which works with gnuradio and outputs results > on the terminal.To make it more visual,I made all the blocks on the > gnuradio-comapnion but now I would like to output the results on the > terminal which means I have to call the main loop in the python script from > the flowgraph to get the job done.In other words,when I hit the button > execute the flowgraph,I want to see the porgram running.I hope you > understood what I'm trying to do.So,how can I do that? > > regards, > -Yassine > ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Calling functions from flowgraph ?
Hi Abouda, in GNU Radio, there's no real main loop; I don't really know what you're trying to do. The python files GNU Radio generates are executables, you can just run them in a terminal without GRC :) Greetings, Marcus On 05.06.2014 11:07, Abouda Yassine wrote: > Hi everybody, > > well,I had a python script which works with gnuradio and outputs results on > the terminal.To make it more visual,I made all the blocks on the > gnuradio-comapnion but now I would like to output the results on the > terminal which means I have to call the main loop in the python script from > the flowgraph to get the job done.In other words,when I hit the button > execute the flowgraph,I want to see the porgram running.I hope you > understood what I'm trying to do.So,how can I do that? > > regards, > -Yassine > > > > ___ > 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] Calling functions from flowgraph ?
Hi everybody, well,I had a python script which works with gnuradio and outputs results on the terminal.To make it more visual,I made all the blocks on the gnuradio-comapnion but now I would like to output the results on the terminal which means I have to call the main loop in the python script from the flowgraph to get the job done.In other words,when I hit the button execute the flowgraph,I want to see the porgram running.I hope you understood what I'm trying to do.So,how can I do that? regards, -Yassine ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio