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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for puddy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 86dcd0592e3abe49ca958c8a70f2569abf203335fdcc0c7c4ffcadd4384bd022
MD5 1450cfb8454c4d9c5915fc5c8cf1b263
BLAKE2b-256 e5a260df777c0867953a67e0a129c911b4cbc01b81877a31723c465a8f0ff0ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: puddy-0.1.0-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.0

File hashes

Hashes for puddy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2561ca92aada673e9c157ef9b648eeb4c7ba0b5dbf865bafaedf45b8adf7e68a
MD5 1efa7a60734485482d68b3d4372417d4
BLAKE2b-256 f6bc3012b4e162b090744bc8b325978bc5b72ec9c286d1edc42c2d6f1dbe1dfb

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