`plot_unit_presence` shows bin indices on the `Time (s)` axis when `time_range` is not given
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 82/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- matplotlib, python
调研方向
从 widgets/unit_presence.py 开始,其中 plot_unit_presence 会计算 bin 计数并调用 imshow。使用 issue 中的两个示例,检查省略 time_range 时的坐标轴范围,以及采样频率为 24414.0625 Hz 时的 IndexError。完成标准是坐标轴显示秒,且 bin 计数使用一致的样本宽度,不会引发索引错误。
由索引模型根据 Issue 内容生成。
描述
I found this while reading widgets/unit_presence.py, not in my own analyses, so this is a "for the sake of improvement" report.
Without time_range, no extent is passed to imshow, so the x axis shows bin indices while it is labelled "Time (s)". With the default 0.05 s bins, the times are 20 times too large, without an error. Also, the bin width in samples is truncated with int(bin_duration_s * fs) while the number of bins is computed in seconds, so some sampling frequencies raise an IndexError.
import matplotlib
matplotlib.use("Agg")
from spikeinterface.core import generate_sorting
from spikeinterface.widgets import plot_unit_presence
sorting = generate_sorting(num_units=4, durations=[10.0], sampling_frequency=30000.0, seed=0)
w = plot_unit_presence(sorting)
print(w.ax.get_xlabel(), [float(x) for x in w.ax.get_xlim()])
# Time (s) [-0.5, 198.5] expected about [0, 10]
sorting = generate_sorting(num_units=4, durations=[60.0], sampling_frequency=24414.0625, seed=0)
plot_unit_presence(sorting)
# IndexError: index 1200 is out of bounds for axis 1 with size 1200
Fix: always pass an extent in seconds to imshow, and compute the number of bins and the bin indices with the same bin width in samples.
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 小时 新手友好度 83/100
SpikeInterface/spikeinterface#5005 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
SpikeInterface/spikeinterface#5004 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
SpikeInterface/spikeinterface#5003 ·
维护者通常 2 天内回复
查看 SpikeInterface/spikeinterface 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
available bug good first issue tooling
难度 2/5 1-3 小时 新手友好度 88/100
Nixitov/Riptide-Native#816 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
teng-lin/notebooklm-py#2593 ·
维护者通常 1 天内回复
-
claimed-by:collie role:small-fix status:running
难度 2/5 1-3 小时 新手友好度 82/100
Beovulfo/herd-sdlc#325 · 1 条评论 ·
维护者通常 1 天内回复
-
good first issue
难度 1/5 1 小时以内 新手友好度 94/100
omarelshamy25x/shamy-arabic-nlp#267 ·
维护者通常 1 天内回复