コード例 #1
0
ファイル: bssid_tracker.py プロジェクト: amitzini/OpenTrain
 def has_bssid_high_confidence(self, bssid):
     if USE_FILE and not bssid.startswith(FAKE_BSSID_PREFIX):
         result = file_map.has_key(bssid)
         if not result:
             logger.warn('Unknown bssid: %s' % bssid)
         return result
     else:        
         if not self.has_bssid(bssid):
             logger.warn('Unknown bssid: %s' % bssid)
             return False
         
         _, stop_probability, total = self.get_stop_id(bssid)
         if total < config.stop_discovery_count_thresh:
             return False
 
         if stop_probability < config.stop_discovery_probability_thresh:
             return False
         
         return True
コード例 #2
0
ファイル: bssid_tracker.py プロジェクト: amitzini/OpenTrain
 def get_stop_id(self, bssid):
     
     if USE_FILE and not bssid.startswith(FAKE_BSSID_PREFIX):
         if file_map.has_key(bssid):
             return file_map[bssid], 1, 1
         else:
             logger.warn('Unknown bssid: %s' % bssid)
             return stops.NOSTOP_ID, 0, 0
     else:
         p = get_redis_pipeline()
         p.zrange("bssid:%s:counters" % (bssid), -1, -1, withscores=True)
         p.get("bssid:%s:total" % (bssid))
         res = p.execute()
         
         counts = [x[1] for x in res[0]]
         stop_id, score = res[0][counts.index(max(counts))]
         stop_id = int(stop_id)
         total = res[1]
         stop_probability = float(score)/float(total)
 
         return stop_id, stop_probability, total