Concatenating binary files for KS

86 views
Skip to first unread message

Tobias Niebur

unread,
Jan 7, 2025, 4:24:03 PMJan 7
to Open Ephys
Hello,

I am trying to concatenate several recordings from the same day into a single file for spike sorting. When I sort the .dat files individually I get good units similar to what I see in the raw data, however my sorted concatenated data does not give me good units at all. 

To concatenate, I am using matlab fread and fwrite to linearly concatenate the int16 files, and the output in kilosort looks reasonable, with the file being the correct size. Are there any other processing steps I should take? I've noticed that the spectra of the AP file (neuropixel, using pspectrum) does not seem to fall off below 300 hz as I would expect, if that is relevant information. 

Thanks

Josh Siegle

unread,
Jan 14, 2025, 2:07:17 PMJan 14
to Tobias Niebur, Open Ephys
Are you able to visualize the data in the Kilosort GUI? Do the same time points look similar pre- and post-concatenation?

Also, I assume the electrodes were not moved in between recordings. If they were, that would explain why spike sorting looks worse after concatenation.

Another option is to use SpikeInterface, which includes some helpful functions for concatenating recordings prior to spike sorting: https://spikeinterface.readthedocs.io/en/stable/tutorials/core/plot_5_append_concatenate_segments.html#append-and-or-concatenate-segments

This does not actually copy any data, it just creates a virtual recording that spans as may segments as you want.

Josh


--
You received this message because you are subscribed to the Google Groups "Open Ephys" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-ephys+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/open-ephys/0bfad16b-94b3-4a84-85c1-57cf0a655bc7n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages