Skip to main content

HED validation, summary, and analysis tools for annotating events and experimental metadata.

Project description

PyPI - Status Python3 Maintainability Code Coverage Docs

HED visualization

hedvis provides word cloud generation and visual summaries for HED-annotated data, making it easy to explore and present the semantic content of your experimental datasets.

Features

  • Word Cloud Generation - Create beautiful word clouds from HED tag frequencies
  • Flexible Configuration - Extensive customization options for visualizations
  • Shaped Clouds - Support for mask images to create custom-shaped word clouds
  • Multiple Formats - Export to PNG and SVG formats
  • hedtools Integration - Seamless integration with the HED Python tools ecosystem
  • Two APIs - A modern configuration-based API (VisualizationConfig) and a simple legacy API for quick tasks

Installation

From PyPI (recommended)

Install the latest stable release:

pip install hedvis

This automatically installs hedtools and all required dependencies.

Development installation

For development work, clone the repository and install in editable mode:

git clone https://github.com/hed-standard/hed-vis.git
cd hed-vis
pip install -e .

Installing optional dependencies

The project uses pyproject.toml as the single source of truth for all dependencies. Install optional dependencies using pip extras.

Important: Installing with extras automatically includes all base dependencies (hedtools, numpy, pandas, etc.) plus the extra tools.

Development tools (code formatting, linting, testing):

# From PyPI (if you installed hedvis from PyPI)
pip install "hedvis[dev]"

# From local source (if you cloned the repository)
pip install ".[dev]"          # Regular install
pip install -e ".[dev]"       # Editable install (recommended for development)

Documentation tools (Sphinx, themes):

# From PyPI
pip install "hedvis[docs]"

# From local source
pip install ".[docs]"

Both dev and docs dependencies:

# From PyPI
pip install "hedvis[dev,docs]"

# From local source
pip install ".[dev,docs]"

Installing from source without extras

To install from source with only the core dependencies:

git clone https://github.com/hed-standard/hed-vis.git
cd hed-vis
pip install .

If you need to install dependencies for development or documentation:

  • Use pip install ".[dev]" instead of pip install -r requirements-dev.txt
  • Use pip install ".[docs]" instead of pip install -r docs/requirements.txt
  • Core dependencies are installed automatically with pip install . or pip install hedvis

Quick start

Simple word cloud

from hedvis import create_wordcloud

# Create word cloud from frequency dictionary
word_freq = {
    "Event": 15,
    "Action": 10,
    "Sensory-event": 8,
    "Visual-presentation": 7
}

wc = create_wordcloud(word_freq, width=800, height=600)
wc.to_file("wordcloud.png")

Using the hedvis API

from hedvis import HedTagVisualizer, WordCloudConfig, VisualizationConfig

# Configure visualization
wc_config = WordCloudConfig(
    width=1200,
    height=800,
    background_color="white",
    colormap="viridis"
)

viz_config = VisualizationConfig(
    word_cloud=wc_config,
    output_formats=["png", "svg"]
)

# Create visualizer
visualizer = HedTagVisualizer(viz_config)

# Generate from HED tag counts (from hedtools)
results = visualizer.visualize_from_counts(tag_counts)

Integration with hedtools

from hed import load_schema
from hed.models import TabularInput
from hedvis import HedTagVisualizer

# Load HED schema and data
schema = load_schema()
tabular = TabularInput("events.tsv", sidecar="events.json")

# Create visualizer
visualizer = HedTagVisualizer()

# Generate visualizations
results = visualizer.visualize_from_tabular(
    tabular,
    schema,
    output_basename="experiment_tags"
)

# Save word cloud
results['word_cloud']['wordcloud_object'].to_file("tags.png")

All dependencies are managed in pyproject.toml and installed automatically with pip install hedvis.

For the complete list of dependencies with exact versions, see the dependencies section in pyproject.toml.

Development setup

Prerequisites

  • Python 3.10 or higher
  • Git
  • pip (Python package manager)

Setting up your development environment

  1. Fork and clone the repository:

    git clone https://github.com/YOUR_USERNAME/hed-vis.git
    cd hed-vis
    
  2. Create a virtual environment (recommended):

    python -m venv .venv
    .venv\Scripts\activate  # On Windows PowerShell
    source .venv/bin/activate  # On Unix/MacOS
    
  3. Install in development mode:

    All dependencies are managed in pyproject.toml. Install the package with development tools:

    pip install -e ".[dev]"
    

    This installs:

    • The hedvis package in editable mode
    • All required dependencies (hedtools, wordcloud, matplotlib, etc.)
    • Development tools (black, ruff, codespell, mdformat)
    • Testing tools (coverage)

    To install additional optional dependencies:

    # Documentation tools
    pip install -e ".[docs]"
    
    # Both dev and docs
    pip install -e ".[dev,docs]"
    

    Note: Do not use legacy requirements files (requirements.txt, requirements-dev.txt). All dependencies are defined in pyproject.toml.

  4. Run tests to verify setup:

    python -m unittest discover tests
    

Related projects

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Support

License

This project is licensed under the MIT License - see LICENSE for details.

Citation

If you use hedvis in your research, please cite:

If you use HEDTools in your research, please cite:

@software{hedtools,
  author = {Ian Callanan, Robbins, Kay and others},
  title = {HEDVis: Visualization tools for HED},
  year = {2024},
  publisher = {GitHub},
  url = {https://github.com/hed-standard/hed-vis},
}

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

hedvis-0.1.1.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

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

hedvis-0.1.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hedvis-0.1.1.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for hedvis-0.1.1.tar.gz
Algorithm Hash digest
SHA256 069d39d77fa217a8afd7ebd576b6f4b8d00a25b7e6d00f379906f5dac0c30940
MD5 3b479fa9611c8d8bf7c9b784a751651d
BLAKE2b-256 14098f9c97c8f0a918000ac2ee08cc9f6671b0339bdf8587257e70afa04d3c81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hedvis-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for hedvis-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92484977f11ec7e78fe931bda9e23528fc84aeca5e1f66c4d1b93694dbf5db6e
MD5 4cef9c21e0df9797938f8935644dd188
BLAKE2b-256 9a29e5b81da4afd386c83734e7377ce643e51854558e91a1a208f3cde5043d9d

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