Examples

This section explains some of the examples included with the PyRF source code.

Typical Usage:

python <example_file>.py [device_IP_when_needed]

discovery.py / twisted_discovery.py

These examples detect RTSA devices on the local network.

Example output:

R5700-427 180601-661 1.5.0 10.126.110.133
R5500-408 171212-007 1.5.0 10.126.110.123
R5500-418 180522-659 1.4.8 10.126.110.104

show_i_q.py / twisted_show_i_q.py

These examples connect to a device of IP specified on the command line, tunes it to a center frequency of 2.450 MHz then reads and displays one capture of 1024 i, q values.

Example output (truncated):

0,-20
-8,-16
0,-24
-8,-12
0,-32
24,-24
32,-16
-12,-24
-20,0
12,-32
32,-4
0,12
-20,-16
-48,16
-12,12
0,-36
4,-12

pyqtgraph_plot_single_capture.py / pyqtgraph_plot_block.py

These examples connect to a device of IP specified on the command line, tunes it to a center frequency, then continually capture and display the computed spectral data using pyqtgraph.

pyqtgraph_plot_sweep.py

This example connects to a device of IP specified on the command line, makes use of sweep_device.py to perform a single sweep entry monitoring and plots computed spectral results using pyqtgraph.

matplotlib_plot_sweep.py

This example connects to a device specified on the command line, and plots a large sweep of the spectrum using NumPy and matplotlib.

simple_gui

This folder contains a simple example on creating a GUI (using pyqtgraph along with Twisted) to plot real-time data acquired from ThinkRF’s RTSA device. It displays the spectral density data in the top plot, and the raw I &/or Q data (when available) in the lower plot.

Usage:

python run_gui.py <device_ip>