SpikeInterface / SpikeInterface/spikeinterface

Feature Request: init recording from sorting (phy, kilosort)

Open
#3,919 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

For a "sorting" based on read_phy / read_kilosort (class BasePhyKilosortSortingExtractor), the params.py file is read here

https://github.com/SpikeInterface/spikeinterface/blob/85f4ff3b4c35532aa5df3238e15f901d439fadc5/src/spikeinterface/extractors/phykilosortextractors.py#L60

params = read_python(str(phy_folder / "params.py"))

For the sorting, only the sampling rate is used.

It would be helpful to have this result (params dictionary) available (like self.params = params), especially for the associated recording read using read_binary (class BinaryRecordingExtractor).

Then it could be as simple as

file_path = params["dat_path"]
sampling_frequency = params["sample_rate"]
dtype = params["dtype"]
num_channels = params["n_channels_dat"]

recording = read_binary(file_path, sampling_frequency, dtype, num_channels)

We could also have a function like read_binary_from_sorting which accesses sorting.params.

And this is just one more line.

sorting_analyzer = si.create_sorting_analyzer(sorting=sorting, recording=recording)

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 in src/spikeinterface/extractors/phykilosortextractors.py at BasePhyKilosortSortingExtractor and the read_python call around line 60. Trace how read_phy, read_kilosort, and read_binary expose extractor metadata, then decide whether sorting parameters should be retained or a helper should use them. Done means the requested sorting-to-recording initialization path is available and the existing sorting behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.