cortex-lab / phy

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

Question about the waveforms amplitude #1248

Closed Antho2422 closed 4 months ago

Antho2422 commented 5 months ago

Hi all,

I have a question about the amplitude value. I am using phy and spikeinterface together and I noticed some weird values that I would like to understand a bit more.

When I import a sorting object in spikeinterface from Phy, I get access to the property "amp". My first guess was that this property contained the value of the maximum peak of the template of each cluster.

But I also noticed that when I plot my waveforms using spikeinterface the values does not match....

I then tried to verify that using the function from spikeinterface :

get_template_extremum_amplitude(waveforms)

on the waveforms object extracted from the same sorting I loaded from Phy.

The values obtained with the spikeinterface function matched with the values I visualy see when plotting the templates but did not match with the value of the amp shown within phy.

Can anyone explain me how the amp value is computed in Phy and what could explain such a different.

Cheers, Anthony

zm711 commented 5 months ago

Howdy Anthony,

Phy just loads the amplitudes based on the amplitudes.npy file that you can see in the link I've attached. Then it converts based on whitening/unwhitening here. To be completely honest, phy itself was built to work well with Kilosort and Spyking-Circus. Whereas spikeinterface created an export function because phy is the de facto standard for manual curation. The benefit of pure spikeinterface is that it keeps track of your raw data (scaled based on your recording equipment) whereas phy is more dependent on what Kilosort give it. Personally I would trust the spikeinterface amplitudes more at this point and use Phy more to just visualize those amplitudes to make comparisons rather than pull out absolute values.

Antho2422 commented 4 months ago

Okay thank you :)