summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMarc L <marcll@vt.edu>2020-03-20 22:53:37 -0400
committerMartin Braun <martin@gnuradio.org>2020-03-29 21:56:00 -0700
commit046793f8d22a774107adabdce02eb65f95b53d2e (patch)
tree4dd042106581cccf0ab7a747a75671b5c42794bc /docs
parent5fb153ce51c192ed1d1fac71b2e26b9a857d9b7d (diff)
docs: updated usage manual export from wiki
Diffstat (limited to 'docs')
-rw-r--r--docs/usage-manual/(exported from wiki) Block Thread Affinity and Priority.txt12
-rw-r--r--docs/usage-manual/(exported from wiki) Configuration Files.txt11
-rw-r--r--docs/usage-manual/(exported from wiki) GNURadioCompanion.txt26
-rw-r--r--docs/usage-manual/(exported from wiki) Handling Flowgraphs.txt13
-rw-r--r--docs/usage-manual/(exported from wiki) Logging.txt11
-rw-r--r--docs/usage-manual/(exported from wiki) Message Passing.txt22
-rw-r--r--docs/usage-manual/(exported from wiki) Metadata Information.txt11
-rw-r--r--docs/usage-manual/(exported from wiki) Performance Counters.txt12
-rw-r--r--docs/usage-manual/(exported from wiki) Polymorphic Types (PMTs).txt38
-rw-r--r--docs/usage-manual/(exported from wiki) Polyphase Filterbanks.txt11
-rw-r--r--docs/usage-manual/(exported from wiki) Stream Tags.txt73
-rw-r--r--docs/usage-manual/(exported from wiki) Tagged Stream Blocks.txt11
-rw-r--r--docs/usage-manual/(exported from wiki) Types of Blocks.txt30
-rw-r--r--docs/usage-manual/(exported from wiki) VOLK Guide.txt12
14 files changed, 190 insertions, 103 deletions
diff --git a/docs/usage-manual/(exported from wiki) Block Thread Affinity and Priority.txt b/docs/usage-manual/(exported from wiki) Block Thread Affinity and Priority.txt
index 2358034b11..50108091b3 100644
--- a/docs/usage-manual/(exported from wiki) Block Thread Affinity and Priority.txt
+++ b/docs/usage-manual/(exported from wiki) Block Thread Affinity and Priority.txt
@@ -3,17 +3,17 @@
<ns>0</ns>
<id>3489</id>
<revision>
- <id>4226</id>
- <parentid>4225</parentid>
- <timestamp>2018-06-11T05:08:53Z</timestamp>
+ <id>4873</id>
+ <parentid>4226</parentid>
+ <timestamp>2019-03-12T22:43:51Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <comment>/* Setting Affinity for a gr::hier_block2 */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="4603">== Block Thread Affinity ==
+ <text xml:space="preserve" bytes="4629">[[Category:Usage Manual]]
+== Block Thread Affinity ==
In the thread-per-block scheduler, you can set the block's core
affinity. Each block can be pinned to a group cores or be set back
@@ -123,7 +123,7 @@ sched_get_priority_max and may only allow 32 distinct values to be
set.
NOTE: Not available on Windows or OSX.</text>
- <sha1>aj61n4ohuw7m8gm3g0j4qaa5eamqvpm</sha1>
+ <sha1>pwx0q0pno6nkzeprixgaxmmzhayfmk2</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Configuration Files.txt b/docs/usage-manual/(exported from wiki) Configuration Files.txt
index 464524c62c..b818559f51 100644
--- a/docs/usage-manual/(exported from wiki) Configuration Files.txt
+++ b/docs/usage-manual/(exported from wiki) Configuration Files.txt
@@ -3,16 +3,17 @@
<ns>0</ns>
<id>3490</id>
<revision>
- <id>4228</id>
- <timestamp>2018-06-11T05:11:22Z</timestamp>
+ <id>4874</id>
+ <parentid>4228</parentid>
+ <timestamp>2019-03-12T22:43:56Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <comment>Created page with "== Configuration / Preference Files == GNU Radio defines some of its basic behavior through a set of configuration files located in ${prefix}/etc/gnuradio/conf.d. Different c..."</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="2711">== Configuration / Preference Files ==
+ <text xml:space="preserve" bytes="2737">[[Category:Usage Manual]]
+== Configuration / Preference Files ==
GNU Radio defines some of its basic behavior through a set of
configuration files located in
@@ -82,7 +83,7 @@ The "GR_CONF_" is a prefix to identify this as a GNU Radio
configuration variable and the section and option names are in
uppercase. The value is the same format that would be used in the
config file itself.</text>
- <sha1>3tjlcfewvu2log4t9s6q45upgqh8rwo</sha1>
+ <sha1>e8qpaipnj5q10iyngqrtnz8btlg3xm9</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) GNURadioCompanion.txt b/docs/usage-manual/(exported from wiki) GNURadioCompanion.txt
index 1be03e42f2..6dad4e6a1b 100644
--- a/docs/usage-manual/(exported from wiki) GNURadioCompanion.txt
+++ b/docs/usage-manual/(exported from wiki) GNURadioCompanion.txt
@@ -3,17 +3,19 @@
<ns>0</ns>
<id>47</id>
<revision>
- <id>4311</id>
- <parentid>4310</parentid>
- <timestamp>2018-06-26T19:59:29Z</timestamp>
+ <id>6247</id>
+ <parentid>6246</parentid>
+ <timestamp>2019-10-22T15:57:56Z</timestamp>
<contributor>
- <username>777arc</username>
- <id>632</id>
+ <username>Duggabe</username>
+ <id>846</id>
</contributor>
- <comment>/* Special Thanks */</comment>
+ <minor/>
+ <comment>/* Filter Design correct grammer */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="22088">= GNU Radio Companion =
+ <text xml:space="preserve" bytes="22162">[[Category:Usage Manual]]
+= GNU Radio Companion =
GNU Radio Companion (GRC) is a graphical tool for creating signal flow graphs and generating flow-graph source code. There is a [[WorkingGroups|GNU Radio Companion Working Group]] handling the development.
@@ -123,7 +125,7 @@ The variable block is the most basic way to use a variable in GRC. The ID parame
=== Variable Controls ===
-Certain blocks have callback methods that allow their parameters to be changed while executing flow graph. Variable controls in GRC use variables in combination with callback methods to modify these parameters. If a parameter has a callback method, the parameter will be underlined in the block-properties dialog. The variable slider, variable text box, and the variable chooser block provide graphical widgets such as sliders, text boxes, radio buttons, and drop downs as variable controls. In addition, the variable sink block takes samples from a gnuradio stream and writes the samples to a variable.
+Certain blocks have callback methods that allow their parameters to be changed while executing flow graph. Variable controls in GRC use variables in combination with callback methods to modify these parameters. If a parameter has a callback method, the parameter will be underlined in the block-properties dialog. The variable slider, variable text box, and the variable chooser block provide graphical widgets such as sliders, text boxes, radio buttons, and drop downs as variable controls. In addition, the [[Probe Signal]] combined with [[Function Probe]] blocks takes samples from a gnuradio stream and writes the samples to a variable.
=== String Evaluation ===
@@ -135,7 +137,7 @@ To use a variable inside a string simply type the name of the variable into the
== Filter Design ==
-Many blocks in gnuradio that take an array of complex or real taps as a parameter. GNU Radio provides a package to generate all kinds of filter and window taps. See the [http://gnuradio.org/doc/doxygen/classgr+firdes.html firdes package] from the gnuradio documentation.
+Many blocks in gnuradio take an array of complex or real taps as a parameter. GNU Radio provides a package to generate all kinds of filter and window taps. See the [https://www.gnuradio.org/doc/doxygen/classgr_1_1filter_1_1firdes.html firdes package] from the gnuradio documentation.
=== Firdes Taps Generators ===
@@ -420,8 +422,8 @@ Set the '''GRC_BLOCKS_PATH''' environment variable to a path that contains your
== Special Thanks ==
-* '''[http://www.cer.jhu.edu/| CER Technology Fellowship]:''' initial funding
-* '''[http://www.ece.jhu.edu/~cooper/| A. Brinton Cooper]:''' starting the project
+* '''[http://www.cer.jhu.edu/ CER Technology Fellowship]:''' initial funding
+* '''[http://www.ece.jhu.edu/~cooper/ A. Brinton Cooper]:''' starting the project
* '''Patrick Mulligan:''' starting the project
* '''William R. Kenan Jr. Fund:''' usrp & computers
* '''Patrick Strasser:''' the GRC icon
@@ -431,7 +433,7 @@ Set the '''GRC_BLOCKS_PATH''' environment variable to a path that contains your
[http://www.joshknows.com/grc#screenshots Screen Shots]
Feel free to submit your own screen shots or flow graphs.</text>
- <sha1>m9jzkey4r3k9dc2qhm3u4qpz4gbegaf</sha1>
+ <sha1>e27hwprs9rgxfxv6iiy7zns4v9kmde5</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Handling Flowgraphs.txt b/docs/usage-manual/(exported from wiki) Handling Flowgraphs.txt
index b5deada42a..7266e44f74 100644
--- a/docs/usage-manual/(exported from wiki) Handling Flowgraphs.txt
+++ b/docs/usage-manual/(exported from wiki) Handling Flowgraphs.txt
@@ -3,18 +3,17 @@
<ns>0</ns>
<id>3480</id>
<revision>
- <id>4291</id>
- <parentid>4290</parentid>
- <timestamp>2018-06-26T19:41:49Z</timestamp>
+ <id>4863</id>
+ <parentid>4291</parentid>
+ <timestamp>2019-03-12T22:42:43Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <minor/>
- <comment>/* Reconfiguring Flowgraphs */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="10039">== Operating a Flowgraph ==
+ <text xml:space="preserve" bytes="10065">[[Category:Usage Manual]]
+== Operating a Flowgraph ==
The basic data structure in GNU Radio is the flowgraph, which
represents the connections of the blocks through which a continuous
@@ -273,7 +272,7 @@ the max noutput_items both locally and globally.
if __name__ == "__main__":
main()
</syntaxhighlight></text>
- <sha1>3arcnnd2d65pytajld93l8nvlqplnps</sha1>
+ <sha1>rggsk6ltg0cpkpujkwarub0b27ji35z</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Logging.txt b/docs/usage-manual/(exported from wiki) Logging.txt
index acc288ab3f..cd49e4ff54 100644
--- a/docs/usage-manual/(exported from wiki) Logging.txt
+++ b/docs/usage-manual/(exported from wiki) Logging.txt
@@ -3,16 +3,17 @@
<ns>0</ns>
<id>3484</id>
<revision>
- <id>4183</id>
- <timestamp>2018-05-15T19:17:50Z</timestamp>
+ <id>4871</id>
+ <parentid>4183</parentid>
+ <timestamp>2019-03-12T22:43:41Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <comment>first shot</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="9367">GNU Radio has a logging interface to enable various levels of logging
+ <text xml:space="preserve" bytes="9393">[[Category:Usage Manual]]
+GNU Radio has a logging interface to enable various levels of logging
information to be printed to the console or a file. The logger derives
from [http://log4cpp.sourceforge.net log4cpp] which is readily
available in most Linux distributions. This is an optional dependency
@@ -224,7 +225,7 @@ You can isntantiate this by the following. (Reference logger.h for list of meth
log=gr.logger("nameOfLogger")
log.debug("Log a debug message")
log.set_level("INFO");</text>
- <sha1>at9a5on70hlibjm75oo3rtgswcsu1u9</sha1>
+ <sha1>iihlmg3bam2b9a6q1yy1inpzt8az1ve</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Message Passing.txt b/docs/usage-manual/(exported from wiki) Message Passing.txt
index 4654bd5dac..9abb0084a8 100644
--- a/docs/usage-manual/(exported from wiki) Message Passing.txt
+++ b/docs/usage-manual/(exported from wiki) Message Passing.txt
@@ -3,17 +3,18 @@
<ns>0</ns>
<id>3481</id>
<revision>
- <id>4294</id>
- <parentid>4287</parentid>
- <timestamp>2018-06-26T19:55:38Z</timestamp>
+ <id>6529</id>
+ <parentid>4868</parentid>
+ <timestamp>2020-01-13T17:35:27Z</timestamp>
<contributor>
- <username>777arc</username>
- <id>632</id>
+ <username>Mormj</username>
+ <id>802</id>
</contributor>
- <comment>/* Code Examples */</comment>
+ <comment>/* Message Handler Functions */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="15505">== Introduction ==
+ <text xml:space="preserve" bytes="15759">[[Category:Usage Manual]]
+== Introduction ==
GNU Radio was originally a streaming system with no other mechanism to
pass data between blocks. Streams of data are a model that work well
@@ -96,6 +97,11 @@ Boost's 'bind' function:
set_msg_handler(pmt::pmt_t port_id,
boost::bind(&block_class::message_handler_function, this, _1));
+Or starting in GNU Radio 3.8 using C++11 we can avoid Boost and express the binding as a lambda function (preferred)
+
+ set_msg_handler(pmt::pmt_t port_id,
+ [this](pmt::pmt_t msg) { this->message_handler_function(msg); });
+
In Python:
self.set_msg_handler(pmt.intern("port name"), <msg handler function>)
@@ -358,7 +364,7 @@ A Python Block example:
def handle_msg(self, msg):
self.message_port_pub(pmt.intern('msg_out'), pmt.intern('message received!'))
</syntaxhighlight></text>
- <sha1>2o3zxqazokbseo12y27nl24a8nuw50r</sha1>
+ <sha1>es5ic6domqmdirvs8232ksas04tdf0n</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Metadata Information.txt b/docs/usage-manual/(exported from wiki) Metadata Information.txt
index 410e6ad66f..289d035534 100644
--- a/docs/usage-manual/(exported from wiki) Metadata Information.txt
+++ b/docs/usage-manual/(exported from wiki) Metadata Information.txt
@@ -3,16 +3,17 @@
<ns>0</ns>
<id>3479</id>
<revision>
- <id>4293</id>
- <parentid>4159</parentid>
- <timestamp>2018-06-26T19:54:28Z</timestamp>
+ <id>4867</id>
+ <parentid>4293</parentid>
+ <timestamp>2019-03-12T22:43:19Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="14458">== Introduction ==
+ <text xml:space="preserve" bytes="14484">[[Category:Usage Manual]]
+== Introduction ==
Metadata files have extra information in the form of headers that
carry metadata about the samples in the file. Raw, binary files carry
@@ -337,7 +338,7 @@ encoded as a vector of uint16 with [day, month, year].
blocks.GR_FILE_FLOAT, True,
1000000, extra_str, False)
</syntaxhighlight></text>
- <sha1>8f3uw6sq1s6a90diya9eycq96qyzdr3</sha1>
+ <sha1>swg5klnvnjj6ehkn82c6078mgq3mnaz</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Performance Counters.txt b/docs/usage-manual/(exported from wiki) Performance Counters.txt
index 7735bfc840..8e85266865 100644
--- a/docs/usage-manual/(exported from wiki) Performance Counters.txt
+++ b/docs/usage-manual/(exported from wiki) Performance Counters.txt
@@ -3,17 +3,17 @@
<ns>0</ns>
<id>3485</id>
<revision>
- <id>4185</id>
- <parentid>4184</parentid>
- <timestamp>2018-05-15T19:32:41Z</timestamp>
+ <id>4872</id>
+ <parentid>4185</parentid>
+ <timestamp>2019-03-12T22:43:46Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <comment>/* Run-time Config */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="3590">== Introduction ==
+ <text xml:space="preserve" bytes="3616">[[Category:Usage Manual]]
+== Introduction ==
Each block can have a set of Performance Counters that the schedule
keeps track of. These counters measure and store information about
@@ -94,7 +94,7 @@ counters. This application is particularly useful in learning which
blocks are the computationally complex blocks that could use extra
optimization or work to improve their performance. It can also be used
to understand the current 'health' of the application.</text>
- <sha1>fwupl0jgeaweqt982b4ly5ycqonuce0</sha1>
+ <sha1>rx725rwa6ws4e2bbgxxgyqpks51j041</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Polymorphic Types (PMTs).txt b/docs/usage-manual/(exported from wiki) Polymorphic Types (PMTs).txt
index 15f2a22450..fac9831702 100644
--- a/docs/usage-manual/(exported from wiki) Polymorphic Types (PMTs).txt
+++ b/docs/usage-manual/(exported from wiki) Polymorphic Types (PMTs).txt
@@ -3,21 +3,23 @@
<ns>0</ns>
<id>3478</id>
<revision>
- <id>4292</id>
- <parentid>4157</parentid>
- <timestamp>2018-06-26T19:45:45Z</timestamp>
+ <id>6781</id>
+ <parentid>6780</parentid>
+ <timestamp>2020-03-20T01:28:28Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
+ <comment>/* Vectors */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="16713">== Introduction ==
+ <text xml:space="preserve" bytes="17533">[[Category:Usage Manual]]
+== Introduction ==
Polymorphic Types are opaque data types that are designed as generic
containers of data that can be safely passed around between blocks and
threads in GNU Radio. They are heavily used in the stream tags and
-message passing interfaces. The most complete list of PMT function is,
+message passing interfaces. In a sense, PMTs are a way to extend C++' strict typing with something more flexible. The most complete list of PMT function is,
of course, the source code, specifically the header file [https://gnuradio.org/doc/doxygen/pmt_8h.html pmt.h]. This page summarizes the most important features and points of PMTs.
Let's dive straight into some Python code and see how we can use
@@ -274,8 +276,8 @@ to get more information on what each does.
* pmt_t pmt::dict_values(pmt_t dict)
This example does some basic manipulations of PMT dictionaries in
-Python. Notice that we pass the dictionary \a a and return the results
-to \a a. This still creates a new dictionary and removes the local
+Python. Notice that we pass the dictionary ''a'' and return the results
+to ''a''. This still creates a new dictionary and removes the local
reference to the old dictionary. This just keeps our number of
variables small.
@@ -339,7 +341,15 @@ both signed and unsigned.
Vectors have a well-defined interface that allows us to make, set,
get, and fill them. We can also get the length of a vector with
-pmt::length.
+pmt::length, or in Python:
+
+ pmt_t p1 = pmt_integer(1);
+ pmt_t p2 = pmt_integer(2);
+ pmt_t p3 = pmt_integer(3);
+
+ pmt_t p_list = pmt_list3(p1, p2, p3);
+
+ pmt_length(p_list); // Returns 3
For standard vectors, these functions look like:
@@ -389,6 +399,16 @@ objects. They are manipulated using the following functions:
* void pmt::set_car(pmt_t pair, pmt_t value): Stores value in the car field
* void pmt::set_cdr(pmt_t pair, pmt_t value): Stores value in the cdr field
+And in Python we have:
+<syntaxhighlight lang="python">
+ pmt.is_pair(pair_obj) # Return True if is a pair, else False (warning: also returns True for a dict)
+ pmt.cons(x, y) # Return a newly allocated pair whose car is x and whose cdr is y
+ pmt.car(pair_obj) # If is a pair, return the car, otherwise raise wrong_type
+ pmt.cdr(pair_obj) # If is a pair, return the cdr, otherwise raise wrong_type
+ pmt.set_car(pair_obj, value) # Store value in car field
+ pmt.set_cdr(pair_obj, value) # Store value in cdr field
+</syntaxhighlight>
+
== Serializing and Deserializing ==
It is often important to hide the fact that we are working with PMTs
@@ -467,7 +487,7 @@ Two functions capture most of this functionality:
pmt.to_pmt # Converts a python object to a PMT.
pmt.to_python # Converts a PMT into a python object.
</syntaxhighlight></text>
- <sha1>c6dsjnpwev158d0di49ehocrpenc40z</sha1>
+ <sha1>6hbhl1y9zc4tlse9yp8hlf6n0m519m6</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Polyphase Filterbanks.txt b/docs/usage-manual/(exported from wiki) Polyphase Filterbanks.txt
index baa2e7ffed..1fb8526825 100644
--- a/docs/usage-manual/(exported from wiki) Polyphase Filterbanks.txt
+++ b/docs/usage-manual/(exported from wiki) Polyphase Filterbanks.txt
@@ -3,16 +3,17 @@
<ns>0</ns>
<id>3496</id>
<revision>
- <id>4513</id>
- <parentid>4318</parentid>
- <timestamp>2018-11-02T02:03:09Z</timestamp>
+ <id>4877</id>
+ <parentid>4513</parentid>
+ <timestamp>2019-03-12T22:44:11Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="7339">== Introduction ==
+ <text xml:space="preserve" bytes="7365">[[Category:Usage Manual]]
+== Introduction ==
Polyphase filterbanks (PFB) are a very powerful set of filtering tools
that can efficiently perform many multi-rate signal processing
@@ -152,7 +153,7 @@ should provide an error roughly equivalent to the quanization error of
using 16-bit fixed point representation. Generally, increasing over 32
provides some accuracy benefits without a huge increase in
computational demands.</text>
- <sha1>qgfvtgmqeoxutntovjunwzowmz49fvh</sha1>
+ <sha1>ctzii3mllzcd7uazhuv0yd5kflu7bvv</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Stream Tags.txt b/docs/usage-manual/(exported from wiki) Stream Tags.txt
index 4130d2e432..88ca4937a0 100644
--- a/docs/usage-manual/(exported from wiki) Stream Tags.txt
+++ b/docs/usage-manual/(exported from wiki) Stream Tags.txt
@@ -3,17 +3,17 @@
<ns>0</ns>
<id>3482</id>
<revision>
- <id>4286</id>
- <parentid>4285</parentid>
- <timestamp>2018-06-26T18:38:25Z</timestamp>
+ <id>6198</id>
+ <parentid>6191</parentid>
+ <timestamp>2019-09-30T20:17:37Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <comment>/* Getting tags from a Stream */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="10223">== Introduction ==
+ <text xml:space="preserve" bytes="12354">[[Category:Usage Manual]]
+== Introduction ==
GNU Radio was originally a streaming system with no other mechanism to
pass data between blocks. Streams of data are a model that work well
@@ -109,9 +109,38 @@ of the tag information in the function call:
const pmt::pmt_t &value,
const pmt::pmt_t &srcid=pmt::PMT_F);
-In Python, we can add a tag to a stream using:
-
- add_item_tag(which_output, abs_offset, key, value, srcid) # note that the key and value are both PMTs
+In Python, we can add a tag to a stream using one of the following:
+
+ add_item_tag(which_output, abs_offset, key, value)
+ add_item_tag(which_output, abs_offset, key, value, srcid)
+
+Note that the key and value are both PMTs. To create a string type PMT you can use pmt.intern("example_key")
+
+Here is an example of a Python block that loops through samples and puts tags on random ones, and outputs the same signal:
+<syntaxhighlight lang="python">
+ import numpy as np
+ from gnuradio import gr
+ import pmt
+
+ class blk(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name='Embedded Python Block',
+ in_sig=[np.complex64],
+ out_sig=[np.complex64]
+ )
+
+ def work(self, input_items, output_items):
+ for indx, sample in enumerate(input_items[0]):
+ if np.random.rand() > 0.95: # 5% chance this sample is chosen
+ key = pmt.intern("example_key")
+ value = pmt.intern("example_value")
+ self.add_item_tag(0, self.nitems_written(0) + indx, key, value)
+ # note: (self.nitems_written(0) + indx) is our current sample, in absolute time
+ output_items[0][:] = input_items[0] # copy input to output
+ return len(output_items[0])
+</syntaxhighlight>
=== Getting tags from a Stream ===
@@ -150,10 +179,34 @@ In Python, the main difference from the C++ function is that instead of having t
argument be a vector where the tags are stored, the Python version
just returns a list of tags. We would use it like this:
+<syntaxhighlight lang="python">
def work(self, input_items, output_items):
....
- tags = get_tags_in_window(which_input, rel_start, rel_end)
+ tags = self.get_tags_in_window(which_input, rel_start, rel_end)
....
+</syntaxhighlight>
+
+If you want to grab all tags on the samples currently being processed by work(), on input port 0, here's a minimal example of doing that:
+
+<syntaxhighlight lang="python">
+ import numpy as np
+ from gnuradio import gr
+ import pmt
+
+ class blk(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(self,name='Read Tags', in_sig=[np.float32], out_sig=None)
+
+ def work(self, input_items, output_items):
+ tags = self.get_tags_in_window(0, 0, len(input_items[0]))
+ for tag in tags:
+ key = pmt.to_python(tag.key) # convert from PMT to python string
+ value = pmt.to_python(tag.value) # Note that the type(value) can be several things, it depends what PMT type it was
+ print 'key:', key
+ print 'value:', value, type(value)
+ print ''
+ return len(input_items[0])
+</syntaxhighlight>
== Tag Propagation ==
@@ -230,7 +283,7 @@ potentially lost, we have lost track of the timing information. The
USRP driver recognizes when packets have been dropped and uses this to
queue another tag, which allows us to resync. Likewise, any point the
sample rate or frequency changes, a new tag is issued.</text>
- <sha1>q8so7nd8lqh1et3zmf8x28z6qxq2hwd</sha1>
+ <sha1>lh9drcohakf8o2pksgy2wpounqwfo3h</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Tagged Stream Blocks.txt b/docs/usage-manual/(exported from wiki) Tagged Stream Blocks.txt
index 91d09b0a15..9c9158547f 100644
--- a/docs/usage-manual/(exported from wiki) Tagged Stream Blocks.txt
+++ b/docs/usage-manual/(exported from wiki) Tagged Stream Blocks.txt
@@ -3,16 +3,17 @@
<ns>0</ns>
<id>3483</id>
<revision>
- <id>4295</id>
- <parentid>4181</parentid>
- <timestamp>2018-06-26T19:56:49Z</timestamp>
+ <id>4870</id>
+ <parentid>4295</parentid>
+ <timestamp>2019-03-12T22:43:37Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="13353">== Introduction ==
+ <text xml:space="preserve" bytes="13379">[[Category:Usage Manual]]
+== Introduction ==
A tagged stream block is a block that works on streamed, but packetized input data.
Think of packet data transmission: A data packet consists of N bytes. However, in
@@ -306,7 +307,7 @@ This means the input of a tagged stream block was not correctly tagged.
The most common cause is when connecting a regular streaming block to a tagged
stream block. You can check the log output for the item number and port where
this happened.</text>
- <sha1>bxtmw5rv49ajotlmqajew2eq22qmbry</sha1>
+ <sha1>79nex80832w5rj7e2dnhz7i9le1fono</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) Types of Blocks.txt b/docs/usage-manual/(exported from wiki) Types of Blocks.txt
index a68dee4180..a827f2ddb6 100644
--- a/docs/usage-manual/(exported from wiki) Types of Blocks.txt
+++ b/docs/usage-manual/(exported from wiki) Types of Blocks.txt
@@ -3,17 +3,19 @@
<ns>0</ns>
<id>3495</id>
<revision>
- <id>4281</id>
- <parentid>4280</parentid>
- <timestamp>2018-06-26T18:32:20Z</timestamp>
+ <id>6500</id>
+ <parentid>4864</parentid>
+ <timestamp>2020-01-05T18:46:42Z</timestamp>
<contributor>
- <username>777arc</username>
- <id>632</id>
+ <username>Duggabe</username>
+ <id>846</id>
</contributor>
- <comment>/* Synchronous Block */</comment>
+ <minor/>
+ <comment>correct Python examples</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="8059">== Introduction ==
+ <text xml:space="preserve" bytes="8123">[[Category:Usage Manual]]
+== Introduction ==
To take advantage of the gnuradio framework, users will create various blocks to implement the desired data processing. There are several types of blocks to choose from:
@@ -118,9 +120,9 @@ Some observations:
An example decimation block in Python:
<syntaxhighlight lang="python">
-class my_decim_block(gr.block):
+class my_decim_block(gr.decim_block):
def __init__(self, args):
- gr.block.__init__(self,
+ gr.decim_block.__init__(self,
name="my block",
in_sig=[numpy.float32],
out_sig=[numpy.float32])
@@ -167,9 +169,9 @@ Some observations:
An example interpolation block in Python:
<syntaxhighlight lang="python">
-class my_interp_block(gr.block):
+class my_interp_block(gr.interp_block):
def __init__(self, args):
- gr.block.__init__(self,
+ gr.interp_block.__init__(self,
name="my block",
in_sig=[numpy.float32],
out_sig=[numpy.float32])
@@ -239,9 +241,9 @@ The adder revisited as a basic block in Python:
from gnuradio import gr
import gnuradio.extras
-class my_basic_adder_block(gr.block):
+class my_basic_adder_block(gr.basic_block):
def __init__(self, args):
- gr.block.__init__(self,
+ gr.basic_block.__init__(self,
name="another_adder_block",
in_sig=[...],
out_sig=[...])
@@ -269,7 +271,7 @@ class my_basic_adder_block(gr.block):
#return produced
return len(out)
</syntaxhighlight></text>
- <sha1>2twbp3b6eokenw23qolevp25jtaqk31</sha1>
+ <sha1>45ab6553658lbupm4hdgnjnvx9bl7dj</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file
diff --git a/docs/usage-manual/(exported from wiki) VOLK Guide.txt b/docs/usage-manual/(exported from wiki) VOLK Guide.txt
index 7e9ef1161e..0c3531a209 100644
--- a/docs/usage-manual/(exported from wiki) VOLK Guide.txt
+++ b/docs/usage-manual/(exported from wiki) VOLK Guide.txt
@@ -3,17 +3,17 @@
<ns>0</ns>
<id>3491</id>
<revision>
- <id>4296</id>
- <parentid>4232</parentid>
- <timestamp>2018-06-26T19:57:30Z</timestamp>
+ <id>4875</id>
+ <parentid>4296</parentid>
+ <timestamp>2019-03-12T22:44:00Z</timestamp>
<contributor>
<username>777arc</username>
<id>632</id>
</contributor>
- <comment>/* Calling VOLK kernels in Work() */</comment>
<model>wikitext</model>
<format>text/x-wiki</format>
- <text xml:space="preserve" bytes="6023">== Introduction ==
+ <text xml:space="preserve" bytes="6049">[[Category:Usage Manual]]
+== Introduction ==
Note: Many blocks have already been converted to use VOLK in their calls, so
they can also serve as examples. See the
@@ -147,7 +147,7 @@ complex streams together.
'''Tip:''' If benchmarking GNU Radio blocks, it can be useful to have a
volk_config file that sets all architectures to 'generic' as a way to
test the vectorized versus non-vectorized implementations.</text>
- <sha1>l1efbbjitjppeec1a99mjnlyimos14e</sha1>
+ <sha1>751jgw6850j6u6uclltkylfgnv85dac</sha1>
</revision>
</page>
</mediawiki> \ No newline at end of file