Skip to content

Commit

Permalink
uhd sample recorder can write its own sigmf file now, so only write a…
Browse files Browse the repository at this point in the history
… meta if the SDR-dependant recorder tool doesn't provide one.
  • Loading branch information
anarkiwi committed Apr 4, 2024
1 parent 298d628 commit dfbb1c5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile.uhd-sr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libvulkan-dev \
sudo
WORKDIR /root
RUN git clone https://github.com/iqtlabs/uhd_sample_recorder -b v1.0.9
RUN git clone https://github.com/iqtlabs/uhd_sample_recorder -b v1.0.11
WORKDIR /root/uhd_sample_recorder
RUN ./bin/install-deps.sh && rm -rf VkFFT
COPY --from=iqtlabs/gamutrf-vkfft:latest /root /root/uhd_sample_recorder
Expand Down
42 changes: 22 additions & 20 deletions gamutrf/sdr_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,29 @@ def run_recording(
)

if sigmf_:
sigmf_file = sample_file + ".sigmf-meta"
if os.path.exists(sample_file):
meta = sigmf.SigMFFile(
skip_checksum=True, # expensive for large files
data_file=sample_file,
global_info={
sigmf.SigMFFile.DATATYPE_KEY: "_".join(
("c" + SAMPLE_TYPE, endianstr())
),
sigmf.SigMFFile.SAMPLE_RATE_KEY: sample_rate,
sigmf.SigMFFile.VERSION_KEY: sigmf.__version__,
},
)
# TODO: add capture_details, source_file and gain when supported.
meta.add_capture(
0,
metadata={
sigmf.SigMFFile.FREQUENCY_KEY: center_freq,
sigmf.SigMFFile.DATETIME_KEY: meta_time,
},
)
meta.tofile(sample_file + ".sigmf-meta")
if not os.path.exists(sigmf_file):
meta = sigmf.SigMFFile(
skip_checksum=True, # expensive for large files
data_file=sample_file,
global_info={
sigmf.SigMFFile.DATATYPE_KEY: "_".join(
("c" + SAMPLE_TYPE, endianstr())
),
sigmf.SigMFFile.SAMPLE_RATE_KEY: sample_rate,
sigmf.SigMFFile.VERSION_KEY: sigmf.__version__,
},
)
# TODO: add capture_details, source_file and gain when supported.
meta.add_capture(
0,
metadata={
sigmf.SigMFFile.FREQUENCY_KEY: center_freq,
sigmf.SigMFFile.DATETIME_KEY: meta_time,
},
)
meta.tofile(sigmf_file)
else:
logging.error("{sample_file} missing, cannot write sigmf file")
except subprocess.CalledProcessError as err:
Expand Down

0 comments on commit dfbb1c5

Please sign in to comment.