Skip to content

Recommended_preprocessing

Julie Fabre edited this page Aug 2, 2023 · 7 revisions

Aligning recorded channels to each other

A to DC conversation on the probe base is done in batches of channels - ie some channel batches will end being acquired slightly before/after others. Because of this, it is best to first align all channels before performing common average referencing. This command line tool will temporally align the channels, and can optionally also common average reference (described in the next section).

The spike sorting algorithm PyKilosort already implements this aligning and common-average referencing (described in the next section).

Removing noise: common average referencing

Neuropixels probes have 384 channels with very closely matched impedances and gains. For this reason, noise sources (both those from the brain and those from interference/referencing) tend to appear identically on all channels. In those cases, common average referencing, in which the median of all channels is subtracted from each channel at each time point, effectively removes most noise and can be done as a default first processing step.

The function "applyCARtoDat" in the "spikes" repository performs both of these operations in matlab. Note that it will produce a whole new file of equal size to the original, and will take a while to run.

nChansTotal = 385; % for spikeglx, Neuropixels phase3a. Needs to be the number of rows in the data file.
applyCARtoDat(filename, nChansTotal, outputDir);

All versions of the spike sorting algorithm kilosort already implement common-average referencing.

Additional pre-processing for 3A probes

Note that Phase3A probes (which version do I have?) produce data that is offset from zero (even in the high-pass filtered AP band), so subtracting the median across time of each channel from itself should be done first.