Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read IQ from file #32

Open
debnei opened this issue Jun 15, 2024 · 2 comments
Open

Read IQ from file #32

debnei opened this issue Jun 15, 2024 · 2 comments
Labels

Comments

@debnei
Copy link

debnei commented Jun 15, 2024

I have some raw IQ files (i.e. 2 x uint8 interleaved) output by rtl-sdr for a propagation experiment during the recent solar eclipse and I would rather like to use the backend of rtl-power-fftw to read them and generate power spectra which are directly comparable with those I would get using rtl-power-fftw to control the device as well as calculate and average the spectra. Is this easily possible, by any chance?

My files were made like this: ./rtl_sdr -f 6675000 -s 2048000 -D -n expr 7200 \* 2048000 , i.e. a couple of hours of recording direct sampled HF data centred at 6675 kHz and sampled at 2048000 per sec.

Happy to test with my direct sampled data and/or with a higher frequency band where I and Q are both relevant. I have plenty of signal processing experience but no C++. At the moment I am converting everything to float and reading in gqrx, where I can remind it what the true centre frequency was via the input line and obtain a waterfall display as a sanity check.

@alajovic
Copy link
Member

rtl_power_fftw was conceived out of the need to analyze and average the incoming signal in real time, thus avoiding the need to store extensive amounts of raw data for later processing. So in this respect, the very purpose and design of the utility is diametrically opposite to what you are trying to do. The program can be adapted to do it, but the answer to whether this is easily possible depends rather strongly on one's definition of easily.

The easiest way I see would be to modify the Rtlsdr class in device.h and device.cpp so that the signal samples would be read from a file instead of a hardware device. Signal readout is done in Rtlsdr::read(), so that's the one to look at. Other functions in the class would no longer be relevant without a hardware device, so they could be replaced with simple dummy implementations – for example set_frequency() could just store the argument in a member variable, and frequency() would return the stored value. The idea is to coarsely mock a rtl-sdr device so that the rest of the program can stay unmodified.

If you (or someone else) will tackle this, I strongly recommend basing your changes on the testing branch in the repository. The version of rtl_power_fftw in the testing branch has the capability of running on multiple CPU cores in parallel, whereas the one in master can only occupy one core. Due to the fairly tame sampling rate of rtl-sdr dongles, this does not make a difference in real-time processing on virtually all modern hardware, but for processing several hours of offline data, it certainly would.

@debnei
Copy link
Author

debnei commented Jun 22, 2024

I will have a look, although I will be floundering around pasting code from elsewhere without actually understanding C++. I will probably end up in Matlab instead, just due to familiarity with prototyping this sort of thing there.

I (conveniently for me) think the use case is within your design philosophy. If I only want a spectrum, this is the best tool for the job, but if I see transient features on a spectrum that I then want to investigate further, I am stuck if I haven't recorded the IQ too. In my eclipse case, those conditions are simply never going to repeat, so I just shovelled the data onto disk so as to look at broadband spectra later and compare the result against future, real time, less valuable spectra of normal diurnal variation in E and F layers over some weeks, for which rtl_power_fftw is perfect.

Thank you in any case for thinking about it, and indeed for implementing fftw so nicely here in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants