Skip to main content

radiens-qc

PyPI Python Version

radiens-qc turns a Radiens recording into an answerable question: is this data good enough to use?

It computes standardized signal quality metrics, grades electrode health, records where the detector fired, and exports self-contained report packages for instant visualization.

Installation

pip install radiens-qc

or with uv:

uv add radiens-qc

Requires Python 3.12+ and access to a Radiens server to compute reports. Saved reports can be reloaded, analyzed, and plotted completely offline.

Quick start

Compute & save a report

from pathlib import Path

from radiens_core import VidereClient
from radiens_qc import compute_report, save_report

vc = VidereClient()
report = compute_report(vc, Path("/data/rec01.xdat"), source="exp/day3")

print(report.median("snr"))         # 6.2
print(report.integrity_counts())    # {"ok": 30, "noisy": 1, "dead": 1}
print(report.event_counts())        # {"present": 24, "absent": 8}

save_report(report, Path("reports"))  # -> reports/rec01/

Note: compute_report accepts a local Path or an existing DatasetMetadata object.

Generate plots

FIGURES names every figure the package draws. To render them all, say so once -- only what the selected figures need is fetched:

from pathlib import Path
from radiens_qc import FIGURES, fetch_figure_sources, render, save_figures

sources = fetch_figure_sources(
    vc, dataset, FIGURES, report=report, crossings_spikes_id=crossings_id, units_spikes_id=units_id
)
save_figures(render(FIGURES, sources), Path("figures"))   # figures/<level>/<name>.png

The events and units levels read spike sorts you run, so you decide which sort and whether an earlier one will do. Crossings need a detect-only scrape that detects every site independently, run after the report set the threshold; units need a clustered sort:

from radiens_core.models import SpikeSorterLaunchParams, SpikeSorterSubCommand
from radiens_qc import PER_CHANNEL_NEIGHBORS

crossings_id = vc.spike_sort(
    SpikeSorterLaunchParams(
        dsource_id=dataset.id,
        sub_cmd=SpikeSorterSubCommand.DETECT_ONLY,
        max_num_site_neighbors=PER_CHANNEL_NEIGHBORS,
    )
)
units_id = vc.spike_sort(SpikeSorterLaunchParams(dsource_id=dataset.id, neighbor_radius_um=150.0))

Each reader checks the fileset it is given and raises if it cannot support the figure: crossings detected with neighbors or at another threshold, or units from a detect-only scrape. Leave an ID out and that level is skipped.

select narrows that by level or by name, and render returns {spec: Figure} if you would rather place the figures yourself:

from radiens_qc import FigureSources, select

for spec, fig in render(select(levels=["channel"]), FigureSources(report=report)).items():
    print(spec.name, spec.caption)

A report read off disk supports the channel and recording levels; the raw-signal, events and units levels describe the recording rather than the measurement, so they need a live dataset. render skips a figure whose source it was not given, which is what makes a saved report directory a valid thing to draw from.

Each figure is also a plain function returning one matplotlib Figure that it owns entirely, so you choose the size and where it goes:

from radiens_qc import plot_channel_profiles, plot_site_maps, plot_stability

plot_site_maps(report)          # SNR, noise, event rate, amplitude on the probe
plot_channel_profiles(report)   # the same four, one bar row per site
plot_stability(report)          # each metric over time against its own start

Every one takes the object it draws: plot_raw_traces and plot_raw_spectra take what fetch_raw_signal returns, plot_event_raster what fetch_events returns, and plot_unit_footprints, plot_unit_yield, plot_unit_raster and plot_unit_inventory what fetch_units returns.

Unit amplitude is measured from spike waveforms, which are the largest payload here and so are fetched only when you ask for them:

from radiens_qc import fetch_unit_waveforms, fetch_units, plot_unit_yield

units = fetch_units(vc, dataset, units_id)
units = units.with_waveforms(fetch_unit_waveforms(vc, dataset, units))
plot_unit_yield(units)

Given units without them, the figures that report amplitude say so on that panel instead of drawing it; the rest are unaffected. fetch_figure_sources handles this for you, fetching waveforms when a selected figure reports amplitude.

Saved report structure

save_report(report, out_dir) creates <out_dir>/<base_name>/. It writes data only -- figures are drawn from a report, not stored beside one:

File Description
meta.json Provenance, thresholds, channel counts, and whole-recording readings
channels.csv Channel geometry, metric values, integrity tier, and event state
matrices.npz Full per-metric matrices, enough to redraw every figure without a server

License

See LICENSE.

Metadata

Release files for radiens-qc 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for radiens-qc 0.0.3
File Size Uploaded
radiens_qc-0.0.3.tar.gz 130.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for radiens-qc 0.0.3
File Interpreter ABI Platform
radiens_qc-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 232.5 kB

Release files / radiens_qc-0.0.3.tar.gz

Download URL radiens_qc-0.0.3.tar.gz
Size 130.5 kB
Tags Source
SHA-256 checksum
How to use checksums
17c99c2a37fd4752c7ba38d40a9b345eb127aff5be6efe8ddee3cdaa1af71674
BLAKE2b-256 checksum
How to use checksums
880af85ee4b16e14e4097d158d29ae6036e917957a5875bfb2a65e829bd77e27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / radiens_qc-0.0.3-py3-none-any.whl

Download URL radiens_qc-0.0.3-py3-none-any.whl
Size 102.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2f62283263d64a9fd0967301c3ffd243eca5f4848911dc8cf81ea85384c7ba9
BLAKE2b-256 checksum
How to use checksums
c0b99ca8280920a95c62c0e2f114770979e444588f206cb9ff4257c981074dad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page