From 8b2872866a6cd091f53d5e58c0df0adc25e19570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Tue, 26 Dec 2017 13:13:41 +0100 Subject: [PATCH] counteract quadratic signal drop --- src/c3nav/routing/locator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/c3nav/routing/locator.py b/src/c3nav/routing/locator.py index 655ac1e4..38b226e4 100644 --- a/src/c3nav/routing/locator.py +++ b/src/c3nav/routing/locator.py @@ -120,14 +120,14 @@ 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=-100, dtype=np.int16) + self.levels = np.full((len(self.points), len(self.stations)), fill_value=(-90)**2, dtype=np.int32) for i, point in enumerate(self.points): for station_id, value in point.values.items(): - self.levels[i][self.stations_lookup[station_id]] = value + self.levels[i][self.stations_lookup[station_id]] = value**2 def get_best_point(self, scan_values, station_ids): stations = tuple(self.stations_lookup[station_id] for station_id in station_ids) - values = np.array(tuple(scan_values[station_id] for station_id in station_ids), dtype=np.int16) + values = np.array(tuple(scan_values[station_id]**2 for station_id in station_ids), dtype=np.int32) scores = np.sum((self.levels[:, stations]-values)**2, axis=1) best_point = np.argmin(scores).ravel()[0] return self.points[best_point], scores[best_point]