This repository contains functions to simplify the conversion of Trajectory data among yupi and other useful software libraries designed for analyzing trajectories.
Standing for Yet Underused Path Instruments, yupi is a set of tools designed for collecting, generating and processing trajectory data. The structure of yupi aims to standardize the usage and storage of general purpose trajectories independently of its dimensions. We believe it is useful to be able to convert, when possible, yupi trajectories to the data structures used by other libraries to empower our users with the tools offered by third parties. With the same spirit, we offer the possibility of converting data from other libraries to yupi trajectories.
Installation
Current recommended installation method is via the pypi package:
pip install yupiwrap
It will install required dependencies such as yupi package from pypi. Each conversion library is an optional extra, so install the ones you need:
pip install 'yupiwrap[traja]'
pip install 'yupiwrap[tracktable]'
Compatible libraries
traja
The Traja Python package is a toolkit for the numerical characterization and analysis of the trajectories of moving animals. It provides several machine learning tools that are not yet implemented in yupi. Even when it is limited to two-dimensional trajectories, there are many resources that traja can offer when dealing with 2D Trajectories in yupi.
Converting a yupi.Trajectory into a traja DataFrame
Let's create a trajectory with yupi:
from yupi import Trajectory
x = [0, 1.0, 0.63, -0.37, -1.24, -1.5, -1.08, -0.19, 0.82, 1.63, 1.99, 1.85]
y = [0, 0, 0.98, 1.24, 0.69, -0.3, -1.23, -1.72, -1.63, -1.01, -0.06, 0.94]
track = Trajectory(x=x, y=y, traj_id="Spiral")
We can convert it to a traja DataFrame simply by:
from yupiwrap.traja import yupi2traja
traja_track = yupi2traja(track)
⚠️ Only yupi.Trajectory objects with two dimensions can be converted to traja DataFrame due to traja limitations.
Converting a traja DataFrame into a yupi.Trajectory
If you have a traja DataFrame you can always convert it to a yupi.Trajectory by using:
from yupiwrap.traja import traja2yupi
yupi_track = traja2yupi(traja_track)
tracktable
Tracktable provides a set of tools for handling 2D and 3D trajectories as well as Terrain trajectories. The core data structures and algorithms on this package are implemented in C++ for speed and more efficient memory use.
Converting a yupi.Trajectory into a tracktable trajectory
Let's create a trajectory with yupi:
from yupiwrap.tracktable import yupi2tracktable, tracktable2yupi
from yupi import Trajectory
# Creating a yupi trajectory representing terrain coordinates
points = [[-82.359415, 23.135012], [-82.382116, 23.136252]]
track_1 = Trajectory(points=points, traj_id="ter_track")
# Creating a 2D yupi trajectory
points = [
[0, 0],
[1.0, 0],
[0.63, 0.98],
[-0.37, 1.24],
[-1.24, 0.69],
[-1.5, -0.3],
[-1.08, -1.23],
[-0.19, -1.72],
[0.82, -1.63],
[1.63, -1.01],
[1.99, -0.06],
[1.85, 0.94],
]
track_2 = Trajectory(points=points, traj_id="2d_track")
# Creating a 3D yupi trajectory
points = [[0, 0, 0], [1, 1, 3], [3, 2, 5]]
track_3 = Trajectory(points=points, traj_id="3d_track")
We can convert these tracks to tracktable trajectories simply by:
tracktable_track_1 = yupi2tracktable(track_1, is_terrestrial=True)
tracktable_track_2 = yupi2tracktable(track_2)
tracktable_track_3 = yupi2tracktable(track_3)
⚠️ If a 3D yupi trajectory is converted to a tracktable trajectory with is_terrestrial=True then the z axis values are stored as a property called 'altitude' for each point.
⚠️ Only yupi.Trajectory objects with two or three dimensions can be converted to tracktable trajectories due to tracktable limitations.
Converting a tracktable trajectory into a yupi.Trajectory
If you have a tracktable trajectory you can always convert it to a yupi.Trajectory by using:
# Converting the trajectory from tracktable to yupi
yupi_track_1 = tracktable2yupi(tracktable_track_1)
Development
Setup, QA, docs and releases: DEVELOPMENT.md.
Contributing
Issues and pull requests are welcome; make qa must pass.
License
GPL-3.0-or-later: see LICENSE.
🚀 Project starter provided by Cookie Pyrate v1.1.2
Metadata
Release files for yupiwrap 0.2.0
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 | Actions |
|---|---|---|---|---|
| yupiwrap-0.2.0.tar.gz | 222.2 kB | Without provenance | Details for yupiwrap-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yupiwrap-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for yupiwrap-0.2.0-py3-none-any.whl |
Total release size: 240.8 kB
Release files / yupiwrap-0.2.0.tar.gz
| Download URL | yupiwrap-0.2.0.tar.gz |
|---|---|
| Size | 222.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
786f724110927f88aaa973526901cd1f8788cafd08d6477dfc4241cffc3bf62b
|
|
BLAKE2b-256 checksum How to use checksums |
981257bf7252a5334f2d03b5d6315661cf82de014bfc9fcef95323d593573a0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / yupiwrap-0.2.0-py3-none-any.whl
| Download URL | yupiwrap-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac2000541e539d70dab71a7dd043a14fb1c15a07d983d53b688bd3dd554fd22e
|
|
BLAKE2b-256 checksum How to use checksums |
cd756fa15a8d6e7e1b70aab5b4f68038285fdcf5a26205271bff60de9ddd02be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for yupiwrap 0.2.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.