radiens_qc.spikes
Read .spikes filesets the caller produced, after checking each fits its use.
The package never sorts. Which sort to run, and whether an earlier one will do,
is the caller's decision, so every spike-backed source takes a spikes_id.
The two uses need different filesets, and neither can stand in for the other.
Crossings need a detect-only fileset with every site detected independently,
at the report's threshold, after :func:~radiens_qc.preprocess.apply_detection_settings::
applied = apply_detection_settings(vc, dataset, detection)
crossings_id = vc.spike_sort(
SpikeSorterLaunchParams(
dsource_id=dataset.id,
sub_cmd=SpikeSorterSubCommand.DETECT_ONLY,
max_num_site_neighbors=PER_CHANNEL_NEIGHBORS,
)
)
A clustered sort discards a crossing wherever a neighbor's was larger, which understates the per-site rate the channel and events levels measure. Units need a clustered sort: a detect-only fileset holds no neuron labels, so it yields zero units, indistinguishable from a recording where nothing was sortable. Both mistakes produce plausible figures, so each is refused here instead.
Functions:
check_crossings_fileset
Refuse a fileset whose crossings are not the per-site events the report counted.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the fileset detected sites together, at another threshold
on any site, or without some of |
check_units_fileset
Refuse a fileset that no sort labeled, or that lacks a requested channel.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the fileset's provenance has no sort, or it lacks some of |
fetch_crossings
Crossings on ntv_idxs inside windows, read from spikes_id.
Windows are read separately and accumulated per channel, so a caller wanting
a few excerpts pays for those rather than for the whole span between them.
The caller checks the fileset with :func:check_crossings_fileset, since it
knows the threshold.
Returns:
| Type | Description |
|---|---|
dict[int, NDArray[float64]]
|
|
dict[int, NDArray[float64]]
|
A channel that fired in no window is absent rather than empty. |