SpikeInterface / SpikeInterface/spikeinterface

The relationship between win_step_um and contact positions.

Open
#3,564 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I met a bug.


Traceback (most recent call last):
  File "/home/NITD/lxr/code/spike_sorting/run_sorter1014.py", line 405, in start_sorting
    rec_corrected, rec_ww = preprocess(raw_rec_part, detection, filting, need_correct_motion)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/NITD/lxr/code/spike_sorting/run_sorter1014.py", line 199, in preprocess
    recording_f = si.correct_motion(recording=recording_f, preset='kilosort_like', detect_kwargs=detection,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/NITD/anaconda3/envs/si_env_rolling/lib/python3.11/site-packages/spikeinterface/preprocessing/motion.py", line 436, in correct_motion
    motion = estimate_motion(recording, peaks, peak_locations, progress_bar=progress_bar, **estimate_motion_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/NITD/anaconda3/envs/si_env_rolling/lib/python3.11/site-packages/spikeinterface/sortingcomponents/motion/motion_estimation.py", line 111, in estimate_motion
    motion = method_class.run(
             ^^^^^^^^^^^^^^^^^
  File "/home/NITD/anaconda3/envs/si_env_rolling/lib/python3.11/site-packages/spikeinterface/sortingcomponents/motion/iterative_template.py", line 117, in run
    shift_indices, target_histogram, shift_covs_block = iterative_template_registration(
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/NITD/anaconda3/envs/si_env_rolling/lib/python3.11/site-packages/spikeinterface/sortingcomponents/motion/iterative_template.py", line 246, in iterative_template_registration
    window_slice = slice(window_slice[0], window_slice[-1])
                         ~~~~~~~~~~~~^^^
IndexError: index 0 is out of bounds for axis 0 with size 0

The contacts' positions are computed by positions = [[i*100, j*100] for j in range(0, 2) for i in range(0, 4) ]. How can I set the win_step to aviod the problem.

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 sortingcomponents/motion/iterative_template.py, specifically iterative_template_registration, and trace how win_step_um and the supplied contact positions produce window_slice. Reproduce the traceback with the reported 4×2 positions; done means this motion-estimation path handles the geometry without IndexError and the appropriate behavior is covered by a 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
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.