convnwb.sorting.io.load_spike_data_file¶
- convnwb.sorting.io.load_spike_data_file(channel, folder, polarity)[source]¶
Load a spike detection output file from Combinato - files with the form data_chan_XX.h5.
- Parameters:
- channelint or str
The channel number / label of the file to load.
- folderstr or Path
The location of the path to load from.
- polarity{‘neg’, ‘pos’}
Which polarity of detected spikes to load.
- Returns:
- outputsdict
Extracted outputs from the data file, including:
channel: stores the channel number / label.
polarity: stores the polarity spikes were sorted.
times: time values for each spike.
waveforms: individual waveforms for all spikes, shape: [n_spikes, 64].
artifacts: indicates if spike events are rejected artifact events (non-zero values).
Notes
This file is an output of the combinato spike detection process. This file includes all detected spike events for a particular channel of data (pre-clustering) from the combinato threshold detection process.
The file has the fields ‘neg’, ‘pos’, ‘thr’, in which:
neg / pos: reflect negative or positive polarity, each with subfields:
spikes: 2d array of extracted waveforms, as [n_spikes, 64 timepoints]
times: 1d array spike times (time values for the extracted waveforms)
artifacts: 1d array indicating artifact events that were discarded before clustering
thr: information about the detection thresholds
In the ‘artifacts’ field, each 0 reflects a non-artifact (these spikes go into clustering). Each non-zero value reflects an artifact, with each number reflecting the artifact category. For descriptions of what each artifact label means, see here: https://github.com/jniediek/combinato/blob/main/combinato/artifacts/mask_artifacts.py#L26
For any event listed as an artifact, these events do not enter the clustering process. Because of this, the total number of events in this file is greater than the number of events that included in subsequent clustering files. The number of clustered spikes (with corresponding information in sort_cat files) is # spike_times - # artifacts.