#!/usr/bin/env julia
# Example loader for the DisplayPort IQ data

using HDF5

h = h5open("dp-5m-800x600-testimage-1-1.h5")

fc = h["f"][]     # SDR centre frequency in Hz
fs = h["fs"][]    # SDR sampling rate in Hz
s = reinterpret(ComplexF16, h["s"][])   # IQ samples as complex numbers

# The IQ samples are stored as a byte array that needs to be
# interpreted as a sequence of little-endian IEEE 754 16-bit
# half-precision floating-point numbers (1 sign, 5 exponent, 10
# fraction bits, aka binary16 or float16), alternating real and
# imaginary parts. This representation was used because the HDF5
# standard supported neither complex numbers nor 16-bit floating-point
# numbers until very recently.
#
# The first few samples of s can be zero-valued, which is an artefact
# of the start-up behaviour of the Ettus UHD driver.
