geopard
Matching of gpx segments with dynamic time warping.
Description
Pre-processing and analysis of gpx tracks (activities) for comparison to an existing gpx track (gold standard, segment). Checked are the joint start and end points with a given tolerance to trim the activity. Both tracks are interpolated to allow for both curves to be compared with dynamic time warping. Dynamic time warping allows to assess whether the activity actually completed the gold standard segment, and what the shortest required time was (in case of multiple repetitions or many points of the activity within the allowed distance of start and end points).
Setup
Poetry (recommended)
- Poetry is used for the virtual Python environment.
-
Install python poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
or
pip install --user poetry
-
Make sure that the virtual environment is installed in the root folder of this projects:
poetry config virtualenvs.in-project true
-
Install dependencies:
poetry install --no-root
-
Add packages: To add further packages, run:
poetry add <package-name>
-
pip
Alternatively, install python dependencies with pip:
pip install -r requirements.txt
Code formatting
-
Formatting via pre-commit hook: Python code is formatted using pre-commit hooks.
-
Install pre-commit:
pip install pre-commit
or
brew install pre-commit
-
Install pre-commit hooks from the config file .pre-commit-config.yaml
pre-commit install -
Run the pre-commit hooks:
pre-commit run -a
Code testing
Testing is done with pytest. The pytest package is already installed in the poetry venv.
-
Run all tests:
pytest
-
Run individual tests:
pytest <path-to-test-files>
Usage
- Example GPX tracks are available at https://github.com/danielvogler/geopard_tests
- Example files for construction of start/finish region in
<PROJECT_ROOT>/data/csv_polygon_files/ - Example usage demonstrated in
<PROJECT_ROOT>/geopard_example
Example usage with circular start region around gold start/end points:
import geopard
# initialize
gp = geopard.Geopard()
# dtw matching of example segments/activities
response = gp.dtw_match(gold_name, activity_name)
# optional with:
# min_trkps - minimum number of trackpoints between start and finish
# radius - radius around start and finish of gold segment
# dtw_threshold - segment match quality
response = gp.dtw_match(gold_name, activity_name, min_trkps = 100, radius=15, dtw_threshold=0.3)
# GeopardResponse
# final time
response.time
# final dtw
response.dtw
# final start point
response.start_point
# final end point
response.end_point
# match flag
response.match_flag
# is_success and error
response.is_success
response.error
Example usage with start/finish regions:
import geopard
# initialize
gp = geopard.Geopard()
start_region = gp.create_polygon("<PROJECT_ROOT>/data/csv_polygon_files/example_start_region.csv")
finish_region = gp.create_polygon("<PROJECT_ROOT>/data/csv_polygon_files/example_finish_region.csv")
gold_name = './data/gpx_files/tds_sunnestube_segment.gpx'
activity_name = './data/gpx_files/tds_sunnestube_activity_25_25.gpx'
geopard_response = gp.dtw_match(gold_name, activity_name, start_region=start_region, finish_region=finish_region)
# GeopardResponse
gp.parse_response(geopard_response)
Examples
Example of gold segment, total activity and activity cropped to gold segment length.
Example of start and end points to crop gpx tracks and obtain pairs for dtw matching.
Metadata
Release files for geopard 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| geopard-0.2.3.tar.gz | 11.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geopard-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.2 kB
Release files / geopard-0.2.3.tar.gz
| Download URL | geopard-0.2.3.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de01c0c049616fa22abdcd3669b83768106a643cfc3bbd321291172b9d4eaba3
|
|
BLAKE2b-256 checksum How to use checksums |
96c26361aea0dd089995a0d04b75399d38d6a6a43111e9889de70340a3407b1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / geopard-0.2.3-py3-none-any.whl
| Download URL | geopard-0.2.3-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b35eef4cdd351da845699863da88343e35329d74e588fb8fbd89a9afe21167be
|
|
BLAKE2b-256 checksum How to use checksums |
aa39cc17e7c97e976fc6dbe17f074bfda60039c1183d4232f98618fef063e459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for geopard 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.