t-drive: Debugging
This commit is contained in:
@ -856,7 +856,6 @@ def find_lmdks(usrs_data, args):
|
||||
'''
|
||||
usrs_lmdks = np.empty((0,4), np.float32)
|
||||
traj_cur = 0
|
||||
lmdk_id = 0
|
||||
usrs = np.unique(usrs_data[:,0])
|
||||
for usr_i, usr in enumerate(usrs):
|
||||
# Initialize user's landmarks list
|
||||
@ -888,11 +887,6 @@ def find_lmdks(usrs_data, args):
|
||||
per = abs(datetime.fromtimestamp(int(traj[i][3])) - datetime.fromtimestamp(int(traj[j][3]))).total_seconds()/60
|
||||
# Check if enough time passed
|
||||
if per > args.per:
|
||||
# usrs_id starts from 1
|
||||
lmdk_id += 1
|
||||
# Assign id to current landmark
|
||||
for l in lmdk_cur:
|
||||
l[0] = lmdk_id
|
||||
# Append current landmark
|
||||
lmdks += lmdk_cur
|
||||
# Continue checking from the current point
|
||||
@ -910,7 +904,7 @@ def find_lmdks(usrs_data, args):
|
||||
def find_lmdks_seq(seq, lmdks):
|
||||
lmdks_seq = []
|
||||
for i, p in enumerate(seq):
|
||||
if any(np.equal(lmdks, p).all(1)):
|
||||
if is_landmark(p, lmdks):
|
||||
lmdks_seq.append(i + 1)
|
||||
return np.array(lmdks_seq, dtype = int)
|
||||
|
||||
@ -1073,6 +1067,6 @@ def is_landmark(p, lmdks):
|
||||
Returns:
|
||||
True/False
|
||||
'''
|
||||
if len(lmdks) and any(np.equal(lmdks, p).all(1)):
|
||||
if len(lmdks) > 0 and any(np.equal(lmdks, p).all(1)):
|
||||
return True
|
||||
return False
|
||||
|
Reference in New Issue
Block a user