Last active
January 16, 2018 12:46
-
-
Save transientlunatic/b22ddeaec426e58fdd2f19a531ca7c25 to your computer and use it in GitHub Desktop.
Snippet for loading a gnuradio data file into python
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 scipy | |
import re | |
data = scipy.fromfile(datafile, dtype=np.float32) | |
a = re.compile("ra(.*)dec(.*)time(.*).dat") | |
bandwidth = 4e6 | |
centre = 1420.4e6 | |
filepath = datafile.split('/') | |
s_ra = float(a.search(filepath[-1]).group(1)) | |
s_dec = float(a.search(filepath[-1]).group(2)) | |
s_time = a.search(filepath[-1]).group(3) | |
frequencies = np.linspace(centre - bandwidth/2, centre + bandwidth/2, 256)/1e6 | |
data = np.reshape(data, [-1,256]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment