-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from cosbidev/v2.0.3
V2.0.3
- Loading branch information
Showing
11 changed files
with
130 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
Analytics | ||
======== | ||
|
||
visualization | ||
------------- | ||
.. automodule:: pytrack.analytics.visualization | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:inherited-members: | ||
|
||
video | ||
------------- | ||
.. automodule:: pytrack.analytics.video | ||
:members: | ||
:undoc-members: | ||
|
||
plugins | ||
------------- | ||
.. automodule:: pytrack.analytics.plugins | ||
:members: | ||
:undoc-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ utils | |
.. automodule:: pytrack.graph.utils | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Segmenter: | ||
""" Skeleton parent class to perform the segmentation operation. | ||
""" | ||
def __init__(self): | ||
pass | ||
|
||
def processing(self, img): | ||
""" It takes an input image and returns the processed image. | ||
""" | ||
pass | ||
|
||
def run(self, img): | ||
""" It takes an input image and returns the mask of the segmented image. | ||
""" | ||
pass |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from pytrack.graph import distance | ||
|
||
|
||
def veldist_filter(traj, th_dist=5, th_vel=3): | ||
""" It filters the GPS trajectory combining speed and distance between adjacent points. | ||
If the adjacent point distance does not exceed the threshold and the speed is less than th_vel (m/s), the current | ||
trajectory point is ignored. | ||
Parameters | ||
---------- | ||
traj: pandas.DataFrame | ||
Dataframe containing 3 columns [timestamp, latitude, longitude]. | ||
th_dist: float, optional, default: 5 meters. | ||
Threshold for the distance of adjacent points. | ||
th_vel: float, optional, default: 3 m/s. | ||
Threshold for the velocity. | ||
Returns | ||
------- | ||
df: pandas.DataFrame | ||
Filtered version of the input dataframe. | ||
""" | ||
|
||
df = traj.copy() | ||
|
||
i = 0 | ||
while True: | ||
if i == df.shape[0]-1: | ||
break | ||
deltat = (df["datetime"][i+1]-df["datetime"][i]).total_seconds() | ||
dist = distance.haversine_dist(*tuple(df.iloc[i, [1, 2]]), *tuple(df.iloc[i+1, [1, 2]])) | ||
|
||
if dist < th_dist and dist/deltat < th_vel: | ||
df.drop([i+1], inplace=True) | ||
df.reset_index(drop=True, inplace=True) | ||
else: | ||
i += 1 | ||
|
||
return df | ||
|
||
|
||
def park_filter(traj, th_dist=50, th_time=30): | ||
""" It removes parking behaviour by eliminating those points that remain in a certain area | ||
for a given amount of time. | ||
Parameters | ||
---------- | ||
traj: pandas.DataFrame | ||
Dataframe containing 3 columns [timestamp, latitude, longitude]. | ||
th_dist: float, optional, default: 50 meters. | ||
Threshold for the distance of adjacent points. | ||
th_time: float, optional, default: 30 min. | ||
Threshold for the delta time. | ||
Returns | ||
------- | ||
df: pandas.DataFrame | ||
Filtered version of the input dataframe. | ||
""" | ||
|
||
df = traj.copy() | ||
|
||
i = 0 | ||
while True: | ||
if i == df.shape[0]-1: | ||
break | ||
deltat = (df["datetime"][i+1]-df["datetime"][i]).total_seconds() | ||
deltad = distance.haversine_dist(*tuple(df.iloc[i, [1, 2]]), *tuple(df.iloc[i+1, [1, 2]])) | ||
|
||
if deltad < th_dist and deltat > th_time: | ||
df.drop([i+1], inplace=True) | ||
df.reset_index(drop=True, inplace=True) | ||
else: | ||
i += 1 | ||
|
||
return df | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
from . import mpmatching | ||
|
||
class Matcher: | ||
def __init__(self, G, trellis): | ||
self.G | ||
self.trellis | ||
|
||
def match(self): | ||
path_prob, predecessor = mpmatching.viterbi_search(self.G_interp, self.trellis, "start", "target") | ||
""" Skeleton parent class to perform the matching operation. | ||
""" | ||
def __init__(self, G): | ||
self.G = G | ||
|
||
return results | ||
def match(self, points): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters