`directional_derivative` ignores `channel_indices` in `get_traces`

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

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

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

評価

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

調査の方向性

preprocessing/directional_derivative.py から始め、DirectionalDerivativeRecordingSegment.get_traces が channel_indices をどのように使い、導関数を計算するかを追ってください。average_across_direction に関する #3631 のチャンネル選択の修正と比較し、チャンネルの順序が位置の順序と異なる場合に導関数がどう振る舞うかを確認してください。報告されたチャンネル選択と順序のケースについてテストを追加してください。完了の条件は、返される両方の形状が要求されたチャンネルに一致し、導関数の値が位置に従うことです。

索引モデルが issue の本文から書いたものです。

説明

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

DirectionalDerivativeRecordingSegment.get_traces reads all parent channels and returns the derivative of all of them, ignoring channel_indices. So get_traces(channel_ids=...), and recordings built on top of it such as select_channels, return all channels instead of the requested ones.

from spikeinterface.core import generate_recording
from spikeinterface.preprocessing import directional_derivative

recording = generate_recording(num_channels=16, durations=[1.0], seed=0)
derivative = directional_derivative(recording)
channel_ids = derivative.channel_ids[[0, 3]]

print(derivative.get_traces(channel_ids=channel_ids, end_frame=100).shape)
print(derivative.select_channels(channel_ids).get_traces(end_frame=100).shape)

# Output on current main:
# (100, 16)
# (100, 16)
# Expected: (100, 2) twice

Fix: return derivative_traces[:, channel_indices], as #3631 did for average_across_direction. Also, reading the code, np.gradient follows the channel order rather than the position, so a column whose channels are not sorted along direction gets wrong values.

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 を短くまとめたダイジェスト。