`tridesclous2` puts the spikes of all segments into segment 0 before estimating templates
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
Start with sorters/internal/tridesclous2.py, especially the sorting_pre_peeler construction and sparsity code identified in the report. Trace how peaks and labels are ordered across segments, then check the lupin.py construction for the same pattern. Done when template spikes retain their segment indices and sparsity uses peaks and labels in matching order; the report offers a two-segment example to verify this.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I found this while reading sorters/internal/tridesclous2.py, not in my own analyses, so this is a "for the sake of improvement" report.
Tridesclous2Sorter has handle_multi_segment = True, but sorting_pre_peeler is built from one array, NumpySorting.from_samples_and_labels(kept_peaks["sample_index"], ...) (lines 278-283), so it has a single segment. The templates are then estimated on segment 0 at the sample indices of the spikes of all segments. lupin.py builds it the same way (lines 332-337); I could not run lupin here (no torch).
The example wraps estimate_templates_with_accumulator to count the segments of the spikes it receives:
import tempfile
from pathlib import Path
import numpy as np
from spikeinterface.core import generate_ground_truth_recording
from spikeinterface.sorters import run_sorter
import spikeinterface.sorters.internal.tridesclous2 as tdc2
seen = {}
original = tdc2.estimate_templates_with_accumulator
def spy(recording, spikes, *args, **kwargs):
# record which segments the spikes used for the templates belong to
segments, counts = np.unique(spikes["segment_index"], return_counts=True)
seen["spikes_per_segment"] = dict(zip(segments.tolist(), counts.tolist()))
return original(recording, spikes, *args, **kwargs)
if __name__ == "__main__":
tdc2.estimate_templates_with_accumulator = spy
recording, gt = generate_ground_truth_recording(num_channels=8, durations=[10.0, 10.0], num_units=4, seed=0)
# on Windows the saved traces file can still be open when the folder is removed
with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmp:
recording = recording.save(folder=Path(tmp) / "recording", progress_bar=False)
run_sorter("tridesclous2", recording, folder=Path(tmp) / "tdc2", apply_preprocessing=False, seed=0)
gt_counts = {seg: sum(gt.get_unit_spike_train(u, segment_index=seg).size for u in gt.unit_ids) for seg in (0, 1)}
print("ground-truth spikes per segment:", gt_counts)
print("spikes used for templates, per segment:", seen["spikes_per_segment"])
# Output:
# ground-truth spikes per segment: {0: 576, 1: 592}
# spikes used for templates, per segment: {0: 1073}
# Expected: spikes from both segments.
Reading the code, the sparsity (lines 295-298) also pairs kept_peaks, ordered by segment, with labels re-sorted by sample index.
Fix: pass one array per segment to from_samples_and_labels, and take peaks and labels in the same order for the sparsity.
I can open a PR with a test if you agree.
- Lenguaje dominante
- Python
- Estrellas
- 883
- Forks
- 291
- Merge medio
- 3 d 17 h
- PR fusionados (30 d)
- 40
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SpikeInterface/spikeinterface
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SpikeInterface/spikeinterface#5008 ·
Los mantenedores suelen responder en 2 días
-
`plot_potential_merges` draws the correlograms of other units when a merge group is not sortedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
SpikeInterface/spikeinterface#5007 ·
Los mantenedores suelen responder en 2 días
-
`plot_unit_presence` shows bin indices on the `Time (s)` axis when `time_range` is not givenAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
SpikeInterface/spikeinterface#5006 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
SpikeInterface/spikeinterface#5005 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
SpikeInterface/spikeinterface#5004 ·
Los mantenedores suelen responder en 2 días
Todos los issues de SpikeInterface/spikeinterface
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
available bug good first issue tooling
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Nixitov/Riptide-Native#816 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
teng-lin/notebooklm-py#2593 ·
Los mantenedores suelen responder en 1 día
-
claimed-by:collie role:small-fix status:running
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Beovulfo/herd-sdlc#325 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
omarelshamy25x/shamy-arabic-nlp#267 ·
Los mantenedores suelen responder en 1 día