Skip to content

Commit

Permalink
Merge pull request #1402 from anarkiwi/helpers
Browse files Browse the repository at this point in the history
serial numbers for inference, use calced center freq
  • Loading branch information
anarkiwi authored Sep 14, 2024
2 parents a9a4ac7 + 99e6678 commit 5bb0fca
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libvulkan-dev \
pybind11-dev
WORKDIR /root
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.118
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.119
COPY --from=iqtlabs/gamutrf-vkfft:latest /root /root/gr-iqtlabs
WORKDIR /root/gr-iqtlabs/build
COPY --from=iqtlabs/gamutrf-sigmf:latest /usr/local /usr/local
Expand Down
2 changes: 1 addition & 1 deletion gamutrf/grinferenceoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def run_reporter_thread(
item = self.q.get(block=True, timeout=1)
except queue.Empty:
continue
logging.info("inference output %u: %s", self.serialno, item)
self.serialno += 1
logging.info("inference output %u: %s", self.serialno, item)
if zmq_pub is not None:
zmq_pub.send_string(json.dumps(item) + DELIM, flags=zmq.NOBLOCK)
if mqtt_reporter is not None:
Expand Down
63 changes: 37 additions & 26 deletions gamutrf/grscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@ def __init__(
if description:
description = description.strip('"')
tune_step_hz = int(samp_rate * tuneoverlap)
stare = False
initial_freq = freq_start

if freq_end == 0:
stare = True
freq_end = freq_start + (tune_step_hz - 1)
initial_freq += int((freq_end - freq_start) / 2)
logging.info(
f"using stare mode, scan from {freq_start/1e6}MHz to {freq_end/1e6}MHz"
)

##################################################
# Parameters
Expand All @@ -142,8 +132,10 @@ def __init__(
pbr_version = pbr.version.VersionInfo("gamutrf").version_string()
logging.info(f"gamutrf {pbr_version} with gr-iqtlabs {griqtlabs_path}")

logging.info(f"will scan from {freq_start} to {freq_end}")
freq_range = freq_end - freq_start
if freq_end == 0:
freq_range = samp_rate
else:
freq_range = freq_end - freq_start
fft_rate = int(samp_rate / nfft)

if not tune_step_fft:
Expand All @@ -162,27 +154,17 @@ def __init__(
logging.info(
f"requested retuning across {freq_range/1e6}MHz every {tune_step_fft} FFTs, dwell time {tune_dwell_ms}ms"
)
if stare and tune_dwell_ms > 1e3:
logging.warn(">1s dwell time in stare mode, updates will be slow!")
peak_fft_range = min(peak_fft_range, tune_step_fft)

fft_dir = ""
if write_fft_points:
fft_dir = sample_dir

self.sources, cmd_port, self.workaround_start_hook = get_source(
sdr,
samp_rate,
igain,
nfft,
tune_step_fft,
agc=False,
center_freq=initial_freq,
sdrargs=sdrargs,
dc_ettus_auto_offset=dc_ettus_auto_offset,
)

(
freq_start,
freq_end,
stare,
initial_freq,
fft_batch_size,
self.retune_pre_fft,
self.retune_fft,
Expand Down Expand Up @@ -224,6 +206,25 @@ def __init__(
self.pduzmq_block = pduzmq(fft_zmq_block_addr)
logging.info("serving FFT on %s", fft_zmq_block_addr)

if stare:
logging.info(f"staring at {initial_freq/1e6}MHz")
if tune_dwell_ms > 1e3:
logging.warn(">1s dwell time in stare mode, updates will be slow!")
else:
logging.info(f"will scan from {freq_start} to {freq_end}")

self.sources, cmd_port, self.workaround_start_hook = get_source(
sdr,
samp_rate,
igain,
nfft,
tune_step_fft,
agc=False,
center_freq=initial_freq,
sdrargs=sdrargs,
dc_ettus_auto_offset=dc_ettus_auto_offset,
)

if iq_zmq_port:
iq_zmq_block_addr = f"tcp://{iq_zmq_addr}:{iq_zmq_port}"
logging.info("serving I/Q samples and tags on %s", iq_zmq_block_addr)
Expand Down Expand Up @@ -614,6 +615,12 @@ def get_pipeline_blocks(
slew_rx_time=slew_rx_time,
peak_fft_range=peak_fft_range,
)
try:
stare = retune_pre_fft.get_stare_mode()
initial_freq = retune_pre_fft.get_tune_freq()
except AttributeError:
stare = retune_fft.get_stare_mode()
initial_freq = retune_fft.get_tune_freq()
sample_blocks = [retune_pre_fft] + self.get_dc_blocks(
correct_iq,
dc_block_len,
Expand All @@ -630,6 +637,10 @@ def get_pipeline_blocks(
+ [retune_fft]
)
return (
retune_fft.get_freq_start(),
retune_fft.get_freq_end(),
stare,
initial_freq,
fft_batch_size,
retune_pre_fft,
retune_fft,
Expand Down

0 comments on commit 5bb0fca

Please sign in to comment.