|
@@ -67,11 +67,11 @@ def best_match(known_points, new_point, similarity):
|
|
|
best = pt
|
|
|
return best, max_
|
|
|
|
|
|
-def select_bad_wifi(pts, crit):
|
|
|
+def get_wifi_coverage(pts):
|
|
|
from collections import namedtuple
|
|
|
Loc = namedtuple('Loc', ['latitude', 'longitude'])
|
|
|
mac_loc = {}
|
|
|
- bad_mac = set()
|
|
|
+ mac_cov = {}
|
|
|
for i in range(len(pts)):
|
|
|
for mac in pts[i].wifi_snr:
|
|
|
if not mac in mac_loc:
|
|
@@ -86,10 +86,18 @@ def select_bad_wifi(pts, crit):
|
|
|
sum_lo += loc.longitude
|
|
|
cent = Loc(sum_la / len(mac_loc[mac]),
|
|
|
sum_lo / len(mac_loc[mac]))
|
|
|
+ cov = 0
|
|
|
for loc in mac_loc[mac]:
|
|
|
- if dist(cent, loc) > crit:
|
|
|
- bad_mac.add(mac)
|
|
|
- break
|
|
|
+ cov = max(cov, dist(cent, loc))
|
|
|
+ mac_cov[mac] = cov
|
|
|
+ return mac_cov
|
|
|
+
|
|
|
+def select_bad_wifi(pts, crit):
|
|
|
+ bad_mac = set()
|
|
|
+ cov = get_wifi_coverage(pts)
|
|
|
+ for mac in cov:
|
|
|
+ if cov[mac] > crit:
|
|
|
+ bad_mac.add(mac)
|
|
|
return bad_mac
|
|
|
|
|
|
def remove_bad_wifi(pts, bad_mac):
|