Skip to main content

A toolkit for analyzing spatial trajectories

Project description

Puddy

Puddy is a Python toolkit for analyzing spatial trajectories from files in CSV, JSON, JSONL, or Parquet format. It provides easy loading, normalization, feature extraction, anomaly detection, and rich 3D visualization for geospatial or cartesian trajectory data.


Installation

Install via pip:

pip install puddy

Or for development (to auto-update as you change source):

pip install -e .

PyPI: https://pypi.org/project/puddy/


What does Puddy do?

  • Load trajectories from CSV, JSON, JSONL, Parquet/Arrow, or in-memory DataFrames
  • Normalize and group trajectory data using customizable column configs
  • Extract features automatically (distance, bounding box, linearity, turns, aspect ratio, etc)
  • Detect anomalies using Isolation Forest or Local Outlier Factor
  • Visualize trajectories in interactive 3D plots colored by "normalcy"

Basic Usage

from puddy import TrajectoryCollection, ColumnConfig, TrajectoryAnalyzer, visualize_trajectories_sample

# 1. Configure which columns to use for each axis and group
config = ColumnConfig.create_geo(
    lon_col="lon",
    lat_col="lat",
    alt_col="alt",
    identifier_col="id"
)

# 2. Load your data (CSV, JSONL, Parquet, DataFrame, etc.)
collection = TrajectoryCollection()
collection.load_from_file("trajectories.csv", config=config)

# 3. Visualize a sample
collection.visualize_sample(n=5)

# 4. Analyze features and anomalies
analyzer = TrajectoryAnalyzer(collection)
analyzer.train_anomaly_detector(method="isolation_forest")
scores = analyzer.get_normalcy_scores()
df = analyzer.get_normalcy_df()
print(df.head())

# 5. Visualize by normalcy
visualize_trajectories_sample(
    analyzer.collection.trajectories,
    scores,
    normal_sample=10,
    show_all_anomalies=True
)

Features

  • Robust file loading: works with large datasets, compressed files, and many formats
  • Customizable coordinate systems and grouping
  • Automatic feature engineering for trajectory shape/motion
  • Built-in anomaly detection and scoring
  • Publication-quality 3D plotting

Documentation

For advanced usage, custom features, or troubleshooting, see the Wiki.


License

MIT © Jason Frazier

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

puddy-0.1.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

puddy-0.1.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file puddy-0.1.2.tar.gz.

File metadata

  • Download URL: puddy-0.1.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for puddy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 91d97a373577d92ccc23db1cf50b24fd38b8d0a34d561fea2fd89a9c5a3f99fe
MD5 7b7d2422f26ffcc04d42c0060043ebd3
BLAKE2b-256 b876e53f203cc52ced173c22fd137820cd836a7c3883247b9cd994ec98231958

See more details on using hashes here.

File details

Details for the file puddy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: puddy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for puddy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4c41a9f4c7bd3d5f358d18aacffdd9f0f4276099b74abc18ffc0269bab999e2d
MD5 abf17eac6a16ad25ecb36922f18eb6c8
BLAKE2b-256 2f3c3b1e1dd9e649e393e029c2ed335664eaa325fb40f86401d62c4d784294c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page