From 6b852a9b03e65777739ed8fd0af49fe7c61bd58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Mon, 24 Dec 2018 23:04:19 +0100 Subject: [PATCH] use power of too to approximate wifi levels linearly --- src/c3nav/routing/locator.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/c3nav/routing/locator.py b/src/c3nav/routing/locator.py index ba468afe..47a2597a 100644 --- a/src/c3nav/routing/locator.py +++ b/src/c3nav/routing/locator.py @@ -72,7 +72,7 @@ class Locator: return None # convert scan values - scan_values = {station_id: value**3 for station_id, value in scan_values.items()} + scan_values = {station_id: value**2 for station_id, value in scan_values.items()} # get visible spaces spaces = tuple(space for pk, space in self.spaces.items() if pk not in restrictions.spaces) @@ -113,7 +113,7 @@ class LocatorStations: class LocatorSpace: - no_signal = int(-90)**3 + no_signal = int(-90)**2 def __init__(self, pk, points): self.pk = pk @@ -122,10 +122,10 @@ class LocatorSpace: self.stations = tuple(self.stations_set) self.stations_lookup = {station_id: i for i, station_id in enumerate(self.stations)} - self.levels = np.full((len(self.points), len(self.stations)), fill_value=int(-90)**3, dtype=np.int64) + self.levels = np.full((len(self.points), len(self.stations)), fill_value=self.no_signal, dtype=np.int64) for i, point in enumerate(self.points): for station_id, value in point.values.items(): - self.levels[i][self.stations_lookup[station_id]] = int(value)**3 + self.levels[i][self.stations_lookup[station_id]] = int(value)**2 def get_best_point(self, scan_values, needed_station_id=None): # check if this space knows the needed station id, otherwise no results here