Porównaj commity

...

10 Commity

Autor SHA1 Wiadomość Data
Mark Jessop ecc092b450
Merge pull request #857 from argilo/refactor-export-all
Combine export_selected and export_all
2024-01-28 15:03:43 +10:30
Clayton Smith 7226c31ca1 Combine export_selected and export_all 2024-01-27 23:29:32 -05:00
Mark Jessop 1dfb06a29d
Merge pull request #856 from darksidelemm/testing
Write rtl_power log output to user-defined log directory
2024-01-27 10:52:06 +10:30
Mark Jessop 49d213ea5e Add spaces 2024-01-27 10:51:26 +10:30
Mark Jessop 96228c41df Write rtl_power log output to user-defined log directory 2024-01-27 10:50:03 +10:30
Mark Jessop d59081a81b
Merge pull request #854 from darksidelemm/testing
Some fixes to statistics generation
2024-01-25 14:12:16 +10:30
Mark Jessop 0e6af12b39 Some fixes to statistics generation 2024-01-25 14:10:11 +10:30
Mark Jessop 3bc46f9cab
Merge pull request #852 from darksidelemm/testing
Fix imperial units in table on Historical page
2024-01-24 16:59:21 +10:30
Mark Jessop e20e7c186e Merge remote-tracking branch 'upstream/testing' into testing 2024-01-24 16:58:37 +10:30
Mark Jessop 6c887ce7d5 Fix imperial units on historical page 2024-01-24 16:57:53 +10:30
6 zmienionych plików z 43 dodań i 49 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ from queue import Queue
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
# PATCH - Small changes, or minor feature additions.
__version__ = "1.7.3-beta4"
__version__ = "1.7.3-beta6"
# Global Variables

Wyświetl plik

@ -200,14 +200,17 @@ def log_quick_look(filename):
return _output
def list_log_files(quicklook=False):
def list_log_files(quicklook=False, custom_log_dir=None):
""" Look for all sonde log files within the logging directory """
# Output list, which will contain one object per log file, ordered by time
_output = []
# Search for file matching the expected log file name
_log_mask = os.path.join(autorx.logging_path, "*_sonde.log")
if custom_log_dir:
_log_mask = os.path.join(custom_log_dir, "*_sonde.log")
else:
_log_mask = os.path.join(autorx.logging_path, "*_sonde.log")
_log_files = glob.glob(_log_mask)
# Sort alphanumerically, which will result in the entries being date ordered

Wyświetl plik

