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.3.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.3-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: puddy-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 d0eca44c3de96d529c87fa4571bc88182815635c48df1136a14be6e21e176444
MD5 6bbbafc34b1f80a1f062f9f89ce9956e
BLAKE2b-256 a7c37d203750fb5df71cad1d19f2fa3aada27baff93389f5299f0159bfdd5700

See more details on using hashes here.

File details

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

File metadata

  • Download URL: puddy-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f57ac78b023c44b1f5e97b06f954ab052d05599a778f843b5c332a114ccb842d
MD5 97bdd2788923bed419c13ecdfa307475
BLAKE2b-256 34ee0443ca59eac8f15a4e88e60180d888c6f2f3a73cd53b529a93f1cfad31a9

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