`analyse_residual` fails with its default arguments since `detect_peaks` changed signature

未关闭 适合新手
#5,004 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
data

调研方向

从 benchmark/residual_analysis.py 和 benchmark_sorter_without_gt.py 开始,然后检查 detect_peaks 的签名以及 issue 中提到的两个被跳过的测试。验证默认参数和 job kwargs 在两条 benchmark 路径中都能正常工作;当报告的 TypeError 消失且相关测试通过时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

I found this while reading benchmark/residual_analysis.py, not in my own analyses, so this is a "for the sake of improvement" report.

analyse_residual calls detect_peaks(residual, **detect_peaks_kwargs, **job_kwargs), but since #4793 detect_peaks only accepts method, method_kwargs, pipeline_kwargs, verbose and job_kwargs. The default detect_peaks_kwargs (with peak_sign and detect_threshold) and any job kwarg now raise a TypeError.

from spikeinterface.core import generate_ground_truth_recording, create_sorting_analyzer
from spikeinterface.benchmark import analyse_residual

recording, sorting = generate_ground_truth_recording(durations=[10.0], num_channels=8, num_units=4, seed=0)
analyzer = create_sorting_analyzer(sorting, recording, sparse=True)
analyzer.compute(["random_spikes", "templates", "noise_levels"])
analyzer.compute("amplitude_scalings", handle_collisions=False)

for args, job_kwargs in (((), {}), (({"method": "locally_exclusive"},), {"n_jobs": 1})):
    try:
        analyse_residual(analyzer, *args, **job_kwargs)
    except TypeError as error:
        print(error)

# Output on current main:
# detect_peaks() got an unexpected keyword argument 'peak_sign'
# detect_peaks() got an unexpected keyword argument 'n_jobs'
# Expected: no error

Reading the code, SorterBenchmarkWithoutGroundTruth.compute_result makes the same call, so SorterStudyWithoutGroundTruth.compute_results() fails too; the two related tests are marked skip.

Fix: call detect_peaks(residual, method=..., method_kwargs=..., job_kwargs=job_kwargs), and update the default dict and the call in benchmark_sorter_without_gt.py.

I can open a PR with a test if you agree.

主要语言
Python
星标
883
派生
291
平均合并
3 天 17 小时
30 天内合并 PR
40

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SpikeInterface/spikeinterface 的其他 Issue

查看 SpikeInterface/spikeinterface 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。