`directional_derivative` ignores `channel_indices` in `get_traces`
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 preprocessing/directional_derivative.py 开始,追踪 DirectionalDerivativeRecordingSegment.get_traces 如何使用 channel_indices 并计算导数。将其与 #3631 中针对 average_across_direction 的通道选择修复进行比较,然后检查通道顺序与位置顺序不同时导数的表现。为报告中的通道选择和排序情况添加测试;完成标准是返回的两个形状都与请求的通道相符,且导数值遵循位置。
由索引模型根据 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 小时
- 30 天内合并 PR
- 40
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SpikeInterface/spikeinterface 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
SpikeInterface/spikeinterface#5008 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
SpikeInterface/spikeinterface#5007 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
SpikeInterface/spikeinterface#5006 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
SpikeInterface/spikeinterface#5005 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
SpikeInterface/spikeinterface#5004 ·
维护者通常 2 天内回复
查看 SpikeInterface/spikeinterface 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 69/100
daniel-ospina/tortoise#15308 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
difficulty:easy prio:low type:bug
难度 2/5 1-3 小时 新手友好度 72/100
NatronGitHub/Natron#2405 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
Jstar269/nakagawa-recomp#3746 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复