SpikeInterface / SpikeInterface/spikeinterface

Aligning waveforms across spike clusters/templates

Open
#4,582 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
847
Forks
280
Avg merge
3d 9h
Merged PRs (30d)
29

Description

Dear Developers,

I would like to make a suggestion / report an issue regarding the alignment of waveforms in SortingAnalyzer.

When creating a SortingAnalyzer directly, I noticed that the waveform negative peaks are not automatically aligned temporally across spikes/templates. (Please see attached Figure and codes: the minimum points differ between 38 and 39).

Image Image

I tried correcting this using get_template_extremum_channel_peak_shift() together with align_sorting(), but applying the returned shifts directly moves spikes further in the wrong direction. What worked for me as an ad hoc solution was manually reversing the sign of the shifts before calling align_sorting(). (Corrected figure and codes attached.)

Image Image

(The difference is more apparent when you scroll through the two waveform images back and forth, but it is also shown in the numbers.)

It might be worth considering whether this alignment step (or any consistent peak-centering of templates) could be integrated directly into the SortingAnalyzer pipeline, so users do not need to compute peak shifts and apply align_sorting() manually as a separate preprocessing step.

If there are any existing solutions that I haven't considered, please let me know!
Thanks so much!
Domokos

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with SortingAnalyzer and trace how get_template_extremum_channel_peak_shift() interacts with align_sorting(). Reproduce the reported waveform peak positions, then determine the expected shift direction and whether alignment belongs in the SortingAnalyzer pipeline; done means the behavior is consistent and covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.