Proposal: `ConcatenateSortingAnalyzer`

Open
#4,878 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
data

Research direction

Start by reading the existing SortingAnalyzer and analyzer extension APIs to understand how extensions expose data. Then identify how child analyzers, matching unit maps, and shared recording channels should be represented; the proposal does not name specific files or tests. Done means a read-only concatenated analyzer can expose compatible extension data across its constituent analyzers and save a minimal JSON representation.

Written by the indexing model from the issue text.

Description

chronic discussion

For very long recordings, or recordings made at different times over many days, you might not want a single SortingAnalyzer. For example, it might be helpful to consider metrics as time varying measures of unit quality: if your firing rate is consistent for 3 days, then drops significantly, this might be a sign that your recoridng device can no longer record the unit. More practically, on many systems it is difficult to parallelize a post-processing computation on a 300 hour analyzer. Whereas making 300 one hour computations might be much easier. For unit matching, you almost certaintly want to sort and postprocess each session seperately, but might want a framework to compare sortings.

After discussions with Alessio, I propose to add a ConcatenateSortingAnalyzer class along these lines. Some of these we discussed, some are mine:

  • ConcatenateSortingAnalyzer does not inherit from SortingAnalyzer (there are too many methods we don't need), but mimics the extension structure.
  • ConcatenateAnalyzerExtensions inherits from AnalyzerExtenions
  • We do not touch the SortingAnalyzer class
  • It is primarily a data reader of many analyzers => you cannot compute/modify the constituent analyzers
  • The input is a dict(?) of analyzers
  • Demand that recording channels are the same
  • Demand that parameters (e.g. peak_sign), extensions and extension parameters are the same. Many properties are then just equal to the property of any child analyzer.
  • Keep complexity of data wrangling in the get_data method of each extension, which can now accept an analyzer_index (or analyzer_key) argument. Keep in mind that in the future, we might want to slice the concatenated analyzers.
  • The sparsity of the concatenated analyzer's units is the intersection of sparsities of each individual unit
  • The user can provide maps to match units. Keep in mind that in the future, we might want to algoithmically generate these.
  • It's ok that main_channel_indices can vary between analyzers. These are used primarily for computation of the sparsity and computation of metrics.
  • save just saves a minimal json representation of the underlying analyzers

What do people think? Thought/suggestions welcome!

Dominant language
Python
Stars
883
Forks
291
Avg merge
3d 17h
Merged PRs (30d)
40

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from SpikeInterface/spikeinterface

All issues in SpikeInterface/spikeinterface

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.