Skip to content

radiens_core.models.spikes

Spike sorting and neural recording domain models.

CLASS DESCRIPTION
ChannelSpikeData

Spike timestamps and neuron labels for a single recording channel.

NeuronInfo

Descriptive statistics for one sorted neuron, as recorded on one site.

NeuronSpikeData

Spike timestamps for a single sorted neuron.

NeuronsResult

Neuron descriptors organized by recording channel.

SpikesSiteSpec

Spike-detection settings for a single recording site.

SpikesSpec

Metadata of a spikes fileset.

Unit

One sorted cell, merged from the per-site listings in NeuronsResult.

Classes

ChannelSpikeData

Bases: BaseModel

Spike timestamps and neuron labels for a single recording channel.

ATTRIBUTE DESCRIPTION
ntv_chan_idx

Native channel index.

TYPE: int

timestamps

Spike timestamps in seconds, shape (N,).

TYPE: NDArray[float64]

labels

Integer neuron label per spike, shape (N,), matching the label get_neurons() reports. 0 marks a spike the sorter did not assign to a neuron. None when waveforms were not requested; labels and waveforms are always present or absent together.

TYPE: NDArray[int32] | None

waveforms

Spike waveforms in µV, shape (N, n_sites, waveform_n_points), or None if waveforms were not requested. Each spike is kept on the site that detected it, the one with the largest peak among its neighbors. Site 0 is this channel and the rest are its detection neighborhood at the same moment.

TYPE: NDArray[float32] | None

site_ntv_chan_idx

The channel each entry of the waveform site axis was recorded on, length n_sites, with element 0 equal to ntv_chan_idx. Neighbors are ordered by distance from the detecting site rather than by position on the probe, so this cannot be inferred from geometry. None when waveforms were not requested or the server did not report the neighborhood.

TYPE: list[int] | None

NeuronInfo

Bases: BaseModel

Descriptive statistics for one sorted neuron, as recorded on one site.

ATTRIBUTE DESCRIPTION
neuron_id

Unique neuron identifier string.

TYPE: str

site_ntv_chan_idx

Native channel index of the site this listing is for.

TYPE: int

spike_label

Neuron label as a string (e.g. "1", "2").

TYPE: str

spike_count

Spikes of this neuron on this site.

TYPE: int

spike_rate

Mean spike rate in Hz.

TYPE: float

mean_abs_peak_wfm

Mean absolute peak waveform amplitude.

TYPE: float

snr

Signal-to-noise ratio.

TYPE: float

pos_probe

Probe coordinate [x, y, z] in microns.

TYPE: list[float]

pos_tissue

Tissue coordinate [x, y, z] in microns.

TYPE: list[float]

NeuronSpikeData

Bases: BaseModel

Spike timestamps for a single sorted neuron.

ATTRIBUTE DESCRIPTION
label

Integer neuron label. Correlates with NeuronInfo.spike_label (string) from get_neurons().

TYPE: int

ntv_chan_idx

Native channel index of the primary recording site for this neuron. -1 if the channel could not be determined from the spike spec.

TYPE: int

timestamps

Spike timestamps in seconds, shape (N,).

TYPE: NDArray[float64]

waveforms

The neuron's spike waveforms in µV, shape (N, n_sites, waveform_n_points), row i being timestamps[i], or None if waveforms were not requested. Every row is on the same sites, site_ntv_chan_idx. A spike is kept only on the neighborhood of the site that detected it, so each row is NaN on the sites the spike was not recorded on; no recorded site is dropped.

TYPE: NDArray[float32] | None

site_ntv_chan_idx

The channel each entry of the waveform site axis was recorded on, length n_sites: every site any of these spikes was recorded on. The neighborhood of the channel that detected most of them comes first, starting with that channel; the other sites follow by how many spikes recorded them. None when waveforms were not requested.

TYPE: list[int] | None

detect_ntv_chan_idx

The channel that detected each spike, shape (N,). None when waveforms were not requested.

TYPE: NDArray[int32] | None

NeuronsResult

Bases: BaseModel

Neuron descriptors organized by recording channel.

ATTRIBUTE DESCRIPTION
neurons_by_channel

Map from native channel index to a list of neuron descriptors detected on that channel.

TYPE: dict[int, list[NeuronInfo]]

SpikesSiteSpec

Bases: BaseModel

Spike-detection settings for a single recording site.

A threshold is None when spike detection is not active on that polarity.

ATTRIBUTE DESCRIPTION
ntv_chan_idx

Native channel index of the site.

TYPE: int

pos_threshold_uv

Positive detection threshold in microvolts.

TYPE: float | None

pos_threshold_sd

Positive detection threshold in noise standard deviations.

TYPE: float | None

neg_threshold_uv

Negative detection threshold in microvolts.

TYPE: float | None

neg_threshold_sd

Negative detection threshold in noise standard deviations.

TYPE: float | None

neighbor_ntv_chan_idx

Native channel indices of this site's detection neighborhood, ordered by distance from it. This is the order the site axis of a spike waveform follows after its own row, so it is how a waveform row is attributed to a channel.

TYPE: list[int]

neighbor_distance_um

Distance to each neighbor in microns, parallel to neighbor_ntv_chan_idx.

TYPE: list[float]

neighbor_radius_um

Radius the neighborhood was selected within, in microns.

TYPE: float

SpikesSpec

Bases: BaseModel

Metadata of a spikes fileset.

Reports the detection settings the spike fileset was produced with, so a caller holding an on-disk .spikes fileset can tell how it was generated.

ATTRIBUTE DESCRIPTION
biointerface_id

ID of the spikes fileset.

TYPE: str

dataset_uid

UID of the dataset the fileset was sorted from.

TYPE: str

num_neurons

Number of distinct neuron labels across all sites, not counting unclustered spikes.

TYPE: int

num_sites

Number of amplifier channels in the dataset.

TYPE: int

enabled_channel_indices

Native channel indices of enabled recording sites, sorted in ascending order.

TYPE: list[int]

time_range

Full time range of the recording in seconds (start, end).

TYPE: tuple[float, float]

spike_time_range

Time range over which spike data is available in seconds (start, end).

TYPE: tuple[float, float]

req_num_neighbors

Largest number of neighbors any site's detection neighborhood holds.

TYPE: int

neighborhood_radius_um

Detection neighborhood radius in microns.

TYPE: float

sites

Per-site detection thresholds, in the dataset's channel order.

TYPE: list[SpikesSiteSpec]

Unit

Bases: BaseModel

One sorted cell, merged from the per-site listings in NeuronsResult.

get_neurons() lists a cell under every site that recorded it, each listing with that site's share of the spikes. spike_count and spike_rate are summed over the listings; site_ntv_chan_idx, snr and probe_y come from the listing with the most spikes. Unclustered spikes (label 0) and clusters marked bad or delete are not units.

ATTRIBUTE DESCRIPTION
label

The sorter's integer label, which spike trains and rasters are keyed by. Unique within a probe; on a multi-probe recording two units can share it.

TYPE: int

neuron_id

Unique across the fileset and stable across the per-site listings.

TYPE: str

site_ntv_chan_idx

Native index of the site that saw the most spikes.

TYPE: int

spike_count

Spikes summed over the cell's listings.

TYPE: int

spike_rate

Mean rate in Hz summed over the cell's listings.

TYPE: float

snr

SNR at site_ntv_chan_idx.

TYPE: float

probe_y

Depth coordinate of site_ntv_chan_idx in microns; nan if the sorter reported no position.

TYPE: float