From c0fa38708987e043a11dd4b8713e10adce3c07e0 Mon Sep 17 00:00:00 2001 From: AstroTaka Date: Fri, 16 Dec 2022 00:43:18 +0900 Subject: [PATCH] Revert "Merge branch 'testing-AstroTaka' into testing" This reverts commit edfd4017c3d7188a38b7114a8baa7e36bc3f12c3, reversing changes made to 5972db70df1745678058401b8415a36a2c301d62. --- auto_rx/auto_rx.py | 2 - auto_rx/autorx/config.py | 4 -- auto_rx/autorx/decode.py | 33 ++-------- auto_rx/autorx/log_files.py | 47 +------------- auto_rx/autorx/scan.py | 6 -- auto_rx/autorx/sdr_wrappers.py | 13 ---- auto_rx/autorx/static/js/skewt.js | 46 ++------------ auto_rx/autorx/templates/historical.html | 80 ++++++------------------ auto_rx/autorx/templates/index.html | 21 ++----- auto_rx/autorx/utils.py | 8 --- auto_rx/requirements.txt | 4 +- auto_rx/utils/receiver_stats.py | 4 +- 12 files changed, 37 insertions(+), 231 deletions(-) diff --git a/auto_rx/auto_rx.py b/auto_rx/auto_rx.py index 8450c26..0c8fe44 100644 --- a/auto_rx/auto_rx.py +++ b/auto_rx/auto_rx.py @@ -167,7 +167,6 @@ def start_scanner(): rtl_fm_path=config["sdr_fm"], rtl_device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]["gain"], - agc=autorx.sdr_list[_device_idx]["agc"], ppm=autorx.sdr_list[_device_idx]["ppm"], bias=autorx.sdr_list[_device_idx]["bias"], save_detection_audio=config["save_detection_audio"], @@ -251,7 +250,6 @@ def start_decoder(freq, sonde_type, continuous=False): rtl_fm_path=config["sdr_fm"], rtl_device_idx=_device_idx, gain=autorx.sdr_list[_device_idx]["gain"], - agc=autorx.sdr_list[_device_idx]["agc"], ppm=autorx.sdr_list[_device_idx]["ppm"], bias=autorx.sdr_list[_device_idx]["bias"], # Other options diff --git a/auto_rx/autorx/config.py b/auto_rx/autorx/config.py index 7fe8de3..c93dd74 100644 --- a/auto_rx/autorx/config.py +++ b/auto_rx/autorx/config.py @@ -764,7 +764,6 @@ def read_auto_rx_config(filename, no_sdr_test=False): _device_idx = config.get(_section, "device_idx") _ppm = round(config.getfloat(_section, "ppm")) _gain = config.getfloat(_section, "gain") - _agc = config.getint(_section, "agc") _bias = config.getboolean(_section, "bias") if (auto_rx_config["sdr_quantity"] > 1) and (_device_idx == "0"): @@ -779,7 +778,6 @@ def read_auto_rx_config(filename, no_sdr_test=False): auto_rx_config["sdr_settings"][_device_idx] = { "ppm": _ppm, "gain": _gain, - "agc" : _agc, "bias": _bias, "in_use": False, "task": None, @@ -816,7 +814,6 @@ def read_auto_rx_config(filename, no_sdr_test=False): "bias": 0, "in_use": False, "task": None, - "agc": 0, } elif auto_rx_config["sdr_type"] == "KA9Q": @@ -839,7 +836,6 @@ def read_auto_rx_config(filename, no_sdr_test=False): "bias": 0, "in_use": False, "task": None, - "agc": 0, } logging.critical("Config - KA9Q SDR Support not implemented yet - exiting.") diff --git a/auto_rx/autorx/decode.py b/auto_rx/autorx/decode.py index acdfc79..6981651 100644 --- a/auto_rx/autorx/decode.py +++ b/auto_rx/autorx/decode.py @@ -133,7 +133,6 @@ class SondeDecoder(object): rtl_device_idx=0, ppm=0, gain=-1, - agc=0, bias=False, save_decode_audio=False, save_decode_iq=False, @@ -201,7 +200,6 @@ class SondeDecoder(object): self.rtl_device_idx = rtl_device_idx self.ppm = ppm self.gain = gain - self.agc = agc self.bias = bias self.save_decode_audio = save_decode_audio self.save_decode_iq = save_decode_iq @@ -378,7 +376,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, highpass = 20, lowpass = 2600 @@ -445,7 +442,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, highpass = 20, lowpass = 2500 @@ -479,7 +475,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, highpass = 20, lowpass = 2000 @@ -508,7 +503,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, highpass = 20 ) @@ -535,7 +529,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -561,7 +554,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -589,7 +581,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -626,7 +617,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, fast_filter = True ) @@ -663,7 +653,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, highpass = 20, lowpass = 2600 @@ -690,7 +679,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -716,7 +704,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -780,13 +767,12 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) # Add in tee command to save IQ to disk if debugging is enabled. if self.save_decode_iq: - demod_cmd += " tee decode_IQ_%s.bin |" % (str(self.rtl_device_idx) + '_RS41_' + datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='seconds').replace('+00:00', 'Z').replace(':','')) + demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx) demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % ( _lower, @@ -855,7 +841,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -906,13 +891,12 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) # Add in tee command to save IQ to disk if debugging is enabled. - #if self.save_decode_iq: - # demod_cmd += " tee decode_IQ_%s.bin |" % (str(self.rtl_device_idx) + '_DFM_' + datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='seconds').replace('+00:00', 'Z').replace(':','')) + if self.save_decode_iq: + demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx) demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % ( _lower, @@ -958,7 +942,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -1000,7 +983,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -1040,7 +1022,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -1082,7 +1063,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) # Add in tee command to save IQ to disk if debugging is enabled. @@ -1123,7 +1103,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) @@ -1169,7 +1148,6 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias, fast_filter = True # Don't use -F9 ) @@ -1211,13 +1189,12 @@ class SondeDecoder(object): rtl_device_idx = self.rtl_device_idx, ppm = self.ppm, gain = self.gain, - agc = self.agc, bias = self.bias ) # Add in tee command to save IQ to disk if debugging is enabled. - if self.save_decode_iq and self.sonde_freq > 405150000 : - demod_cmd += " tee decode_IQ_%s.bin |" % (str(self.rtl_device_idx) + '_MEISEI_' + datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='seconds').replace('+00:00', 'Z').replace(':','')) + if self.save_decode_iq: + demod_cmd += " tee decode_IQ_%s.bin |" % str(self.rtl_device_idx) demod_cmd += "./fsk_demod --cs16 -s -b %d -u %d --stats=%d 2 %d %d - -" % ( _lower, diff --git a/auto_rx/autorx/log_files.py b/auto_rx/autorx/log_files.py index 1724ff0..aa52955 100644 --- a/auto_rx/autorx/log_files.py +++ b/auto_rx/autorx/log_files.py @@ -67,10 +67,6 @@ def log_filename_to_stats(filename, quicklook=False): # Third field is the sonde type, in 'shortform' _type = _fields[2] - - if _type=="MEISEI": - _type = _fields[1].split("-")[0] - _type_str = short_type_lookup(_type) _short_type = short_short_type_lookup(_type) @@ -96,13 +92,7 @@ def log_filename_to_stats(filename, quicklook=False): _output["has_snr"] = _quick["has_snr"] _output["max_range"] = int(max(_output["first"]["range_km"],_output["last"]["range_km"])) _output["last_range"] = int(_output["last"]["range_km"]) - _output["first_height"] = int(_output["first"]["alt"]) - _output["last_height"] = int(_output["last"]["alt"]) - _output["freq"] = _quick["first"]["freq"] - try: - _output["max_height"] = int(_quick["max_height"]) - except: - pass + _output["min_height"] = int(_output["last"]["alt"]) except Exception as e: logging.error(f"Could not quicklook file {filename}: {str(e)}") @@ -142,7 +132,6 @@ def log_quick_look(filename): _first_lat = float(_fields[3]) _first_lon = float(_fields[4]) _first_alt = float(_fields[5]) - _first_freq = float(_fields[13]) _pos_info = position_info( ( autorx.config.global_config["station_lat"], @@ -159,7 +148,6 @@ def log_quick_look(filename): "range_km": _pos_info["straight_distance"] / 1000.0, "bearing": _pos_info["bearing"], "elevation": _pos_info["elevation"], - "freq": _first_freq, } except Exception as e: # Couldn't read the first line, so likely no data. @@ -200,39 +188,6 @@ def log_quick_look(filename): "bearing": _pos_info["bearing"], "elevation": _pos_info["elevation"], } - - # find Max H - _seek_point = _filesize - 5000 - start_check = True - while _seek_point>0: - _file.seek(_seek_point) - _remainder = _file.read(5000).split("\n") - alt1 = float(_remainder[1].split(",")[5]) - alt2 = float(_remainder[-2].split(",")[5]) - if alt2>alt1 and start_check==True: - # bumping... - break - if alt2>alt1: - # find bumping before burst - _remainder_num = len(_remainder)-2 - max_alt1 = 0 - for num in range(_remainder_num): - max_alt1 = max(max_alt1,float(_remainder[num+1].split(",")[5])) - - _seek_point+=5000 - _file.seek(_seek_point) - _remainder = _file.read(5000).split("\n") - - _remainder_num = len(_remainder)-2 - max_alt2 = 0 - for num in range(_remainder_num): - max_alt2 = max(max_alt2,float(_remainder[num+1].split(",")[5])) - - _output['max_height']=max(max_alt1,max_alt2) - break - _seek_point-=5000 - start_check = False - return _output except Exception as e: # Couldn't read in the last line for some reason. diff --git a/auto_rx/autorx/scan.py b/auto_rx/autorx/scan.py index da5ce5c..b229a1d 100644 --- a/auto_rx/autorx/scan.py +++ b/auto_rx/autorx/scan.py @@ -236,7 +236,6 @@ def detect_sonde( rtl_device_idx=0, ppm=0, gain=-1, - agc=0, bias=False, save_detection_audio=False, ngp_tweak=False, @@ -325,7 +324,6 @@ def detect_sonde( rtl_fm_path = rtl_fm_path, ppm = ppm, gain = gain, - agc=agc, bias = bias, sdr_hostname = sdr_hostname, sdr_port = sdr_port, @@ -375,7 +373,6 @@ def detect_sonde( rtl_fm_path = rtl_fm_path, ppm = ppm, gain = gain, - gac=agc, bias = bias, sdr_hostname = "", sdr_port = 1234, @@ -645,7 +642,6 @@ class SondeScanner(object): rtl_fm_path="rtl_fm", rtl_device_idx=0, gain=-1, - agc=0, ppm=0, bias=False, @@ -735,7 +731,6 @@ class SondeScanner(object): self.rtl_fm_path = rtl_fm_path self.rtl_device_idx = rtl_device_idx self.gain = gain - self.agc = agc self.ppm = ppm self.bias = bias @@ -1093,7 +1088,6 @@ class SondeScanner(object): rtl_device_idx=self.rtl_device_idx, ppm=self.ppm, gain=self.gain, - agc=self.agc, bias=self.bias, dwell_time=self.detect_dwell_time, save_detection_audio=self.save_detection_audio, diff --git a/auto_rx/autorx/sdr_wrappers.py b/auto_rx/autorx/sdr_wrappers.py index f2d473c..7386281 100644 --- a/auto_rx/autorx/sdr_wrappers.py +++ b/auto_rx/autorx/sdr_wrappers.py @@ -191,7 +191,6 @@ def get_sdr_iq_cmd( fast_filter: bool = False, ppm = 0, gain = None, - agc = None, bias = False, sdr_hostname = "", sdr_port = 5555, @@ -228,11 +227,6 @@ def get_sdr_iq_cmd( if gain >= 0: _gain = f"-g {gain:.1f} " - _agc = "" - if agc: - if agc >= 1: - _agc = f"-E agc " - _cmd = ( f"{rtl_fm_path} -M raw " f"{'' if fast_filter else '-F9 '}" @@ -240,7 +234,6 @@ def get_sdr_iq_cmd( f"-p {int(ppm)} " f"-d {str(rtl_device_idx)} " f"{_gain}" - f"{_agc}" f"-s {int(sample_rate)} " f"-f {int(frequency)} " f"- 2>/dev/null | " @@ -312,18 +305,12 @@ def get_sdr_fm_cmd( if gain >= 0: _gain = f"-g {gain:.1f} " - _agc = "" - if agc: - if agc >= 1: - _agc = f"-E agc " - _cmd = ( f"{rtl_fm_path} -M fm -F9 " f"{'-T ' if bias else ''}" f"-p {int(ppm)} " f"-d {str(rtl_device_idx)} " f"{_gain}" - f"{_agc}" f"-s {int(filter_bandwidth)} " f"-f {int(frequency)} " f"2>/dev/null | " diff --git a/auto_rx/autorx/static/js/skewt.js b/auto_rx/autorx/static/js/skewt.js index c4f5a67..432fccc 100644 --- a/auto_rx/autorx/static/js/skewt.js +++ b/auto_rx/autorx/static/js/skewt.js @@ -17,7 +17,7 @@ var SkewT = function(div) { var tan = Math.tan(55*deg2rad); var basep = 1050; var topp = 100; // Note: If we want to increase this to 50 hPa we need to fix generation of the temp grid. - var plines = [1000,900,800,700,600,500,400,300,200,100]; + var plines = [1000,850,700,500,300,200,100]; var pticks = [950,900,800,750,650,600,550,450,400,350,250,150]; var barbsize = 25; // functions for Scales and axes. Note the inverted domain for the y-scale: bigger is up! @@ -43,7 +43,7 @@ var SkewT = function(div) { height = width; //to fix w = width - margin.left - margin.right; h = width - margin.top - margin.bottom; - x = d3.scale.linear().range([0, w]).domain([-50,50]); + x = d3.scale.linear().range([0, w]).domain([-45,50]); y = d3.scale.log().range([0, h]).domain([topp, basep]); xAxis = d3.svg.axis().scale(x).tickSize(0,0).ticks(10).orient("bottom").tickFormat(function(e) { return e.toFixed(0) + "°C" @@ -227,44 +227,7 @@ var SkewT = function(div) { wspdfocus.select("text").text(Math.round(convert(d.wspd, unit)*10)/10 + " " + unit + ", " + Math.round(d.wdir) + "˚ "); }); } - - var drawToolTipsTest = function(skewtlines) { - var lines = skewtlines.reverse(); - - // Draw tooltips - lines.forEach(function(d) { - // Draw tooltips - var tmpcfocus = skewtgroup.append("g").attr("class", "focus tmpc").style("display", "none"); - tmpcfocus.append("circle").attr("r", 4); - tmpcfocus.append("text").attr("x", 9).attr("dy", ".35em"); - - var dwpcfocus = skewtgroup.append("g").attr("class", "focus dwpc").style("display", "none"); - dwpcfocus.append("circle").attr("r", 4); - dwpcfocus.append("text").attr("x", -9).attr("text-anchor", "end").attr("dy", ".35em"); - - var hghtfocus = skewtgroup.append("g").attr("class", "focus").style("display", "none"); - hghtfocus.append("text").attr("x", 0).attr("text-anchor", "start").attr("dy", ".35em"); - - var wspdfocus = skewtgroup.append("g").attr("class", "focus windspeed").style("display", "none"); - wspdfocus.append("text").attr("x", 0).attr("text-anchor", "end").attr("dy", ".35em"); - - tmpcfocus.style("display", null); - dwpcfocus.style("display", null); - hghtfocus.style("display", null); - wspdfocus.style("display", null); - - tmpcfocus.attr("transform", "translate(" + (x(d.temp) + (y(basep)-y(d.press))/tan)+ "," + y(d.press) + ")"); - dwpcfocus.attr("transform", "translate(" + (x(d.dwpt) + (y(basep)-y(d.press))/tan)+ "," + y(d.press) + ")"); - hghtfocus.attr("transform", "translate(0," + y(d.press) + ")"); - tmpcfocus.select("text").text(Math.round(d.temp)+"°C"); - dwpcfocus.select("text").text(Math.round(d.dwpt)+"°C"); - hghtfocus.select("text").text("-- "+Math.round(d.hght)+" m"); //hgt or hghtagl ??? - wspdfocus.attr("transform", "translate(" + (w-65) + "," + y(d.press) + ")"); - wspdfocus.select("text").text(Math.round(convert(d.wspd, unit)*10)/10 + " " + unit + ", " + Math.round(d.wdir) + "˚ "); - - }); - } - + var plot = function(s){ data = s; skewtgroup.selectAll("path").remove(); //clear previous paths from skew @@ -303,8 +266,7 @@ var SkewT = function(div) { .attr("transform", function(d,i) { return "translate("+w+","+y(d.press)+") rotate("+(d.wdir+180)+")"; }); //mouse over - //drawToolTips(skewtlines[0]); - drawToolTipsTest(skewtlines[0]); + drawToolTips(skewtlines[0]); } var clear = function(s){ diff --git a/auto_rx/autorx/templates/historical.html b/auto_rx/autorx/templates/historical.html index bb0ca68..c11f518 100644 --- a/auto_rx/autorx/templates/historical.html +++ b/auto_rx/autorx/templates/historical.html @@ -30,8 +30,6 @@