Code to take high density extracellular ephys data, specifically from Neuropixels Ultra probes, and downsample to simulate that same data acquired with a lower density probe, for example a Neuropixels 1.0 or 2.0 pattern. These data can be sorted using the full density data as 'ground truth' to understand spike sorters.
poolChan.m handles averaging the signals for a selection of pattern types that can be derived from the NP Ultra pattern. callDownsampling.m calls poolChan for a list of files specified in the script.
Since averaging voltages measured at multiple sites reduces the amplifier and thermal noise by sqrt(number of sites averaged), poolChan adds noise into the averaged trace to better simulate real data from a lower density probe. This noise is generated by creating samples that match the frequency spectrum of a self-referenced noise measurement on a UHD probe. This frequency spectrum is stored in 'UHD_extref_noiseModel.mat'. The script make_noise_model.m creates a new noise model (the raw data file to use is specified in the script). This technique was suggested by Marius Pachitariu, and is incoporated into the eMouse simulator packaged with Kilosort2.
A sample dataset to try downsampling, along with a manually curated spike table from the sort of the Ultra data, is available here:
https://www.dropbox.com/scl/fo/k8fpn9z3h7hqj78krsswf/h?rlkey=3oe9yamlvkw3r08mcb1b9f56e&dl=0