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 7b41c28
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docker/Dockerfile.uhd-sr
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ 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
WORKDIR /root/uhd_sample_recorder/build
RUN CMAKE_BUILD_TYPE=Release cmake ../lib && make -j $(nproc) && cp uhd_sample_recorder /usr/local/bin
RUN ./bin/build.sh && cp build/uhd_sample_recorder /usr/local/bin

FROM ubuntu:22.04
COPY --from=uhd_sample_recorder-builder /usr/local /usr/local
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 7b41c28

Please sign in to comment.