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

Uploaded Python 3

File details

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

File metadata

  • Download URL: puddy-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 fd5ff596055f0b063b8fa46ef1c07f47279fe302db2661421a1701d0048fa88c
MD5 a706a896e2e40b41008461ac66c602e2
BLAKE2b-256 1cc1dd74c226ed55dd372ce21c4a439829eb8692f8ce33b4ba0bd3ceb45c7632

See more details on using hashes here.

File details

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

File metadata

  • Download URL: puddy-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f4a54db72f0927830ef3cf87b1b06373e33f8e333ff0cd490e9ea8b87edd5207
MD5 89ca2e0e807287e00e6a25780d6cb76d
BLAKE2b-256 c7e5a6255ce451f8f905a07dc396c05564e5973d91b21c7b723ee33a4924fe44

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