Remove `segment_index` from the spike vector(s)
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 32/100
- Type d'issue
- Refactorisation
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- numpy, python
- Domaine
- data, performance
Piste de recherche
Start with to_spike_vector(return_slices=True) in waveform_tools.py and review the linked usages in analyzer_extension_core.py and numpyextractors.py. Trace the repeated np.searchsorted calls across waveform_tools.py, basesorting.py, zarrextractors.py, sorting_tools.py, and remove_excess_spikes.py. Done means the segment index is removed, slices are used instead, and a compatibility path remains for saved sortings that contain the field.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I am reviewing #4809 (optimize SpikeRetriever and RAM usage for extensions) and I want to bring back the topic of simplifying the spike vector (time ordered and unit ordered) data model. A lot of the memory cost on @alejoe91's benchmark is the spike vector itself and of that 1/3 is the segment index and the segment index is unnecessary. This is an edge case (most recordings are not multi-segment) and the field is only a convenience, syntactic sugar. These are the main places where we use it:
-
To find the boundaries of a segment (the sorting already caches them as
segment_slices, seeto_spike_vector(return_slices=True)):
https://github.com/SpikeInterface/spikeinterface/blob/93c612f51cca09ecafe2c23a283132cf0ad57869/src/spikeinterface/core/waveform_tools.py#L357
The samenp.searchsortedis repeated three more times inwaveform_tools.pyand inbasesorting.py,zarrextractors.py,sorting_tools.pyandremove_excess_spikes.py. -
To mask the spikes of one unit in one segment (this could be a slice of the segment plus a mask on
unit_index):
https://github.com/SpikeInterface/spikeinterface/blob/93c612f51cca09ecafe2c23a283132cf0ad57869/src/spikeinterface/core/analyzer_extension_core.py#L131-L133 -
As a sort key when building a sorting from peaks (the slices could be computed once at construction instead):
https://github.com/SpikeInterface/spikeinterface/blob/93c612f51cca09ecafe2c23a283132cf0ad57869/src/spikeinterface/core/numpyextractors.py#L498
As a side effect this would remove the branching for the mono-segment case, like the special cases that #4809 adds to SpikeRetriever, PeakRetriever and _get_spike_vector_segment_slices.
The cost is a big refactor: using the slices wherever we rely on np.searchsorted (which I also think would be more efficient) and a compatibility path for the sortings that were saved with the field.
What do you think? Is there something I am missing?
- Langage dominant
- Python
- Étoiles
- 883
- Forks
- 291
- Merge moyen
- 3 j 17 h
- PR mergées (30 j)
- 40
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de SpikeInterface/spikeinterface
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
SpikeInterface/spikeinterface#5008 ·
Les mainteneurs répondent en général sous 2 jours
-
`plot_potential_merges` draws the correlograms of other units when a merge group is not sortedOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
SpikeInterface/spikeinterface#5007 ·
Les mainteneurs répondent en général sous 2 jours
-
`plot_unit_presence` shows bin indices on the `Time (s)` axis when `time_range` is not givenOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
SpikeInterface/spikeinterface#5006 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
SpikeInterface/spikeinterface#5005 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
SpikeInterface/spikeinterface#5004 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de SpikeInterface/spikeinterface
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 69/100
daniel-ospina/tortoise#15308 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour
-
difficulty:easy prio:low type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
NatronGitHub/Natron#2405 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Jstar269/nakagawa-recomp#3746 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour