Skip to content

radiens_qc.plot_units

Render the cells a clustered sort found: footprints, yield, rasters, inventory.

Takes a :class:~radiens_qc.units.SortedUnits, for the reason :mod:radiens_qc.plot_events takes an EventTrains: these describe the recording rather than the measurement, and cannot be drawn from a saved report directory.

Sort quality is deliberately absent. A refractory-violation rate or an amplitude cutoff describes the sorter and the parameters it ran at, not the recording -- re-sort the same data differently and every one of those numbers moves while the recording is unchanged. This package also launches the sort itself, at a radius it chose, so grading that sort would be grading its own parameter. Unit SNR is not an exception: it measures how far a cell stands out of the noise floor, which is a property of the electrode and the recording.

The rasters reuse :mod:radiens_qc.plot_events rather than restating it, and the footprint and yield figures reuse the channel level's site lattice, so a unit figure and the site figure it echoes read alike and cannot drift apart.

Classes

Functions:

plot_unit_footprints

plot_unit_footprints(units)

Every unit's footprint on the site lattice: where the cell is, and how it fades.

A panel per unit, in depth order, each one the probe's own site lattice cropped around the site that detected the unit. Cell color carries the unit's amplitude at that site and the waveform drawn inside carries its shape, so a panel answers where the cell sits, what it looks like, and how far across the array it was still visible.

The lattice is what makes that readable on any probe. Space is spent per site rather than per micron, so a stagger, a shank gutter and a planar grid all give a waveform the same box to be drawn in, and the fade is read across true adjacency rather than down one column.

Each panel is scaled to its own unit and states its µV per cell, so a weak cell is legible as a shape instead of being drawn as the flat line one shared scale would make of it. Each also carries a locator: the whole probe as one strip, with the crop and the detecting site marked on it, which is what says where on the array the panel is looking.

Every unit gets a panel. The waveforms are the ones attached to units by :meth:~radiens_qc.units.SortedUnits.with_waveforms; a unit with none among them is drawn as an empty panel rather than skipped, so the grid stays a census of the sort.

plot_unit_inventory

plot_unit_inventory(units)

How many cells the sort found, and how their rate, amplitude and SNR are spread.

Descriptive rather than a grade: it says what is here, and leaves whether that is enough to the person who knows what they were recording.

Amplitude is measured from the waveforms attached to units; with none attached that one panel says "not reported" rather than drawing a single bar at zero.

plot_unit_raster

plot_unit_raster(
    units, *, span_sec=None, columns=None, smooth_sec=None
)

Unit rasters over per-unit rate traces, on one shared time axis.

The same figure the events level draws, with a unit per row instead of a site. Rows are ordered by unit depth, so a burst confined to one stretch of the probe still reads as a contiguous band.

smooth_sec pins the rate kernel exactly as it does for :func:~radiens_qc.plot_events.plot_event_raster, so the two stay comparable.

plot_unit_yield

plot_unit_yield(units)

Where on the array cells were found, how clean they are, and how fast they fire.

The only units figure that is array-wide. The others are per-unit -- a footprint panel, a raster row, a histogram bar -- so which stretches of the probe produced cells and which produced none has nowhere else to be read.

Yield is a property of the recording rather than of the sort: a dead stretch of electrode yields no cells however the sorter was parameterized. That is what keeps this figure on the right side of the line this module's docstring draws around sort quality.

Drawn on the channel level's site lattice, and on the same four panels :func:~radiens_qc.plot_quality.plot_site_maps draws, so a site's yield here and its SNR on the channel maps are read off the same cell in the same place. Sites carrying several cells read as a count above one, which is what the sorter's lack of a position of its own otherwise hides.

Amplitude is measured from the waveforms attached to units; with none attached that one panel says "not reported" rather than mapping zeros, and the other three are unaffected.