A set of python applications for generating and viewing quadrature IQ binary files. Intended for use with software defined radios and lab test equipment.
- Tested with Python 2.7 and 3.6.
- Requires numpy and matplotlib.
Generates an binary IQ file of a user specified size.
Usage: python iqgen.py numberOfSamples
iqgen can generate files with three types of signal:
- Impulse signal [-i] (Default).
- Tone signal [-t Freq (Hz)].
- Random signal [-r].
- When generating the tone signal the sample rate can be specified using the [-fs FREQUENCY (Hz)] option.
- By default the sample rate is set to 1 MHz.
- The output data type can be set to [int8 | int16 | int32 | float16 | float32 | float64] using the [-f DATAFORMAT] option.
- By default the output type is set to int16.
- The amplitude of each signal can be set using the [-a AMPLITUDE] option.
- By default the amplitude is set to the full scale value to the selected data type.
- By default the endian is set to little endian.
- Big endian output can be selected using [-be].
- By default the I value is saved into the output file first.
- Q can be saved first by using the option [-qi].
- A suitable output filename is automatically generated based on the options selected.
- The default filename can be overridden using the [-o FILENAME] option.
Plots the I and Q data from a user specified binary file.
Usage: python iqplot.py filename
- The offset in bytes from the beginning of the file can be set using the [-o OFFSET (bytes)] option.
- This can be used to skip headers, etc at the beginning of the binary file.
- By default the offset is set to 0.
- The start sample can be set using the [-s STARTSAMPLE] option.
- This can be used in combination with the NUMBEROFSAMPLES option to only plot a specific part of a file.
- By default the start sample is set to 0.
- The number of sample to plot is set using the [-n NUMBEROFSAMPLES] option.
- By default all samples from the STARTSAMPLE to the end of the file will be plotted.
- When the sample rate can be specified using the [-fs FREQUENCY (Hz)] option.
- Setting the sample rate allows the the time and frequency axis labels to be correctly set.
- The input data type can be set to [int8 | int16 | int32 | uint8 | uint16 | uint32 | float16 | float32 | float 64] using the [-f DATAFORMAT] option.
- By default the data type is set to int16.
- By default the endian is set to little endian.
- Big endian output can be selected using [-be].
- By default the I value is assumed to be the first sample in the input file.
- If Q is the first sample in the input file then use the option [-qi].
- By default a time domain plot of the I and Q data will be displayed.
- A power spectral density plot can be displayed using the option -p psd.
- A spectrogram plot can be displayed using the option -p spec.
- The window used for the psd or spectrogram plots can be set to [rectangular | bartlett | blackman | hamming | hanning] using the command [-w WINDOWTYPE].
- When displaying a spectrogram plot the FFT width should be set using the option -fw FFTWIDTH.
- The overlap between each FFT in the spectrogram is set to FFTWIDTH/10.