fix error flood during locating

This commit is contained in:
Laura Klünder 2017-12-26 15:28:41 +01:00
parent 90999daa31
commit d6402839ab

View file

@ -98,6 +98,8 @@ class Locator:
for pk, space, station_ids in good_spaces:
point, score = space.get_best_point(scan_values, station_ids, needed_station_id=best_station_id)
if point is None:
continue
if score < best_score:
location = CustomLocation(router.spaces[pk].level, point.x, point.y,
permissions=permissions, icon='my_location')
@ -143,6 +145,8 @@ class LocatorSpace:
acceptable_points = tuple(
np.argwhere(self.levels[:, self.stations_lookup[needed_station_id]] > -90).ravel()
)
if not acceptable_points:
return None, None
scores = np.sum((self.levels[np.array(acceptable_points).reshape((-1, 1)),
stations]-values)**2, axis=1) / len(stations)