From d990352f5bef7d765a5275bdb6ad707cbf784bb1 Mon Sep 17 00:00:00 2001 From: Meisterschueler Date: Fri, 4 Dec 2020 07:31:43 +0100 Subject: [PATCH] Receiver rankings (#158) * Added receiver_rankings, fixed receiver_status * Added receiver_rankings updates * Modified receiver_ranking.html * Removed obsolete code * Bugfix: order countries for select box * Frequency scan fixes from RPi Co-authored-by: Konstantin --- app/main/bokeh_utils.py | 26 +++++++++++++------------- app/main/routes.py | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/main/bokeh_utils.py b/app/main/bokeh_utils.py index e4b01da..d2c32b8 100644 --- a/app/main/bokeh_utils.py +++ b/app/main/bokeh_utils.py @@ -11,16 +11,16 @@ import numpy as np COMMON_FREQUENCIES = [ [84.015, 87.2250, 'BOS 4m'], - [87.500, 108.0000, 'UKW Rundfunk'], + [87.500, 108.0000, 'VHF FM Radio'], [108.000, 111.9750, 'ILS'], [112.000, 117.9750, 'VOR'], - [117.975, 137.0000, 'Flugfunk'], - [143.000, 146.0000, 'Amateurfunk 2m'], + [117.975, 137.0000, 'Aeronautical Radio'], + [143.000, 146.0000, 'Amateur Radio 2m'], [165.210, 173.9800, 'BOS 2m'], [177.500, 226.5000, 'DVB-T VHF'], - [273.000, 312.0000, 'Militär'], + [273.000, 312.0000, 'Military'], [390.000, 399.9000, 'BOS Digital'], - [430.000, 440.0000, 'Amateurfunk 70cm'], + [430.000, 440.0000, 'Amateur Radio 70cm'], [448.600, 449.9625, 'BOS 70cm'], [474.000, 786.0000, 'DVB-T UHF'], [791.000, 821.0000, 'LTE downlink'], @@ -28,9 +28,9 @@ COMMON_FREQUENCIES = [ [868.000, 868.6000, 'Flarm 868.3MHz'], [880.000, 915.0000, 'GSM 900 uplink'], [925.000, 960.0000, 'GSM 900 downlink'], - [1025.000, 1095.0000, 'Funknavigation'], - [1164.000, 1215.0000, 'Funknavigation (DME,TACAN)'], - [1429.000, 1452.0000, 'Militär'], + [1025.000, 1095.0000, 'Aeronautical Navigation'], + [1164.000, 1215.0000, 'Aeronautical Navigation (DME,TACAN)'], + [1429.000, 1452.0000, 'Military'], ] @@ -58,16 +58,16 @@ def get_bokeh_frequency_scan(frequency_scan_file): frequency_source = ColumnDataSource(data=dict(low=low, high=high, x=x, y=y, width=width, height=height, desc=desc)) # Create the figure with tool tips - fig = figure(plot_width=900, plot_height=500, title=f"Signalauswertung {frequency_scan_file.receiver.name}", tools=[PanTool(), WheelZoomTool(), ResetTool()]) - r1 = fig.rect(x='x', y='y', width='width', height='height', color="lightgrey", source=frequency_source, legend="Gängige Frequenzen") - r2 = fig.line(xval, yval, legend=f"Messung (gain={frequency_scan_file.gain})") + fig = figure(title=f"Frequency spectrum @ {frequency_scan_file.receiver.name}", sizing_mode='stretch_both', tools=[PanTool(), WheelZoomTool(), ResetTool()]) + r1 = fig.rect(x='x', y='y', width='width', height='height', color="lightgrey", source=frequency_source, legend="Common Frequencies") + r2 = fig.line(xval, yval, legend=f"Measurement (gain={frequency_scan_file.gain})") r3 = fig.line(x=[868.3, 868.3], y=[-25, 25], color="red", legend="Flarm") fig.add_tools(HoverTool(renderers=[r1], tooltips={"info": "@desc @low-@high MHz"})) fig.add_tools(HoverTool(renderers=[r2], tooltips={"f [MHz]": "$x", "P [dB]": "$y"})) - fig.xaxis.axis_label = "Frequenz [MHz]" - fig.yaxis.axis_label = "Signalstärke [dB]" + fig.xaxis.axis_label = "Frequency [MHz]" + fig.yaxis.axis_label = "Signal Power [dB]" fig.legend.click_policy = 'hide' return file_html(fig, CDN) diff --git a/app/main/routes.py b/app/main/routes.py index dab5003..ff76020 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -276,7 +276,7 @@ def upload_file(): file.save(os.path.join(current_app.config['UPLOAD_PATH'], filename)) - uploaded_file = FrequencyScanFile(name=filename, gain=match.group('gain'), upload_ip_address=request.remote_addr, upload_timestamp=datetime.utcnow(), receiver=receiver) + uploaded_file = FrequencyScanFile(name=filename, gain=match.group('gain'), upload_ip_address=request.headers['X-Real-IP'], upload_timestamp=datetime.utcnow(), receiver=receiver) db.session.add(uploaded_file) db.session.commit()