Пример #1
0
    def __init__(self, node_eui):
        self.file = "maps/%s.json" % node_eui
        self.features = features.load(self.file)
        self.all_nodes = features.load("maps/all_nodes.json")
        self.hashes = set([x["properties"]["hash"] for x in self.features])
        self.gateways = {}

        known_gateways = set([x["properties"]["eui"] for x in self.all_nodes if "eui" in x["properties"]])
        for eui in known_gateways:
            self.gateway_seen(eui)
Пример #2
0
    def __init__(self, node_eui):
        self.file = 'maps/%s.json' % node_eui
        self.features = features.load(self.file)
        self.all_nodes = features.load('maps/all_nodes.json')
        self.hashes = set([x['properties']['hash'] for x in self.features])
        self.gateways = {}

        known_gateways = set([x['properties']['eui']
                             for x in self.all_nodes
                             if 'eui' in x['properties']])
        for eui in known_gateways:
            self.gateway_seen(eui)
Пример #3
0
    def gateway_seen(self, eui):
        if eui in self.gateways:
            return True

        self.gateways[eui] = features.load("maps/%s.json" % eui)

        return True if len(self.gateways[eui]) > 0 else False
Пример #4
0
    def gateway_seen(self, eui):
        if eui in self.gateways:
            return True

        self.gateways[eui] = features.load('maps/%s.json' % eui)

        return True if len(self.gateways[eui]) > 0 else False
Пример #5
0
#cam_ypr = [-3.0, -12.0, -3.0] # yaw, pitch, roll
#ref = [44.7260320000, -93.0771072000, 0]
ref = [ data['gps'][0]['lat'], data['gps'][0]['lon'], 0.0 ]
hud1.set_ned_ref(data['gps'][0]['lat'], data['gps'][0]['lon'])
hud2.set_ned_ref(data['gps'][0]['lat'], data['gps'][0]['lon'])
print('ned ref:', ref)

print('temporarily disabling airport loading')
#hud1.load_airports()

hud1.set_ground_m(ground_m)
hud2.set_ground_m(ground_m)

if args.features:
    feats = features.load(args.features, ref)
    hud1.update_features(feats)
else:
    feats = []

metadata = skvideo.io.ffprobe(args.video)
#print(metadata.keys())
#import json
#print(json.dumps(metadata["video"], indent=4))
fps_string = metadata['video']['@avg_frame_rate']
(num, den) = fps_string.split('/')
fps = float(num) / float(den)
codec = metadata['video']['@codec_long_name']
w = int(round(int(metadata['video']['@width']) * args.scale))
h = int(round(int(metadata['video']['@height']) * args.scale))
total_frames = int(round(float(metadata['video']['@duration']) * fps))
Пример #6
0
    def testSaveAndLoad(self):
      text = "ekin and ekin."
      results = features.extract(text, 
      [Features.LETTERUNIGRAM, Features.LETTERBIGRAMS], False)

      features.save(results, "test1")
      returned = features.load("test1")
      os.remove("test1")

      self.assertEquals(results, returned)

      self.assertEqual(2, returned[Features.LETTERUNIGRAM][ord('e')-ord('a')])

      results = features.extract(text, 
      [Features.POSBIGRAMS, Features.LETTERBIGRAMS], True)
      features.save(results, "test2")
      returned = features.load("test2")
      os.remove("test2")

      self.assertEquals(results, returned)
      results = features.extract(text, 
      [Features.LETTERUNIGRAM, Features.LETTERBIGRAMS, Features.POSUNIGRAM, Features.POSBIGRAMS], True)
      features.save(results, "test3")
      returned = features.load("test3")
      os.remove("test3")

      self.assertEquals(results, returned)
      
      text = ""
      results = features.extract(text, 
      [Features.LETTERUNIGRAM, Features.LETTERBIGRAMS, Features.POSUNIGRAM, Features.POSBIGRAMS], False)
      
      features.save(results, "test4")
      returned = features.load("test4")
      os.remove("test4")

      self.assertEquals(results, returned)
      
      
      text = "\ttrying to test really long text\n\n \a and see if it still works or not \n 101 531 z3z3\n\t"
      text += text;
      text += text;
      results = features.extract(text, 
      [Features.LETTERUNIGRAM, Features.LETTERBIGRAMS, Features.POSUNIGRAM, Features.POSBIGRAMS], False)
      
      features.save(results, "test5")
      returned = features.load("test5")
      os.remove("test5")

      self.assertEquals(results, returned)
      
      text = ['test1', '222aaa', 'threee333', 't\test1'];
      results['authors'] = [0, 0, 1, 1]
      results['text'] = list();
      for t in text:
        results['text'].append(features.extract(t, [Features.LETTERUNIGRAM, Features.LETTERBIGRAMS, Features.POSUNIGRAM, Features.POSBIGRAMS], False))
      features.save(results, "test6");
      returned = features.load("test6");
      os.remove("test6")
          
      self.assertEqual(results['authors'], returned['authors'])
      
      for idx in range(0,len(returned['text'])):
          feat = features.extract(text[idx], [Features.LETTERUNIGRAM, Features.LETTERBIGRAMS, Features.POSUNIGRAM, Features.POSBIGRAMS], False)
          self.assertEqual(feat, returned['text'][idx])