diff --git a/code/lib/lmdk_lib.py b/code/lib/lmdk_lib.py index c7a0085..07a0c3f 100644 --- a/code/lib/lmdk_lib.py +++ b/code/lib/lmdk_lib.py @@ -936,7 +936,7 @@ def find_lmdks_cont(lmdk_data, seq, uid, pct): landmarks percentage. 0: uid, 1: lmdk_pct, 2: contacts 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. pct - The landmarks percentage. Returns: @@ -945,17 +945,19 @@ def find_lmdks_cont(lmdk_data, seq, uid, pct): 0: uid_b ''' # Initialize user's landmarks - lmdks = np.empty(0) + lmdks = np.empty(0).reshape(0,4) # All the sequence if pct == 100: # Get all timestamps - return seq[:, 1] + return seq # Find for given percentage elif pct != 0: # All user's landmark contacts for all landmarks percentages usr_lmdks = lmdk_data[lmdk_data[:, 0] == uid] - # User's landmark contacts for given percentage - lmdks = ast.literal_eval(usr_lmdks[usr_lmdks[:, 1] == str(pct/100)][0][2]) + conts = 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