Search code examples
pythonqtgnuradiognuradio-companion

Customizing and understanding GnuRadio QT GUI Vector Sink


I have created a simple GnuRadio flowgraph in GNU Radio Companion 3.8 where I connect a Vector Source block (with vector [1,2,3,4,5]) to a QT GUI Vector Sink. When I run the flowgraph, I see a two lines: one which goes from 1 to 5 (as expected) and one which is perfectly horizontal at zero. If I set the reference level in the sink to something other than zero (e.g., 1), that line at zero remains (in addition to a line at the reference). Additionally, the legend in the upper right corner contains Min Hold and Max Hold buttons. An example is shown below:

enter image description here

I have a few questions:

  1. What is this line at zero? How do I get rid of it?
  2. How do I get rid of the Min and Max Hold options in the upper right of the plot?
  3. In general, is it true that finer control of the formatting of plots in GNURadio is possible when explicitly writing code (say in a python-based flowgraph) to render the plot instead of using companion?

Solution

  • The vector plot puts markers (horiz lines) at the "LowerIntensityLevel" and "UpperIntensityLevel". It seems like they are both at 0 unless something sets them. There are functions in VectorDisplayPlot to set the levels, but nothing calls them. VectorDisplayPlot is the graphical Qt-based widget that does the actual plot display.

    These markers default to on. Which seems wrong to me, since nothing sets them and they have no default value, so it seems like you wouldn't want them unless you are going to use them.

    The line style, color, and if they are enabled or not are style properties of the VectorDisplayPlot. The "dark.qss" theme turns them off, but the default theme has them on.

    So you can turn them off with a theme.

    The important parts for the theme are:

    VectorDisplayPlot {
        qproperty-marker_lower_intensity_visible: false;
        qproperty-marker_upper_intensity_visible: false;
        qproperty-marker_ref_level_visible: false;
    }
    

    It should be possible to make a .qss file with just that in it. Get GRC to use it with the flow graph in the properties of the Options block under "QSS Theme". The "ref_level" line is only needed to make the ref level marker go away.

    Example with upper, lower, and ref level markers off

    The VectorDisplayPlot is a private member of vector_sink, which is the GNU Radio block that one uses. I see no methods in vector_sink_impl that ever set the upper/lower intensity values, and since only that class has access to the private VectorDisplayPlot, there's no way anything else could set them either. So the feature is totally unusable from any code (Python/C++) using the vector sink, much less from GRC.

    It looks like these markers are used for some of the other plots, like the spectrum plot. I think someone cut & pasted that code into the vector plot and this behavior is a bug.