Skip to main content

A local visualizer for HEP data

Project description

hep-viz

A local visualizer for High Energy Physics (HEP) data.

hep-viz is a lightweight, high-performance tool designed to visualize high-dimensional particle tracking and calorimeter data directly from your local machine or Python environment. It bridges the gap between massive local datasets and fluid web-based visualization.

Features

  • 🚀 Local & Fast: Runs a local web server to stream data on demand—no cloud upload required.
  • 🐍 Python API: Seamlessly integrates with Jupyter Notebooks and Python scripts.
  • 💻 CLI Support: Quickly visualize datasets from your terminal.
  • ✨ 3D Visualization: Interactive 3D view of particles, tracks, and calorimeter hits.
  • 📂 Parquet Support: Optimized for reading large datasets stored in Parquet format.

Installation

Requires Python 3.8+.

git clone https://github.com/yourusername/hep-viz.git
cd hep-viz
pip install .

Usage

1. Command Line Interface (CLI)

Visualize a directory containing your Parquet data files:

hep-viz view /path/to/data/directory

Options:

  • --port <int>: Specify the port to run the server on (default: 8000).
  • --no-browser: Prevent the browser from opening automatically.

2. Python API

Use hep-viz directly within your Python scripts or Jupyter Notebooks. This is perfect for visualizing in-memory data (e.g., from Hugging Face Datasets).

Example with Hugging Face Datasets:

import hep_viz
from datasets import load_dataset

# Load a compatible dataset (e.g., OpenDataDetector)
dataset = load_dataset("OpenDataDetector/ColliderML_higgs_pu0")

# Launches the server and opens the visualization
hep_viz.view(dataset)

Example with Custom Dictionary:

import hep_viz

# Data should be a dictionary of lists
data = {
    "particles": [...],
    "tracks": [...],
    "tracker_hits": [...],
    "calo_hits": [...]
}

hep_viz.view(data)

Data Format

hep-viz expects data to be organized into four main categories. If using the CLI, these should be Parquet files in your target directory. If using the Python API, these should be keys in your dictionary.

Required Categories

  1. particles: Truth-level particle information.
    • Columns: event_id, particle_id, pdg_id, px, py, vx, vy
  2. tracks: Reconstructed track information (optional, or derived from hits).
    • Columns: event_id, particle_id, pT, pdg_id
  3. tracker_hits: Individual hits in the tracker layers.
    • Columns: event_id, particle_id, x, y, z, volume_id
  4. calo_hits: Energy deposits in the calorimeter.
    • Columns: event_id, cell_id, x, y, z, total_energy, contrib_particle_ids (list), contrib_energies (list)

File Naming (CLI)

For the CLI to automatically detect files, they should contain the category name (e.g., my_particles.parquet). You can split data across multiple files using the pattern events<start>-<end> (e.g., particles.events0-999.parquet).

Development

To contribute or modify hep-viz:

  1. Clone the repository:

    git clone https://github.com/yourusername/hep-viz.git
    cd hep-viz
    
  2. Install in editable mode:

    pip install -e .
    
  3. Run Tests:

    # Install test dependencies
    pip install pytest httpx
    
    # Run the test suite
    pytest
    

License

This project is licensed under the MIT License.

Copyright (c) 2025 Finnbar Wilson

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

hep_viz-0.1.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

hep_viz-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hep_viz-0.1.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for hep_viz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 82e9af6b292f0004cc0a44c53f3750da2f0f1f6979b59aee917d5d15e4bf6fa6
MD5 4af99812c68ebbae618976ee38e435d3
BLAKE2b-256 c6f8dcaf7e998592c01627775b394f409fd3f9eeffb2f5488fd89a1c30159cb1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hep_viz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for hep_viz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1bb0bb348ba6a147612123abccadecb33e1b2b4c47ce98120cda05f1574c15f
MD5 9f68740a70a0430ea42990480ec76aa2
BLAKE2b-256 47281bb8e55bdb6fbc2567d1fb36f6f3e03818c310fd59760f5ee2197bd4297d

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