-
Notifications
You must be signed in to change notification settings - Fork 246
Description
Hi,
I am working with extracellular recordings acquired using Intan and flexible electrodes. My current data processing pipeline is:
- Load raw
.rhddata recorded with Intan - Preprocess the data using SpikeInterface
- Save to binary format
- Run spike sorting with Kilosort4
- Use SpikeInterface quality metrics for initial labeling
- Manually curate and correct units in Phy
- Extract template waveforms using SpikeInterface
I have a few questions regarding unit conversion and waveform extraction in this workflow:
1. ADC units vs µV scaling
After loading the raw Intan data, is it sufficient to apply unsigned_to_signed() Handle unsigned data types to convert the data to signed integers? Do I need to apply both unsigned_to_signed() and scale_to_uV() Work with physical units in SpikeInterface recordings , or is using unsigned_to_signed() alone sufficient before preprocessing and spike sorting?
If I don’t convert the data to microvolts (µV) during preprocessing and keep everything in raw ADC units, will this affect:
- Kilosort4 spike sorting results?
- SpikeInterface quality metrics?
- Template computation?
- Any downstream analyses?
My understanding is that most spike sorters (including Kilosort) operate on raw ADC units, but I would appreciate clarification on best practices in this case.
2. Extracting unit waveforms
I would like to extract the waveform for a given unit after running sorting and creating an analyzer. Is the following approach correct for obtaining the average waveform on a specific channel?
recording_saved = si.load_extractor(EPHYS_OVERALL_ROOTPATH / "preprocess")
sorting = si.read_kilosort(EPHYS_OVERALL_ROOTPATH / 'kilosort4')
analyzer = si.create_sorting_analyzer(sorting, recording_saved, sparse=True, format="memory")
job_kwargs = dict(n_jobs=8, chunk_duration="1s", progress_bar=True)
analyzer.compute("random_spikes", method="uniform", max_spikes_per_unit=600, seed=2205)
analyzer.compute("waveforms", ms_before=1.3, ms_after=2.6)
analyzer.compute("templates", operators=["average", "median", "std"])
unit_id = 9
max_chan = 69
templates_ext = analyzer.get_extension("templates")
avg = templates_ext.get_unit_template(unit_id, operator="average")[:, max_chan]
std = templates_ext.get_unit_template(unit_id, operator="std")[:, max_chan]Specifically:
- Is this the correct way to extract the average and standard deviation of the waveform?
- Are these templates returned in ADC units or µV (depending on preprocessing)?
3. Exporting LFP data for MATLAB analysis
I used SpikeInterface to bandpass filter the data and obtain LFP signals. I would like to perform further analyses in MATLAB. What is the recommended way to export the LFP data from SpikeInterface for use in MATLAB?
Thank you very much for your help!