Private
Public Access
1
0

more foundation work for scoring

This commit is contained in:
Sander Roosendaal
2020-05-26 10:56:23 +02:00
parent 74ff1f9874
commit 08c7562c51
4 changed files with 132 additions and 5 deletions

View File

@@ -2,6 +2,11 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# low level methods
def coordinate_in_path(latitude,longitude, p):
@@ -18,12 +23,12 @@ def time_in_path(df,p,maxmin='max',getall=False):
if df.empty:
return 0
latitude = df.latitude
longitude = df.longitude
f = lambda x: coordinate_in_path(x['latitude'],x['longitude'],p)
df['inpolygon'] = df.apply(f,axis=1)
if maxmin=='max':
@@ -40,7 +45,7 @@ def time_in_path(df,p,maxmin='max',getall=False):
raise InvalidTrajectoryError("Trajectory doesn't go through path")
return 0
@@ -64,7 +69,7 @@ def coursetime_paths(data,paths,finalmaxmin='min'):
entrytime = data['time'].max()
entrydistance = data['cum_dist'].max()
coursecompleted = False
# corner case - empty list of paths
if len(paths) == 0:
return 0,True