there is still hope for wifi location

This commit is contained in:
Laura Klünder 2017-12-26 16:06:28 +01:00
parent 6d2417c522
commit c033863ff6

View file

@ -134,16 +134,16 @@ 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=(-90)**3, dtype=np.int64)
self.levels = np.full((len(self.points), len(self.stations)), fill_value=int(-90)**3, 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]] = value**3
self.levels[i][self.stations_lookup[station_id]] = int(value)**3
def get_best_point(self, scan_values, station_ids, needed_station_id=None):
stations = tuple(self.stations_lookup[station_id] for station_id in station_ids)
values = np.array(tuple(scan_values[station_id]**3 for station_id in station_ids), dtype=np.int64)
acceptable_points = tuple(
np.argwhere(self.levels[:, self.stations_lookup[needed_station_id]] > -90).ravel()
np.argwhere(self.levels[:, self.stations_lookup[needed_station_id]] > int(-90)**3).ravel()
)
if not acceptable_points:
return None, None