@ -5,6 +5,7 @@
# Copyright (C) 2022 Mark Jessop <vk5qi@rfhead.net>
# Released under GNU GPL v3 or later
#
import autorx
import logging
import os.path
import platform
@ -564,7 +565,7 @@ def get_power_spectrum(
# Use rtl_power to obtain power spectral density data
# Create filename to output to.
_log_filename = f"log_power_{rtl_device_idx}.csv"
_log_filename = os.path.join(autorx.logging_path, f"log_power_{rtl_device_idx}.csv")
# If the output log file exists, remove it.
if os.path.exists(_log_filename):
@ -638,7 +639,7 @@ def get_power_spectrum(
# Use a spyserver to obtain power spectral density data
# Create filename to output to.
_log_filename = f"log_power_spyserver.csv"
_log_filename = os.path.join(autorx.logging_path, f"log_power_spyserver.csv")
# If the output log file exists, remove it.
if os.path.exists(_log_filename):

Wyświetl plik

@ -74,10 +74,10 @@ def radio_horizon_plot(log_files, min_range_km=10, max_range_km=1000, save_figur
plt.grid()
def normalised_snr(log_files, min_range_km=10, max_range_km=1000, maxsnr=False, meansnr=True, normalise=True):
def normalised_snr(log_files, min_range_km=10, max_range_km=1000, maxsnr=False, meansnr=True, normalise=True, norm_range=50):
""" Read in ALL log files and store snr data into a set of bins, normalised to 50km range. """
_norm_range = 50 # km
_norm_range = norm_range # km
_snr_count = 0
@ -198,6 +198,12 @@ if __name__ == "__main__":
default=False,
help="Generate Normalised SNR Map (Maximum SNR)"
)
parser.add_argument(
"--normrange",
type=float,
default=50,
help="Normalistion Range (km, default=50)"
)
parser.add_argument(
"-v", "--verbose", help="Enable debug output.", action="store_true"
@ -213,6 +219,8 @@ if __name__ == "__main__":
format="%(asctime)s %(levelname)s:%(message)s", level=_log_level
)
autorx.logging_path = args.log
# Read in the config and make it available to other functions
_temp_cfg = read_auto_rx_config(args.config, no_sdr_test=True)
autorx.config.global_config = _temp_cfg
@ -220,7 +228,7 @@ if __name__ == "__main__":
# Read in the log files.
logging.info("Quick-Looking Log Files")
log_list = list_log_files(quicklook=True)
log_list = list_log_files(quicklook=True, custom_log_dir=args.log)
logging.info(f"Loaded in {len(log_list)} log files.")
@ -228,13 +236,13 @@ if __name__ == "__main__":
radio_horizon_plot(log_list)
if args.snrmap:
normalised_snr(log_list)
normalised_snr(log_list, norm_range=args.normrange)
if args.snrmapmax:
normalised_snr(log_list, meansnr=False, maxsnr=True, normalise=False)
if args.snrmapmaxnorm:
normalised_snr(log_list, meansnr=False, maxsnr=True, normalise=True)
normalised_snr(log_list, meansnr=False, maxsnr=True, normalise=True, norm_range=args.normrange)
plt.show()

Wyświetl plik

@ -122,17 +122,29 @@
return cell.getValue().toFixed(3);
}},
{title:"Count", field:"lines", width:72, resizable:false, headerTooltip:"Received Lines of Telemetry"}, // 75
{title:"Last H", field:"min_height", width:75, resizable:false, headerTooltip:"Last Observed Height (m)",
{title:"Last H", field:"min_height", width:75, resizable:false, headerTooltip:"Last Observed Height",
formatter:function(cell, formatterParams, onRendered){
return cell.getValue() + " m"; //return the contents of the cell;
if (getCookie('imperial') == 'true') {
return cell.getValue()*3.28084.toFixed(0) + " ft";
} else {
return cell.getValue() + " m";
}
}},
{title:"Last R", field:"last_range", width:75, resizable:false, headerTooltip:"Last Observed Range (km)",
{title:"Last R", field:"last_range", width:75, resizable:false, headerTooltip:"Last Observed Range",
formatter:function(cell, formatterParams, onRendered){
return cell.getValue() + " km"; //return the contents of the cell;
if (getCookie('imperial') == 'true') {
return cell.getValue()*0.621371.toFixed(0) + " mi";
} else {
return cell.getValue() + " km";
}
}},
{title:"Max R", field:"max_range", width:73, resizable:false, headerTooltip:"Maximum Observed Range (km))",
{title:"Max R", field:"max_range", width:73, resizable:false, headerTooltip:"Maximum Observed Range",
formatter:function(cell, formatterParams, onRendered){
return cell.getValue() + " km"; //return the contents of the cell;
if (getCookie('imperial') == 'true') {
return cell.getValue()*0.621371.toFixed(0) + " mi";
} else {
return cell.getValue() + " km";
}
}},
{formatter:"rowSelection", titleFormatter:"rowSelection", align:"center", width:40, headerSort:false, titleFormatter: function(cell, formatterParams, onRendered){}}
],

Wyświetl plik

@ -335,15 +335,16 @@ def flask_get_log_by_serial_detail():
return json.dumps(read_log_by_serial(_serial, skewt_decimation=_decim))
@app.route("/export_all_log_files")
@app.route("/export_log_files/<serialb64>")
def flask_export_selected_log_files(serialb64):
def flask_export_log_files(serialb64=None):
"""
Zip and download a set of log files.
The list of log files is provided in the URL as a base64-encoded JSON list.
"""
try:
_serial_list = json.loads(base64.b64decode(serialb64))
_serial_list = json.loads(base64.b64decode(serialb64)) if serialb64 else None
_zip = zip_log_files(_serial_list)
@ -368,37 +369,6 @@ def flask_export_selected_log_files(serialb64):
logging.error("Web - Error handling Zip request:" + str(e))
abort(400)
@app.route("/export_all_log_files")
def flask_export_all_log_files():
"""
Zip and download all log files. This may take some time.
"""
try:
_zip = zip_log_files()
_ts = datetime.datetime.strftime(datetime.datetime.utcnow(), "%Y%m%d-%H%M%SZ")
response = make_response(
flask.send_file(
_zip,
mimetype="application/zip",
as_attachment=True,
download_name=f"autorx_logfiles_{autorx.config.global_config['habitat_uploader_callsign']}_{_ts}.zip",
)
)
# Add header asking client not to cache the download
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
response.headers["Pragma"] = "no-cache"
return response
except Exception as e:
logging.error("Web - Error handling Zip request:" + str(e))
abort(400)
#
# Control Endpoints.
#