Skip to content

Commit

Permalink
Merge pull request #942 from argilo/scan-search-radius
Browse files Browse the repository at this point in the history
Search for peaks over a wider range
  • Loading branch information
darksidelemm authored Nov 17, 2024
2 parents d0a9f41 + 68b9db2 commit dc9b5fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions auto_rx/autorx/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import autorx
import datetime
import logging
import math
import numpy as np
import os
import sys
Expand Down Expand Up @@ -1072,6 +1073,7 @@ def sonde_search(self, first_only=False):
# This is actually a bit of a pain to do...
_peak_freq = []
_peak_lvl = []
_search_radius = math.ceil((self.quantization / 2) / self.search_step)
for _peak in peak_frequencies:
try:
# Find the index of the peak within our decimated frequency array.
Expand All @@ -1081,13 +1083,13 @@ def sonde_search(self, first_only=False):
# Because we've decimated the freq & power data, the peak location may
# not be exactly at this frequency, so we take the maximum of an area
# around this location.
_peak_search_min = max(0, _peak_power_idx - 5)
_peak_search_min = max(0, _peak_power_idx - _search_radius)
_peak_search_max = min(
len(scan_result["freq"]) - 1, _peak_power_idx + 5
len(scan_result["freq"]) - 1, _peak_power_idx + _search_radius
)
# Grab the maximum value, and append it and the frequency to the output arrays
_peak_lvl.append(
max(scan_result["power"][_peak_search_min:_peak_search_max])
max(scan_result["power"][_peak_search_min:_peak_search_max + 1])
)
_peak_freq.append(_peak / 1e6)
except:
Expand Down

0 comments on commit dc9b5fb

Please sign in to comment.