Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HerdingSpike through SpikeInterface wrongly scales waveform. #70

Closed
b-grimaud opened this issue May 10, 2023 · 1 comment
Closed

HerdingSpike through SpikeInterface wrongly scales waveform. #70

b-grimaud opened this issue May 10, 2023 · 1 comment

Comments

@b-grimaud
Copy link
Contributor

As originally pointed out in this issue, running HerdingSpikes through SpikeInterface then accessing the resulting HSDetection object results in incorrect plots using PlotTracesChannels.

Turns out the localization is fine (assuming the correct electrode width and pitch were passed during probe initialization), it's the trace itself that is wrong.

In hs2.py on line 316 :

plt.plot(
  pos[event.ch][0] + trange_bluered,
  pos[event.ch][1] + event.Shape * scale,
  "r"
   ) 

where pos[event.ch][1] is the y-axis coordinate of the spike, and event.Shape is the waveform as, I'm assuming, a list of deviation from the spike's Amplitude. This is unlike the rest of the waveform plots :

plt.plot(
  pos[n][0] + trange_bluered,
  pos[n][1] + data[start_bluered : start_bluered + cutlen, n] * scale,
  col
  )

where the actual raw data is plotted.

This works fine when running only through HerdingSpikes, where the Shape list on my own data typically looks something like :
[ 3 -2 -2 2 15 -9 -13 8 -5 11 2 12 3 2 1 -5].
However, through SpikeInterface, it's closer to this :
[2094 2088 2022 2010 2032 2028 2041 2030 2032 2022 2031 2031 2032 2028 2027 2022 2027 2026 2043 2024], which shifts the waveform up.

From my very empirical attempt at matching the waveform with the raw trace it seems there's a shift of about +2300 µV in Shape values. I tried digging into the code to find where that list is being populated but I'm not familiar with C.

My first assumption would be that the problem comes from using RecordingExtractor instead of BioCam for the probe, but as pointed out before the raw data seems just fine. Do you have any idea what could be the cause ?

On a related note, I'm also not sure what the probe parameters of inner_radius and neighbor_radius refer to, and why they are so different based on the type of probe object. Is it because SpikeInterface uses microns for coordinates instead of "pixels" for BioCam ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant