Created
October 25, 2018 04:57
-
-
Save alexer/9efe768411cf6c68325cac750717b44b to your computer and use it in GitHub Desktop.
Convert rtl-sdr uint8-complex output file to a memory-mapped numpy complex128 array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def rtlsdr2numpy(datafilename, tempfilename): | |
real = np.memmap(datafilename, mode='r', dtype='uint8') | |
temp = np.memmap(tempfilename, mode='w+', dtype='float64', shape=real.shape) | |
temp[:] = real | |
temp /= 127.5 | |
temp -= 1 | |
return temp.view('complex128') | |
A = rtlsdr2numpy('data.dat', 'temp.dat') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment