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

オープン 初心者向け
#5,004 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
data

調査の方向性

まず benchmark/residual_analysis.py と benchmark_sorter_without_gt.py から始め、次に detect_peaks のシグネチャと、issue で言及されているスキップされた2つのテストを確認してください。デフォルト引数と job の kwargs が両方のベンチマーク経路で機能することを検証してください。報告された 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時間
マージ済み PR(30日)
40

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SpikeInterface/spikeinterface のほかの issue

SpikeInterface/spikeinterface の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。