Capturing samples in order to run DoA using file and not in real time

Hello, I’m using the kraken sdr doa code and I’m wondering how easy it is to modify the code (if it’s not already supported) so I can capture the raw signal samples and save it to file. Then to load the file into the signal processing module and run different DoA algorithms in order to evaluate the performance of each. I know I can do it using the gnuradio block but I’d rather do it using the signal processor python code to spice up all those logging utilities like timestamped csv files which as I’ve seen are not supported in the GRC block

That shouldn’t be too difficult if you are a coder and familiar with Python.

1 Like

I assume that I have to replace a receive like function with a function reading from file.

Exactly, have a look at the code in and see how data is received into the buffers in the function get_iq_online. Then you could create something that emulates heimdall which serves the IQ data.

1 Like

Hi Carl, Would the code below work for saving one frame of data? Then as a quick and dirty solution to play it back, I was thinking of reading back from the file and setting buffer equal to the file contents. It would only be be one frame but if it works, that’s all I would need.

if self.recordiq == True:
current_datetime =
filename = current_datetime.strftime(“%Y-%m-%d_%H-%M-%S”)
filename = filename + “.npy”
filebuffer = buffer.astype(np.uint8) # Convert to uint8 (data type in the shmem iface for buffer)

I think that would work fine. If it doesn’t let me know and I’ll confirm with our lead dev on the best way to implement it.

Hey Johnny, would you mind sharing how you achieved this? I’m trying to do the same thing but am having trouble saving a single IQ data frame. Which classes did you modify to save the raw data to a file?

In, get_iq_online function, I added the code below under where buffer gets assigned its value. I am running an earlier version of the code (late 2022) so not sure it works in the latest receiver. I should probably upgrade soon.

filename = current_datetime.strftime(“%Y-%m-%d_%H-%M-%S”)
filename = filename + “_IQ.npy”
filebuffer = buffer.astype(np.uint8)