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+.
Option 1: Install from PyPI
pip install hep-viz
Option 2: Install from Conda
conda install finnbarwilson::hep-viz
Option 3: Install from Source
git clone https://github.com/FinnbarWilson/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
particles: Truth-level particle information.- Columns:
event_id,particle_id,pdg_id,px,py,vx,vy
- Columns:
tracks: Reconstructed track information (optional, or derived from hits).- Columns:
event_id,particle_id,pT,pdg_id
- Columns:
tracker_hits: Individual hits in the tracker layers.- Columns:
event_id,particle_id,x,y,z,volume_id
- Columns:
calo_hits: Energy deposits in the calorimeter.- Columns:
event_id,cell_id,x,y,z,total_energy,contrib_particle_ids(list),contrib_energies(list)
- Columns:
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:
-
Clone the repository:
git clone https://github.com/yourusername/hep-viz.git cd hep-viz
-
Install in editable mode:
pip install -e .
-
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hep_viz-0.1.2.tar.gz.
File metadata
- Download URL: hep_viz-0.1.2.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1883db59894cdacaa0bb267e8cb34cb4eaf0f6ec0c031cbbc1d0538055523bdf
|
|
| MD5 |
9d2232b05e4feab9b10d9d7395be55ed
|
|
| BLAKE2b-256 |
df9ed15958c8abcc5b3e8b94fef49b48ce251a5ddc5e03b036f5895b4bcd674e
|
File details
Details for the file hep_viz-0.1.2-py3-none-any.whl.
File metadata
- Download URL: hep_viz-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4822b4d2a960dfd73362886f391ac4e38dd85c4c7f35862c19b24ef337756ee3
|
|
| MD5 |
e066ec9b28d900af2363d9d1e763a4c5
|
|
| BLAKE2b-256 |
79206b03c70ac8fba9b6e6ad73173700f40d9e53194ea3e6b99dd4124b3e75a5
|