GNU Radio scopesink.py with more control over refresh rate, scales, and autorange

Jon Jacky

Revised    3 Feb 2006   Disable links to revised .py files, add note recommending CVS instead
Revised   31 Jan 2006   Make autorange optional, add v_scale and t_scale parameters
Begun     20 Jan 2006   Add frame_decim parameter


3 FEB 2006: THESE REVISIONS HAVE BEEN INCORPORATED INTO GNU RADIO CVS.
To obtain them, update your gnuradio-core, gr-wxgui, and gnuradio-examples modules. See:

http://lists.gnu.org/archive/html/discuss-gnuradio/2006-02/msg00007.html

This page is now provided as documentation only.


When the old GNU Radio scopesink runs on slower Macs (like a 1 GHZ G4 Powerbook), the scope traces do not always appear. Instead, the twirling beachball icon appears that indicates the program is too busy to update the panel.

The old GNU Radio scopesink always performs autoranging, continually adjusting the gain on the vertical axis to best fit the signal. This can be inconvenient; sometimes we would prefer a fixed gain on the vertical axis.

Here is a revised scopesink with more control over refresh rate, vertical and horizontal scales, and autorange.

scopesink.py   OBSOLETE. Update gnuradio-core and gr-wxgui from CVS instead.

There are three new parameters for the scope_sink_f and scope_sink_c constructors:

frame_decim  frame decimation factor, default = 1
v_scalevertical scale, units per division, default = None
t_scaletime scale, seconds per division, default = None

frame_decim provides optional control over the scope refresh rate. When frame_decim is set to N, the scope displays only 1 in N frames of data from the source. You typically find a different N for each flow graph, by trial and error. Start with 1 (the default if the frame_decim argument is omitted), which results in the same behavior as the standard version. If you see the beachball, restart scopesink and try 2. Keep increasing until you see the scope traces.

v_scale provides optional suppression of autoranging and selection of the initial vertical sensitivy (in dimensionless units per division). When v_scale is set to X, scopesink appears with X/div vertical sensitivity and autoranging off. Scopesink also appears with two new buttons: < (Increase vertical range), > (Decrease vertical range), and a new choice menu (Select autorange on/off), so you can change the vertical senstivity or select autoranging while scopesink is running. Setting v_scale to None (the default if the v_scale argument is omitted), results in the same behavior as the standard version: autoranging is always in effect and the new controls do not appear

v_scale is a float. You can assign any value, but scopesink will use the next larger (or equal) value in the sequence 0.002, 0.005, 0.01, ..., 2000.0, 5000.0, 10000.0

t_scale provides optional selection of the initial time base (in seconds per division). Setting t_scale to None (the default if the t_scale argument is omitted) results in the same behavior as the standard version: the initial time base is 50 us/div. As before, you can adjust the time base while scopesink is running by using the buttons (< Increase time base, > Decrease time base).

t_scale is a float. You can assign any value, but scopesink will use the next larger (or equal) value in the sequence 1.0e-7, 2.5e-7, 1.0e-6, ..., 0.010, 0.025, 0.050.

When you run the scopesink from the command line, you can set the three arguments in order: frame_decim, v_scale, and t_scale. For example:

pythonw scopesink.py 2 500 25e-6

The revised scopesink.py is backward compatible with the standard version at the command line and at the function (and method) call level. If the new arguments are omitted, the behavior is the same as the standard version. If you install this version, code that used the old version will continue to work the same way.

To install this version of scopesink.py, so all your GNU Radio software uses version instead of the standard one, just copy this scopesink.py to your gr-wxgui/src/python build directory. In gr-wxgui, execute make install.

Here is a revised usrp_oscope that uses the new scopesink.

usrp_oscope.py   OBSOLETE. Update gnuradio-examples from CVS instead.

There are three new command line options for the new arguments:

-n   or   --frame_decim
-v   or   --v_scale
-t   or   --t_scale

For example,

pythonw usrp_oscope.py -g0 -f0 -d32 -n3 -v100 --t_scale=10e-6

If the new options are omitted, the revised usrp_oscope behaves like the old one. However, you must install the new scopesink to use this version of usrp_oscope.

I usually run GNU Radio on Mac OS X, but these revisions have also been tested on Linux (Fedora Core 3).

GNU Radio on Mac OS X


Jon Jacky, jon@u.washington.edu