code: Getting rows for landmarks
This commit is contained in:
parent
3dd9913af6
commit
b258378a20
@ -936,7 +936,7 @@ def find_lmdks_cont(lmdk_data, seq, uid, pct):
|
|||||||
landmarks percentage.
|
landmarks percentage.
|
||||||
0: uid, 1: lmdk_pct, 2: contacts
|
0: uid, 1: lmdk_pct, 2: contacts
|
||||||
seq - The users' data.
|
seq - The users' data.
|
||||||
0: uid, 1: lmdk_pct, 2: contacts
|
0: tim, 1: uid, 2: cont, 3: rssi
|
||||||
uid - The user's id that we are interested in.
|
uid - The user's id that we are interested in.
|
||||||
pct - The landmarks percentage.
|
pct - The landmarks percentage.
|
||||||
Returns:
|
Returns:
|
||||||
@ -945,17 +945,19 @@ def find_lmdks_cont(lmdk_data, seq, uid, pct):
|
|||||||
0: uid_b
|
0: uid_b
|
||||||
'''
|
'''
|
||||||
# Initialize user's landmarks
|
# Initialize user's landmarks
|
||||||
lmdks = np.empty(0)
|
lmdks = np.empty(0).reshape(0,4)
|
||||||
# All the sequence
|
# All the sequence
|
||||||
if pct == 100:
|
if pct == 100:
|
||||||
# Get all timestamps
|
# Get all timestamps
|
||||||
return seq[:, 1]
|
return seq
|
||||||
# Find for given percentage
|
# Find for given percentage
|
||||||
elif pct != 0:
|
elif pct != 0:
|
||||||
# All user's landmark contacts for all landmarks percentages
|
# All user's landmark contacts for all landmarks percentages
|
||||||
usr_lmdks = lmdk_data[lmdk_data[:, 0] == uid]
|
usr_lmdks = lmdk_data[lmdk_data[:, 0] == uid]
|
||||||
# User's landmark contacts for given percentage
|
conts = ast.literal_eval(usr_lmdks[usr_lmdks[:, 1] == str(pct/100)][0][2])
|
||||||
lmdks = ast.literal_eval(usr_lmdks[usr_lmdks[:, 1] == str(pct/100)][0][2])
|
# Actual landmarks
|
||||||
|
for c in conts:
|
||||||
|
lmdks = np.vstack([lmdks, seq[seq[:, 2] == c]])
|
||||||
return lmdks
|
return lmdks
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user