code: Optimizing contact parsing
This commit is contained in:
parent
2704705ddf
commit
fc7f7f6f90
@ -30,9 +30,11 @@ rssi = 3
|
|||||||
|
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
# Get contacts [tim, uid_a, uid_b] from previous parsing
|
# Get contacts from previous parsing
|
||||||
cont = lmdk_lib.load_data(args, 'cont')
|
cont_data = lmdk_lib.load_data(args, 'cont')
|
||||||
if cont.size == 0:
|
if cont_data.size == 0:
|
||||||
|
# Contacts [tim, uid_a, uid_b, rssi]
|
||||||
|
cont = []
|
||||||
try:
|
try:
|
||||||
print('Extracting %s... ' %(os.path.abspath(args.arc)), end='', flush=True)
|
print('Extracting %s... ' %(os.path.abspath(args.arc)), end='', flush=True)
|
||||||
with zipfile.ZipFile(args.arc, 'r') as arc:
|
with zipfile.ZipFile(args.arc, 'r') as arc:
|
||||||
@ -46,14 +48,14 @@ def main(args):
|
|||||||
for c in cont_l:
|
for c in cont_l:
|
||||||
if c[uid_b] != '-1' and c[rssi] != '0' and c[uid_b] != '-2' and c[uid_a] != c[uid_b]:
|
if c[uid_b] != '-1' and c[rssi] != '0' and c[uid_b] != '-2' and c[uid_a] != c[uid_b]:
|
||||||
# Add valid contact
|
# Add valid contact
|
||||||
cont.append([c[tim], c[uid_a], c[uid_b]])
|
cont.append([c[tim], c[uid_a], c[uid_b], c[rssi]])
|
||||||
print('[OK]')
|
print('[OK]')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('[Error: %s]' %(e))
|
print('[Error: %s]' %(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('[Error: %s]' %(e))
|
print('[Error: %s]' %(e))
|
||||||
# Save to results
|
# Save to results
|
||||||
lmdk_lib.save_data(args, np.array(cont), 'cont')
|
lmdk_lib.save_data(args, np.array(cont, np.float32), 'cont')
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user