From 1adbf81950e61d36b9064a29e2b79704b5ae2dcf Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Thu, 18 Oct 2012 12:22:52 -0700 Subject: [PATCH] Added get_dupes.py (not installed with apps). Pipe modes_rx output through get_dupes.py to find number of spurious replies. Intended to evaluate demodulator changes. --- apps/get_dupes.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 apps/get_dupes.py diff --git a/apps/get_dupes.py b/apps/get_dupes.py new file mode 100755 index 0000000..91fab13 --- /dev/null +++ b/apps/get_dupes.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import sys, re + +if __name__== '__main__': + data = sys.stdin.readlines() + icaos = [] + num_icaos = 0 + for line in data: + match = re.match(".*Type.*from (\w+)", line) + if match is not None: + icao = int(match.group(1), 16) + icaos.append(icao) + + #get dupes + dupes = sorted([icao for icao in set(icaos) if icaos.count(icao) > 1]) + count = sum([icaos.count(icao) for icao in dupes]) + for icao in dupes: + print "%x" % icao + print "Found %i replies from %i non-unique aircraft, out of a total %i replies (%i likely spurious replies)." \ + % (count, len(dupes), len(icaos), len(icaos)-count) + +