Reading Other People's Flowgraphs
Most flowgraphs you will ever learn
from were drawn by someone else: a
tutorial's download, a club project's
repository, the example files GNU Radio
itself ships (the lab read several
while building its own). This chapter
teaches the reading order — how to take
a stranger's .grc file apart on the
page, find its rates, find its
assumptions, and know before you run
it what it will try to do. Everything
claimed here about the file format was
verified against the lab's own drawing
and the shipped examples.
The file is a book, not a binary
A .grc file is YAML: indented
plain text, and it survives being read
in an editor. Its anatomy, top to
bottom:
options:— the graph's own settings: itsid, title, author, whether it expects a GUI (generate_options: qt_guiorno_gui), and — treasure for chapter 16's "it worked yesterday" — the drawing's provenance is a text file's history, while the generated Python stamps the GNU Radio version that made it in its header comments (the lab's generated file announcesGNU Radio version: 3.10.9.2).blocks:— every block on the canvas, listed bynameandid(its type), with aparameters:list giving every setting in words:freq: '1000',cutoff_freq: '1500',file: tone_raw_grc.cfile. Nothing about a block's behaviour hides anywhere else.connections:— the wires, as four-part lists: source block, output port, destination block, input port. Chapter 5's lab file ends:
- [blocks_head_0, '0', low_pass_filter_0, '0']
- [low_pass_filter_0, '0', blocks_file_sink_1, '0']
Read them in order and you have walked the graph.
The reading order that works
- Find
samp_rateand its kin. Flowgraphs keep their rates in variable blocks (chapter 5); every other number in the file is meaningless until you know them. Note also derived variables — an audio rate defined assamp_rate/10is a decimation wearing a disguise, and it counts. - Walk the main chain from the
source that is not like the others
(the hardware block, or the file
source — the graph's claim about
where its world comes from) to the
sinks, using
connections:. Say each block's job in plain words as you pass it. The blocks you cannot describe are the reading list: look those up before running anything. - Track the rate changes. Every
decim,interpand resampler on the walk multiplies the rate by a factor. Write the running rate in the margin, block by block, exactly as chapter 16 will beg you to. A stranger's graph that lands on its audio sink at 44,100 while claiming 48,000 upstream has a bug with a forwarding address, and you just found it for free. - Interrogate the file paths. File sources and sinks carry paths — relative ones resolve against the directory you run from, not the one the author ran from. "It reads nothing" is very often "it reads a different nothing than you think".
- Run it headless first, if it
allows.
grcccompiles the drawing without the editor (chapter 5), the generated Python can be read before it is run, and a graph whose generation fails has told you its type errors for free. The lab ran its own drawing exactly this way and compared bytes with the hand-written twin.
Flowgraphs as literature, honestly
One caution above the technique:
a published flowgraph is code, with
code's trust questions. Blocks can
call Python, read and write files, and
drive transmitting hardware; a .grc
from the internet is a program from
the internet, and deserves the same
thirty seconds of reading before
running that this chapter just taught.
Licences ride along too — the blocks
are largely copyleft, example graphs
carry their authors' terms, and
criteria.md states this guide's own
answer for its own lab files. Reading
is the skill; trust is a decision you
make after the reading, not before it.
Check: open one of the shipped
examples (/usr/share/gnuradio/examples
on the lab's machine) and answer,
from the text alone: what is its
sample rate, what is its source, and
what rate does its last block before
the sink believe in? If the three
answers come quickly, you can read the
literature of this field — which is
what most of it is.