Friday, April 7, 2017

[Discuss-gnuradio] File sink: file size

#plotData.py

""" This program will read in a data file from Gnu Radio and plot it.

Ellie White 25 Feb. 2017

"""

import pylab as plt
import os
import numpy as np

def main():

infile = input("Enter the name of the file to read >>> ")
srate = int(input("What is the sampling rate of your SDR? >>> "))
data = []

size = os.path.getsize(infile) / 4
shape = (size/1024, 1024)
x = np.memmap(infile, dtype='float32', mode = 'r', shape=shape)

idx = np.linspace(0, (len(x)*1024)/srate, len(x))

chan=522
ts = []
for i in x:
ts.append(i[chan]) #appends each time sample from this channel

freqPlot = np.mean(x, axis=0)
fidx = np.linspace(124000000, 126000000, len(freqPlot))

plt.plot(fidx, freqPlot)
plt.show()

plt.plot(idx, ts)
plt.show()


if __name__ == "__main__":
main()
Hello,

As I've mentioned in an earlier email to this list, I'm working on a small loop antenna with the purpose of monitoring solar activity. I am currently reading in the data through an RTL-SDR source, flowgraph attached.

For this project, I need to be able to let my antenna run for long periods of time (upwards of an hour or more, preferably several hours) in order to get a graph of signal intensity vs. time. Right now, my setup consists of the GNU Radio flowgraph attached, that produces a file which I analyze using a Python program to get a spectral plot and a time series (for one of the 1024 channels saved in the file).

I let my antenna and GNU Radio run for about 15 minutes last night collecting data, and the file size ended up at over 7 GB. I am wondering if there is any way to reduce the size of the file without tremendously reducing the quality of the data? I have a few ideas on this, but I'm hoping someone else will have better ones:

-Maybe I need to reduce the sample rate.

-Another option is to somehow just save the channel I need to the file, instead of all 1024. Does anyone have any advice as to how to accomplish that?

If you need any more information or if I should clarify anything, please let me know. Thanks!

Ellie

No comments:

Post a Comment