diff --git a/infostop/__init__.py b/infostop/__init__.py index fe60995..9d09dc3 100644 --- a/infostop/__init__.py +++ b/infostop/__init__.py @@ -4,8 +4,9 @@ This package implements stop location detection using Infomap. """ +from .detect import label_trace from .detect import best_partition -from .detect import run_infomap +from .detect import label_distance_matrix name = "infostop" diff --git a/infostop/detect.py b/infostop/detect.py index 5613f4b..b3ae719 100644 --- a/infostop/detect.py +++ b/infostop/detect.py @@ -1,6 +1,11 @@ import numpy as np +import warnings from infostop import utils +def best_partition(coords, r1=10, r2=10, label_singleton=False, min_staying_time=300, max_time_between=86400, distance_function=utils.haversine, return_intervals=False, min_size=2): + warnings.warn("`best_partition` is deprecated and will be removed in a future version. Instead use `label_trace`.") + return label_trace(coords, r1, r2, label_singleton, min_staying_time, max_time_between, distance_function, return_intervals, min_size) + def label_trace(coords, r1=10, r2=10, label_singleton=False, min_staying_time=300, max_time_between=86400, distance_function=utils.haversine, return_intervals=False, min_size=2): """Infer best stop-location labels from stationary points using infomap. diff --git a/infostop/utils.py b/infostop/utils.py index 1d96662..f6822ab 100644 --- a/infostop/utils.py +++ b/infostop/utils.py @@ -215,7 +215,7 @@ def infomap_communities(nodes, edges): for k, v in infomapSimple.getModules().items() ]) -def distance_matrix(stop_events, distance_function): +def distance_matrix(stop_events, distance_function=haversine): """Compute distance matrix between list of points. Input