Skip to content

Commit

Permalink
Merge pull request #1346 from anarkiwi/desc
Browse files Browse the repository at this point in the history
Add write_samples and description control from waterfall UI.
  • Loading branch information
anarkiwi authored Jul 11, 2024
2 parents 478b466 + 0f2b39e commit f876de8
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
pybind11-dev \
python3-numpy
WORKDIR /root
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.110
RUN git clone https://github.com/iqtlabs/gr-iqtlabs -b 1.0.111
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
3 changes: 3 additions & 0 deletions gamutrf/grscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def __init__(
):
gr.top_block.__init__(self, "scan", catch_exceptions=True)

if description:
description = description.strip('"')
tune_step_hz = int(samp_rate * tuneoverlap)
stare = False

Expand Down Expand Up @@ -222,6 +224,7 @@ def __init__(
sigmf,
zstd=True,
rotate=False,
description=description,
),
]
)
Expand Down
10 changes: 7 additions & 3 deletions gamutrfwaterfall/gamutrfwaterfall/flask_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,13 @@ def config_form(self):
write_scanner_args(self.config_vars_path, self.config_vars)
reset = request.form.get("reset", None)
if reset == "reset":
reconf_query_str = "&".join(
[f"{k}={v}" for k, v in self.config_vars.items()]
)
reconf_queries = []
for k, v in self.config_vars.items():
if k in ["description"]:
reconf_queries.append(f'{k}="{v}"')
else:
reconf_queries.append(f"{k}={v}")
reconf_query_str = "&".join(reconf_queries)
logging.info(f"\n\n{reconf_query_str=}\n\n")
try:
response = requests.get(
Expand Down
56 changes: 30 additions & 26 deletions gamutrfwaterfall/gamutrfwaterfall/templates/waterfall.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
{% extends "base.html" %}
{% block body %}
<div class="content_container">
<img id="waterfall" src="" />
<div class="scanner_args_form">
<form action = "{{ url_for('config_form') }}" method = "post">
<p>Freq start:</p>
<p><input type="number" step="1" pattern="\d+" name="freq_start" value="{{ config_vars['freq_start']|int }}"/></p>
<p>Freq end:</p>
<p><input type="number" step="1" pattern="\d+" name="freq_end" value="{{ config_vars['freq_end']|int }}"/></p>
<p>Gain:</p>
<p><input type="number" step="1" pattern="\d+" name="igain" value="{{ config_vars['igain']|int }}"/></p>
<p>Tune overlap:</p>
<p><input type = "text" name="tuneoverlap" value="{{ config_vars['tuneoverlap'] }}"/></p>
<p>Tune step (# of FFTs):</p>
<p><input type="number" step="1" pattern="\d+" name="tune_step_fft" value="{{ config_vars['tune_step_fft']|int }}"/></p>
<p>Sweep seconds:</p>
<p><input type="number" step="1" pattern="\d+" name="sweep_sec" value="{{ config_vars['sweep_sec']|int }}"/></p>
<img id="waterfall" src="" />
<div class="scanner_args_form">
<form action = "{{ url_for('config_form') }}" method = "post">
<p>Freq start:</p>
<p><input type="number" step="1" pattern="\d+" name="freq_start" value="{{ config_vars['freq_start']|int }}"/></p>
<p>Freq end:</p>
<p><input type="number" step="1" pattern="\d+" name="freq_end" value="{{ config_vars['freq_end']|int }}"/></p>
<p>Gain:</p>
<p><input type="number" step="1" pattern="\d+" name="igain" value="{{ config_vars['igain']|int }}"/></p>
<p>Tune overlap:</p>
<p><input type = "text" name="tuneoverlap" value="{{ config_vars['tuneoverlap'] }}"/></p>
<p>Tune step (# of FFTs):</p>
<p><input type="number" step="1" pattern="\d+" name="tune_step_fft" value="{{ config_vars['tune_step_fft']|int }}"/></p>
<p>Sweep seconds:</p>
<p><input type="number" step="1" pattern="\d+" name="sweep_sec" value="{{ config_vars['sweep_sec']|int }}"/></p>
<p>Write samples:</p>
<p><input type="number" step="1" pattern="\d+" name="write_samples" value="{{ config_vars['write_samples']|int }}"/></p>
<p>SigMF description:</p>
<p><input type="text" name="description" value="{{ config_vars['description'] }}"/></p>

<p><button name="reset" type="submit" value="reset">Reset</button></p>
</form>
</div>
<p><button name="reset" type="submit" value="reset">Reset</button></p>
</form>
</div>
</div>
{% endblock body %}
{% block script %}
<script>
document.getElementById("waterfall_link").className += " active";
$(document).ready(function(){
setInterval(refreshFunction, 1000);
});
document.getElementById("waterfall_link").className += " active";
$(document).ready(function(){
setInterval(refreshFunction, 1000);
});

function refreshFunction(){
function refreshFunction(){

d = new Date();
$("#waterfall").attr("src", "{{ url_for('serve_waterfall_img') }}?"+d.getTime());
d = new Date();
$("#waterfall").attr("src", "{{ url_for('serve_waterfall_img') }}?"+d.getTime());

}
}
</script>
{% endblock script %}
2 changes: 2 additions & 0 deletions gamutrfwaterfall/gamutrfwaterfall/waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"tuneoverlap": None,
"tune_step_fft": None,
"sweep_sec": None,
"write_samples": 0,
"description": "",
}


Expand Down
2 changes: 1 addition & 1 deletion orchestrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ services:
- --iq_inference_model_server=torchserve:8080
- --iq_inference_model_name=torchsig_model
# - --write_samples=1000000000
# - --sample_dir=/logs/samples
- --sample_dir=/logs/samples
healthcheck:
test: [CMD, "/gamutrf/bin/scanhc.sh", "9000"]
interval: 10s
Expand Down

0 comments on commit f876de8

Please sign in to comment.