Skip to main content

WebGPU accelerated visualization of unbounded neural data streams in Python

Project description

phosphor

GPU-accelerated real-time sweep renderer for multichannel timeseries data. Built on WebGPU and Qt, phosphor renders thousands of channels at high sample rates with minimal CPU overhead.

Designed for neuroscience and real-time signal monitoring -- push (n_samples, n_channels) numpy arrays and phosphor handles downsampling, autoscaling, and rendering.

Installation

pip install phosphor

Quick Start

import numpy as np
from PySide6.QtWidgets import QApplication
from phosphor import SweepConfig, SweepWidget

app = QApplication([])

widget = SweepWidget(SweepConfig(
    n_channels=128,
    srate=30000.0,
    display_dur=2.0,
    n_visible=64,
))
widget.show()

# Push data from any source -- shape: (n_samples, n_channels), float32
widget.push_data(np.random.randn(500, 128).astype(np.float32))

app.exec()

Embedding in an Existing Qt Application

SweepWidget is a standard QWidget that can be added to any layout:

from PySide6.QtWidgets import QMainWindow, QVBoxLayout, QWidget
from phosphor import SweepConfig, SweepWidget

class MyWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.sweep = SweepWidget(SweepConfig(n_channels=64, srate=1000.0))
        self.setCentralWidget(self.sweep)

    def on_new_data(self, data):
        self.sweep.push_data(data)

Runtime Configuration

Update parameters without recreating the widget:

from phosphor import SweepConfig

widget.update_config(SweepConfig(
    n_channels=256,
    srate=30000.0,
    display_dur=4.0,
    n_visible=128,
))

Built-in Demo

python -m phosphor
python -m phosphor --channels 256 --srate 30000 --visible 64 --dur 2.0

Keyboard Controls

Key Action
Up / Down Scroll channels by 1
Page Up / Page Down Scroll channels by one page
[ / ] Halve / double visible channel count
- / = Y-axis zoom out / in (disables autoscale)
A Toggle autoscale
, / . Halve / double display duration

Development

We use uv for development.

  1. Fork and clone the repository
  2. uv sync to create a virtual environment and install dependencies
  3. uv run pre-commit install to set up linting and formatting hooks
  4. uv run pytest tests to run the test suite
  5. Submit a PR against the dev branch

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

phosphor-0.1.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

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

phosphor-0.1-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file phosphor-0.1.tar.gz.

File metadata

  • Download URL: phosphor-0.1.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for phosphor-0.1.tar.gz
Algorithm Hash digest
SHA256 3e8767c1306a35536da465aacf88d65e6659c9eb0fbd9ae90d65dc5376c239f0
MD5 c0dceb2a44d07bafe5b75575b5995a42
BLAKE2b-256 57f2383d5b92963002ef08c68479623752179829dd29a57b578e1012ceccdee2

See more details on using hashes here.

File details

Details for the file phosphor-0.1-py3-none-any.whl.

File metadata

  • Download URL: phosphor-0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for phosphor-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f26ccacdb2799508645f2da13ffa04af29be10daa1ce053d7a0e2dc4cc4e132a
MD5 d6df36bb25833cad260ef29ef3727dd1
BLAKE2b-256 36c8e7218c1962d0414b420254134f0ef03e4b76aa82412fc5350f45af3fd604

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