lmdk_lib: Added timestamps and contacts landmarks
This commit is contained in:
		@ -892,7 +892,7 @@ def find_lmdks(usrs_data, args):
 | 
			
		||||
  return usrs_lmdks
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def find_lmdks_cont(lmdk_data, seq, uid, pct):
 | 
			
		||||
def find_lmdks_tim(lmdk_data, seq, uid, pct):
 | 
			
		||||
  '''
 | 
			
		||||
    Find user's landmarks timestamps.
 | 
			
		||||
 | 
			
		||||
@ -927,6 +927,38 @@ def find_lmdks_cont(lmdk_data, seq, uid, pct):
 | 
			
		||||
  return lmdks
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def find_lmdks_cont(lmdk_data, seq, uid, pct):
 | 
			
		||||
  '''
 | 
			
		||||
    Find user's landmarks contacts.
 | 
			
		||||
 | 
			
		||||
    Parameters:
 | 
			
		||||
      lmdk_data - The landmarks contacts for all users per 
 | 
			
		||||
                  landmarks percentage.
 | 
			
		||||
                  0: uid, 1: lmdk_pct, 2: contacts
 | 
			
		||||
      seq       - The users' data.
 | 
			
		||||
                  0: uid, 1: lmdk_pct, 2: contacts
 | 
			
		||||
      uid       - The user's id that we are interested in.
 | 
			
		||||
      pct       - The landmarks percentage.
 | 
			
		||||
    Returns:
 | 
			
		||||
      lmdks - The user's landmarks contacts for the given 
 | 
			
		||||
              landmarks percentage.
 | 
			
		||||
              0: uid_b
 | 
			
		||||
  '''
 | 
			
		||||
  # Initialize user's landmarks
 | 
			
		||||
  lmdks = np.empty(0)
 | 
			
		||||
  # All the sequence
 | 
			
		||||
  if pct == 100:
 | 
			
		||||
    # Get all timestamps
 | 
			
		||||
    return seq[:, 1]
 | 
			
		||||
  # 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])
 | 
			
		||||
  return lmdks
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def lmdks_stats(args, usrs_lmdks):
 | 
			
		||||
  '''
 | 
			
		||||
    Generate landmarks' stats.
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user