Plotting IQ Data from GNU Radio in Python & GNU Octave

1. Introduction

The purpose of this application note is to provide a means of reading, parsing and plotting IQ data captured with GNU Radio (i.e., gr.file_sink) using a simple Python script or GNU Octave. The data which we use in the Python and GNU Octave scripts was captured from the GNU Radio program found in Application Note 11 ( where four .dat files were captured, and can be downloaded here. In this example, we are using only the channel A data, titled Crimson_0M0HzLO_14M85HzDSP_1MSPS_ChA.dat.

2. Plotting IQ Data in Python

A script to separate the .dat file into IQ pairs and plot the data is found on our github page here. This is capable of separating a .dat file into in-phase and quadrature components, and plotting them IQ amplitude vs. samples or IQ Amplitude vs. time, as shown in Figure 1. It also allows you to view a .dat file in 3D, as shown in Figure 2.


When using the Python script, you will need to manually input your .dat file directory as well as sample rate in which you used to capture data.

Figure 1: Python Plot of IQ data in time

Figure 1: Python Plot of IQ data in time

3. Plotting IQ Data in GNU Octave

To use GNU Octave for plotting IQ data, you will need to add a path to your Octave path variable. More information about this is found here.

In order to parse the data, there are various built-in function to do this. For reading our .dat file, we used the following in GNU Octave: