Skip to content

Commit

Permalink
Merge pull request #1122 from anarkiwi/pretune
Browse files Browse the repository at this point in the history
add low power hold down support to pretune (so can output correlated …
  • Loading branch information
anarkiwi authored Jan 24, 2024
2 parents 3ceb29f + 424a8b8 commit b41d6d0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 48 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libvulkan-dev \
python3-numpy
WORKDIR /root
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.75
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.76
COPY --from=iqtlabs/gamutrf-vkfft:latest /root /root/gr-iqtlabs
WORKDIR /root/gr-iqtlabs/build
COPY --from=sigmf-builder /usr/local /usr/local
Expand Down
96 changes: 50 additions & 46 deletions gamutrf/grscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,6 @@ def __init__(
##################################################

logging.info(f"will scan from {freq_start} to {freq_end}")

self.samples_blocks = []
if write_samples:
Path(sample_dir).mkdir(parents=True, exist_ok=True)
self.samples_blocks.extend(
[
blocks.complex_to_interleaved_short(False, 32767),
blocks.stream_to_vector(gr.sizeof_short, nfft * 2),
self.iqtlabs.write_freq_samples(
"rx_freq",
gr.sizeof_short,
"_".join(("ci16", endianstr())),
nfft * 2,
sample_dir,
"samples",
write_samples,
skip_tune_step,
int(samp_rate),
rotate_secs,
igain,
sigmf,
),
]
)
freq_range = freq_end - freq_start
fft_rate = int(samp_rate / nfft)

Expand Down Expand Up @@ -168,26 +144,53 @@ def __init__(
sdrargs=sdrargs,
)

fft_batch_size, self.fft_blocks = self.get_fft_blocks(
vkfft,
fft_batch_size,
nfft,
freq_start,
freq_end,
tune_step_hz,
tune_step_fft,
skip_tune_step,
tuning_ranges,
pretune,
fft_processor_affinity,
low_power_hold_down,
)
self.fft_blocks = (
self.get_dc_blocks(dc_block_len, dc_block_long)
+ self.get_fft_blocks(
vkfft,
fft_batch_size,
nfft,
freq_start,
freq_end,
tune_step_hz,
tune_step_fft,
skip_tune_step,
tuning_ranges,
pretune,
fft_processor_affinity,
)
+ self.fft_blocks
+ self.get_db_blocks(nfft, samp_rate, scaling)
)
fft_dir = sample_dir
if not write_samples:
fft_dir = ""
fft_dir = ""
self.samples_blocks = []
if write_samples:
fft_dir = sample_dir
Path(sample_dir).mkdir(parents=True, exist_ok=True)
self.samples_blocks.extend(
[
# blocks.vector_to_stream(
# gr.sizeof_gr_complex, fft_batch_size * nfft
# ),
# blocks.complex_to_interleaved_short(False, 32767),
# blocks.stream_to_vector(gr.sizeof_short, nfft * 2),
self.iqtlabs.write_freq_samples(
"rx_freq",
gr.sizeof_gr_complex,
"_".join(("cf32", endianstr())),
fft_batch_size * nfft,
sample_dir,
"samples",
write_samples,
skip_tune_step,
int(samp_rate),
rotate_secs,
igain,
sigmf,
),
]
)
retune_fft = self.iqtlabs.retune_fft(
"rx_freq",
nfft,
Expand Down Expand Up @@ -284,11 +287,8 @@ def __init__(
else:
self.connect((retune_fft, 1), (blocks.null_sink(gr.sizeof_float * nfft)))

for pipeline_blocks in (
self.fft_blocks,
self.samples_blocks,
):
self.connect_blocks(self.sources[-1], pipeline_blocks)
self.connect_blocks(self.sources[-1], self.fft_blocks)
self.connect_blocks(self.retune_pre_fft, self.samples_blocks)

def connect_blocks(self, source, other_blocks, last_block_port=0):
last_block = source
Expand Down Expand Up @@ -323,6 +323,7 @@ def get_pretune_block(
skip_tune_step,
tuning_ranges,
pretune,
low_power_hold_down,
):
# if pretuning, the pretune block will also do the batching.
if pretune:
Expand All @@ -337,6 +338,7 @@ def get_pretune_block(
skip_tune_step,
tuning_ranges,
self.tag_now,
low_power_hold_down,
)
else:
# otherwise, the pretuning block will just do batching.
Expand Down Expand Up @@ -400,6 +402,7 @@ def get_fft_blocks(
tuning_ranges,
pretune,
fft_processor_affinity,
low_power_hold_down,
):
fft_batch_size, fft_blocks = self.get_offload_fft_blocks(
vkfft,
Expand All @@ -417,8 +420,9 @@ def get_fft_blocks(
skip_tune_step,
tuning_ranges,
pretune,
low_power_hold_down,
)
return [self.retune_pre_fft] + fft_blocks
return (fft_batch_size, [self.retune_pre_fft] + fft_blocks)

def start(self):
super().start()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_grscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def run_grscan_smoke(self, pretune, wavelearner, write_samples, test_file):
rotate_secs=900,
db_clamp_floor=-1e6,
pretune=pretune,
fft_batch_size=256,
fft_batch_size=4,
inference_output_dir=str(tempdir),
)
tb.start()
Expand Down

0 comments on commit b41d6d0

Please sign in to comment.