cortex-lab / phy

phy: interactive visualization and manual spike sorting of large-scale ephys data
BSD 3-Clause "New" or "Revised" License
311 stars 157 forks source link

Show spike waveforms from .bin file instead of .dat #1120

Closed aferguso2 closed 2 years ago

aferguso2 commented 2 years ago

Right now phy looks for a .dat file in order to show spike waveforms in the waveform view. However, the output of raw data from SpikeGLX for neuropixel data is a .bin file.

Instead of using the kilosort created temp_wh.dat for showing spike waveforms, I'd like to use my raw data file. Is there any functionality for using .bin instead of .dat file in phy?

aferguso2 commented 2 years ago

You can edit this by changing the path in params.py to point to the .bin file instead.

aferguso2 commented 2 years ago

By only changing the name of the file, I got only noise in the spike waveforms, but the templates were fine.

Screen Shot 2021-10-23 at 12 56 11 AM (1) Screen Shot 2021-10-23 at 12 56 17 AM (1)
aferguso2 commented 2 years ago

Based on a conversation with Jennifer Colonell (@jenniferColonell) in neuropixelsgroup.slack.com, I found that I also needed to change the n_channels to 385 for working with the bin file. Our conversation:

Jennifer: You need to correct the number of channels. KS 2.5 will take off the final SYNC channel, and also any channels that you marked as "not connected" by setting connected(channel number) = 0 in the Kilosort channel map file. So, for an example params.py file from KS2.5 you might have:

dat_path = 'D:/kilosort_datatemp/temp_wh.dat'
n_channels_dat = 383
dtype = 'int16'
offset = 0
sample_rate = 30000.
hp_filtered = True

n_channels = 385 original channels - reference channel - SYNC channel = 383.

To have phy point at the original binary, the params.py file needs to be:

dat_path = '../../SC024_092319_NP1.0_Midbrain_g0_tcat.imec0.ap.bin'
n_channels_dat = 385
dtype = 'int16'
offset = 0
sample_rate = 30000
hp_filtered = True (edited)