Skip to main content

Interactive visualization toolkit for computational neuroscience simulations and data

Project description

CompNeuroVis

CompNeuroVis connects computational neuroscience simulations and data to interactive desktop visualizations. Sources expose model data and controls; views opt into line plots, morphology, surfaces, and other panels; cnv.show() integrates those pieces into one application.

Alpha Status

CompNeuroVis 0.4.0a1 is an alpha release. All versions before 1.0.0 are unstable prereleases. Public APIs may change between releases.

This release supports the inline source workflow used by current examples. Notebook, distributed, and multi-source composition paths remain experimental.

Installation

CompNeuroVis requires Python 3.11.

Install the alpha release:

pip install --pre compneurovis

Install current checkout:

pip install -e .

Install optional simulator integrations:

pip install -e ".[neuron]"
pip install -e ".[jaxley]"

Notebook dependencies are experimental:

pip install -e ".[notebook]"

Minimal App

import math

import compneurovis as cnv


state = {"time_ms": 0.0, "frequency_hz": 1.0}


def step(ctx):
    state["time_ms"] += 16.0


def set_frequency(ctx, value):
    state["frequency_hz"] = float(value)


src = cnv.source(step)

wave = src.line(
    "Sine wave",
    read=lambda: math.sin(
        2.0
        * math.pi
        * state["frequency_hz"]
        * state["time_ms"]
        / 1000.0
    ),
    x=lambda: state["time_ms"],
    y_min=-1.1,
    y_max=1.1,
)

src.slider(
    "frequency_hz",
    label="Frequency (Hz)",
    get=lambda: state["frequency_hz"],
    set=set_frequency,
    min=0.1,
    max=5.0,
)

cnv.layout(((wave,), (src.controls_panel,)))
cnv.show(title="Sine wave")

Run repository version:

python examples/custom/sine_wave.py

NEURON Morphology

NEURON sources keep simulator-specific data collection optimized while using the same line, control, layout, and show API.

from neuron import h

import compneurovis as cnv


soma = h.Section(name="soma")
soma.L = soma.diam = 20.0
soma.insert("hh")

stim = h.IClamp(soma(0.5))
stim.delay = 100.0
stim.dur = 5.0
stim.amp = 0.8


def set_stimulus(ctx, value):
    stim.amp = float(value)


src = cnv.neuron.source(
    sections=[soma],
    dt=0.025,
    display_dt=0.5,
)

morphology = src.morphology(
    variable="v",
    name="Membrane voltage",
    unit="mV",
    color_limits=(-80.0, 50.0),
    selected="soma@0.50000",
)

voltage = src.line(
    "Selected voltage",
    source=morphology.selection,
    variables={"Voltage": "v"},
    y_unit="mV",
    rolling_window=500.0,
)

src.slider(
    "stimulus",
    label="Stimulus amplitude (nA)",
    get=lambda: stim.amp,
    set=set_stimulus,
    min=0.0,
    max=2.0,
)

cnv.layout(((morphology, voltage), (src.controls_panel,)))
cnv.show(title="NEURON morphology")

Full showcase:

python examples/neuron/complete_interface.py

Static surface showcase:

python examples/widgets/surface.py

Supported Alpha Surface

  • cnv.source(...) for Python callables, iterators, and static data.
  • cnv.neuron.source(...) and cnv.jaxley.source(...) for simulator-native sources.
  • Source-level line, bar, morphology, and surface views.
  • Typed controls and actions used by current examples.
  • cnv.layout(...) for single-app panel placement.
  • cnv.show(...) with VisPy and PyQt6 desktop rendering.

Views are opt-in. A simulator source can own morphology without displaying a morphology panel.

Experimental

These paths are incomplete or not release-supported:

  • Notebook frontends and notebook process lifecycle.
  • Remote sources and remote actors.
  • Source composition and independent multi-source execution.
  • Multi-source custom layouts.
  • Advanced callback access through backend internals.

Incomplete distributed entrypoints live under cnv.experimental so they are not mistaken for supported root-level API.

Documentation

Start with Getting Started, then follow the ordered Example Path.

Build the documentation site locally:

python -m mkdocs build --strict

License

Apache License 2.0.

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

compneurovis-0.4.0a1.tar.gz (180.8 kB view details)

Uploaded Source

Built Distribution

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

compneurovis-0.4.0a1-py3-none-any.whl (222.6 kB view details)

Uploaded Python 3

File details

Details for the file compneurovis-0.4.0a1.tar.gz.

File metadata

  • Download URL: compneurovis-0.4.0a1.tar.gz
  • Upload date:
  • Size: 180.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compneurovis-0.4.0a1.tar.gz
Algorithm Hash digest
SHA256 c65641cd318cce224428d129e3b311e191355ac89e0a6e59608bad96888aa613
MD5 31472cae602f4d4a25bfa66628c49853
BLAKE2b-256 4ff8789958be296b28a2bd070a0744f0f996d73e55580c40da939857d3578383

See more details on using hashes here.

Provenance

The following attestation bundles were made for compneurovis-0.4.0a1.tar.gz:

Publisher: release.yml on orrenravid1/CompNeuroVis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compneurovis-0.4.0a1-py3-none-any.whl.

File metadata

  • Download URL: compneurovis-0.4.0a1-py3-none-any.whl
  • Upload date:
  • Size: 222.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compneurovis-0.4.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b9960587834024454e38ca4813a18e78d2a87631fc42c2bb646480163995937
MD5 b6290febf2dcded7b0f35476c5e18c51
BLAKE2b-256 1d97f50508a5c9495bdd8587969a1ba874ea377e7a79df6f70018946163b58b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for compneurovis-0.4.0a1-py3-none-any.whl:

Publisher: release.yml on orrenravid1/CompNeuroVis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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