Skip to content

Commit

Permalink
Merge pull request #718 from anarkiwi/nanit
Browse files Browse the repository at this point in the history
Better overlap defaults, fix fft.png presentation for non-linear scans, add note for Ettus workaround.
  • Loading branch information
anarkiwi committed Jun 15, 2023
2 parents 086c5bd + cb040a6 commit c895b45
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ Ettus SDRs download firmware and switch USB identities when first powered up. Re

UHD driver arguments ```num_recv_frames``` or ```recv_frame_size``` may be too high. The defaults are defined as ETTUS_ARGS in [utils.py](gamutrf/utils.py). Try reducing one or both via ```--sdrargs```. For example, ```--sdrargs num_recv_frames=64,recv_frame_size=8200,type=b200```.

#### Scanner with Ettus SDR shows implausible low power at approx 100MHz intervals

Ettus radios may need extra time to produce good data when being retuned rapidly by the scanner. Try adding ```--skip-tune-step=1024``` to the scanner command line and increase the value until the power dips disappear. This parameter will slow down the scan speed.

#### "O"s or warnings about overflows in SDR containers

* Ensure your hardware can support the I/Q sample rate you have configured (gamutRF has been tested on Pi4 at 20Msps, which is the default recording rate). Also ensure your recording medium (e.g. flash drive, USB hard disk) is not timing out or blocking.
Expand Down
4 changes: 2 additions & 2 deletions gamutrf/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ def argument_parser():
"--tuneoverlap",
dest="tuneoverlap",
type=float,
default=0.5,
default=0.85,
help="multiple of samp_rate when retuning",
)
parser.add_argument(
"--bucket_range",
dest="bucket_range",
type=float,
default=1.0,
default=0.85,
help="what proportion of FFT buckets to use",
)
parser.add_argument(
Expand Down
4 changes: 4 additions & 0 deletions gamutrf/sigfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ def process_scan(args, scan_configs, prom_vars, df, lastbins, running_df, last_d
threshold=args.threshold,
)
)
min_samp_rate = (
min([scan_config["sample_rate"] for scan_config in scan_configs]) / 1e6
)
df.loc[freqdiffs > min_samp_rate * 2, "db"] = np.nan

if PEAK_TRIGGER == 1 and signals:
led_sleep = 0.2
Expand Down
13 changes: 7 additions & 6 deletions gamutrf/zmqreceiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ def txtbuf_to_lines(self, log):
return lines
return None

def read_new_frame_df(self, df):
def read_new_frame_df(self, df, discard_time):
frame_df = None
df = df[(time.time() - df.ts).abs() < 60]
if discard_time:
df = df[(time.time() - df.ts).abs() < discard_time]
if df.size:
lastfreq = df.freq.iat[-1]
logging.info("last frequency read %f MHz", lastfreq / 1e6)
Expand Down Expand Up @@ -196,14 +197,14 @@ def lines_to_df(self, lines):
logging.error(str(err))
return (None, None)

def read_buff(self, log):
def read_buff(self, log, discard_time):
scan_config = None
frame_df = None
if self.read_buff_file():
lines = self.txtbuf_to_lines(log)
if lines:
scan_config, df = self.lines_to_df(lines)
frame_df = self.read_new_frame_df(df)
frame_df = self.read_new_frame_df(df, discard_time)
return scan_config, frame_df


Expand Down Expand Up @@ -254,8 +255,8 @@ def frame_resample(self, df):
return df.sort_values("freq")
return df

def read_buff(self, log=None):
results = [scanner.read_buff(log) for scanner in self.scanners]
def read_buff(self, log=None, discard_time=0):
results = [scanner.read_buff(log, discard_time) for scanner in self.scanners]
if self.last_results:
for i, result in enumerate(results):
_scan_config, df = result
Expand Down
2 changes: 2 additions & 0 deletions tests/test_sigfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def test_process_scans(self):
scan_config = {
"freq_start": freq_start,
"freq_end": freq_end,
"sample_rate": int(1e6),
}
with open(zmqr.scanners[0].buff_file, "wb") as zbf:
with context.stream_writer(zbf) as bf:
Expand All @@ -193,6 +194,7 @@ def test_process_scans(self):
"config": {
"freq_start": freq_start,
"freq_end": freq_end,
"sample_rate": int(1e6),
},
"buckets": {},
}
Expand Down

0 comments on commit c895b45

Please sign in to comment.