Find valuable gems 💎 in your tracked sport 🚴 activity!
Project description
sportgems
Sportgems finds valuable gems 💎 in your tracked sport 🚴 activity!
What is it?
Sportgems lets you efficiently parse your activity data. It will search and find your fastest sections. It will determine the start, end and speed of whatever fastest sections you are interested in, e.g. 1km, 2km, 10km and others. This repo is a rust reincarnation of the C++ implementation of the sportgems algorithm.
Sportgems is used in workoutizer to find your fastest 1km (and other 💎) in all your activities and ultimately visualize it.
Get Started
Sportgems is bundled in a python package using pyo3. Simply install it using pip:
pip install sportgems
In order to search for gems 💎 in your activity, pass the coordinates as list of tuples of
floats (lat, lon)
and the timestamps as a list of floats as seconds since the Unix epoch:
from sportgems import find_fastest_section
fastest_1km = 1000 # meter
coordinates = [(48.123, 9.35), (48.123, 9.36), (48.123, 9.37), (48.123, 9.38)]
times = [1608228953.8, 1608228954.8, 1608228955.8, 1608228956.8]
result = find_fastest_section(fastest_1km, times, coordinates)
The result will be a python object with the following attributes:
result.valid_section = True
result.start_index = 1
result.end_index = 2
result.velocity = 743.0908195788583
How does it work?
The following diagram illustrates how the core algorithm (implemented in gem_finder.cpp
) works:
Running the tests
In order to run the rust unit tests simply run
cargo test --no-default-features
To run the python tests, you first need to install the requirements
pip install -r requirements.txt
and subsequently run the tests
pytest tests/
Contributing
Contributions are welcome!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for sportgems-0.3.0-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f1d0f459f7c22ded2bf3b604ba260eeb12f18cb8b5d6513698f0aaf9cfb5c60 |
|
MD5 | 444ad04cc2a71fe59c6123ec55c07567 |
|
BLAKE2b-256 | 35f5785c48c8ecdc51d62401aae7568d05ec164e4f1755764f14119fa6b5787b |
Hashes for sportgems-0.3.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d83a4c8d6508aaefdda114e10c0a6e243156ed2a07bd9ec8086f153454234114 |
|
MD5 | 646f3b86278436a0c2768ccbf5ba8c48 |
|
BLAKE2b-256 | c8a5c3491a9910f80fddb575038dca540e4a749b52846c87b62bac30bc18044f |
Hashes for sportgems-0.3.0-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7258943166f2bf749cb427e000654332592738903f7518675c621781f38f56c6 |
|
MD5 | 9d2f4b7659a4bdfae4eb5e85176f698b |
|
BLAKE2b-256 | 18b1cdd1a85190a5d1cf84b9045b794b0c7a117aaf586ae3cf6a87dd178ad603 |
Hashes for sportgems-0.3.0-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd5bbc4c3996af0402acf5b767097e1803bf2d680ab65f9c356ce28ad70d1c07 |
|
MD5 | 2d68957a54b3c6fc68e20cb5468c80e2 |
|
BLAKE2b-256 | 5ce52cf8a5d187121a3c109a03d407bca64e19bea072059317af2fb2b5732249 |
Hashes for sportgems-0.3.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e7c1ba082c02c16e5a3d869d949634a6b7f9d936660f55ccc6e2f6bccc39a0a |
|
MD5 | 6ca2cdfd250d4eba9e43a76ee8253ddf |
|
BLAKE2b-256 | a7f221c7e3d967c19826014b572e594212d36f91987307143b3f2b3bf33769f6 |
Hashes for sportgems-0.3.0-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee3d16122054f151e81e5853ff9a341b411661abb11389d25eec232f31ab7921 |
|
MD5 | 66803b348a6abf304e7f7089e7c7a0bc |
|
BLAKE2b-256 | 96547bf3f5c2ccf6efe0cad77210a2c944c08c8afe3a3be965ee7036939981bd |
Hashes for sportgems-0.3.0-cp38-cp38-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d48b362362ceb06ad2b8968b42eac1508a3b5a27cc03eb2fc15960dbfc224acc |
|
MD5 | 5a4a31ca64f0510aaa44849660412d3c |
|
BLAKE2b-256 | c5cf07543e7a15d5b945bb5d7ba25a8150d0f98026a9a4caecfe5aafe3475aad |
Hashes for sportgems-0.3.0-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1636a4fc2e8f5d36b8efc61773cab4b6fa199303547dd4e11003a996c172e7e5 |
|
MD5 | c2866a4d0fdb5dc648b0cbb5105a726a |
|
BLAKE2b-256 | ebe672c9761ab81fa579075e83c1910f5655ac7cbc3fc255bb3824ffb7c49bb5 |
Hashes for sportgems-0.3.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25a75e8e530a4ddaf1a80d3374033fad23018f036c8302c118e5d7b28b8465ed |
|
MD5 | 021a0f574c741221c881dfc24d84061e |
|
BLAKE2b-256 | 6f1699e70de2a12c7b5b49fd8fdd962f2de13a0d39301168202804266141dbe4 |
Hashes for sportgems-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31d0d339f12617b579f8f6a8cb377ae31bb9b073ebd2d1a767d5a182096bcf69 |
|
MD5 | 860eff08cb27f508d152845eb8d694d1 |
|
BLAKE2b-256 | 2cc7e7b726f97c54d93471c9195ca5511153a4062eac6d4bdf68f6f60f3a58ba |
Hashes for sportgems-0.3.0-cp36-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b18ecc90bbcbc9b0adbc92d5cb01f09ea3e01732d94326a848ee137fc17f35ff |
|
MD5 | 750f691b15dc40ca459a9e45c42b7793 |
|
BLAKE2b-256 | b5832eee57ada575170396f0b215802af3da3e9ff665e0170f6af95a9163abbd |
Hashes for sportgems-0.3.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2179e671671020d874fc5ce59258580ef8478bd0611c8c38345cb6b11643136a |
|
MD5 | 2c93ccd0c5d8b06e214ae28c5441dd72 |
|
BLAKE2b-256 | 751cb572f9e85e9c740a9ec3205171928acd04241f8b3f99d438d8798a5e1c61 |
Hashes for sportgems-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f23a714245dfe6d4c5c09269b056a625328b166bfda5b82ad569d0bb962ba1 |
|
MD5 | 0c72a77d15e45ff9278c9c4a4029af94 |
|
BLAKE2b-256 | 94a119dd548b9eb4ef5a5d2d978988ef0ced1215c6208285d543a9326ff3cf78 |