Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add write_samples and description control from waterfall UI. #1346

Merged
merged 6 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
):
gr.top_block.__init__(self, "scan", catch_exceptions=True)

if description:
description = description.strip('"')

Check warning on line 105 in gamutrf/grscan.py

View check run for this annotation

Codecov / codecov/patch

gamutrf/grscan.py#L105

Added line #L105 was not covered by tests
tune_step_hz = int(samp_rate * tuneoverlap)
stare = False

Expand Down Expand Up @@ -222,6 +224,7 @@
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 @@
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}"')

Check warning on line 227 in gamutrfwaterfall/gamutrfwaterfall/flask_handler.py

View check run for this annotation

Codecov / codecov/patch

gamutrfwaterfall/gamutrfwaterfall/flask_handler.py#L224-L227

Added lines #L224 - L227 were not covered by tests
else:
reconf_queries.append(f"{k}={v}")
reconf_query_str = "&".join(reconf_queries)

Check warning on line 230 in gamutrfwaterfall/gamutrfwaterfall/flask_handler.py

View check run for this annotation

Codecov / codecov/patch

gamutrfwaterfall/gamutrfwaterfall/flask_handler.py#L229-L230

Added lines #L229 - L230 were not covered by tests
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
Loading