`plot_potential_merges` draws the correlograms of other units when a merge group is not sorted
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 widgets/potential_merges.py 开始,检查 _update_plot,issue 指出了其中的选择顺序和组下拉菜单处理。查看 plot_potential_merges 的现有测试,并添加对未排序组以及包含连字符的单元 ID 的覆盖。当每个自相关图都与其单元标题匹配,且拼接后的 ID 无需 ValueError 即可正常工作时,任务便完成。
由索引模型根据 Issue 内容生成。
描述
I found this while reading widgets/potential_merges.py, not in my own analyses, so this is a "for the sake of improvement" report.
In _update_plot, the correlograms are selected with np.isin(unique_merge_units, plot_unit_ids), which follows the sorted order of unique_merge_units, while the titles follow the order of the merge group. For the group ["3", "1"], the autocorrelogram of unit 1 is drawn under the title of unit 3 and the reverse, without an error. Also, the group is rebuilt with split("-"), so unit ids containing "-", such as those made by merge_units(new_id_strategy="join"), raise a ValueError.
import matplotlib
matplotlib.use("module://ipympl.backend_nbagg")
import numpy as np
from spikeinterface.core import generate_ground_truth_recording, create_sorting_analyzer
from spikeinterface.widgets import plot_potential_merges
recording, sorting = generate_ground_truth_recording(durations=[20.0], num_channels=16, num_units=5, seed=0)
analyzer = create_sorting_analyzer(sorting, recording, sparse=False, format="memory")
analyzer.compute(["random_spikes", "templates", "spike_amplitudes", "correlograms"], progress_bar=False)
ccgs, _ = analyzer.get_extension("correlograms").get_data()
unit_ids = list(analyzer.unit_ids)
w = plot_potential_merges(analyzer, [["3", "1"]], backend="ipywidgets", display=False)
for k in range(2):
drawn = np.array([bar.get_height() for bar in w.axes_cc[k, k].patches])
match = [str(u) for i, u in enumerate(unit_ids) if np.array_equal(drawn, ccgs[i, i])]
print("panel", w.axes_cc[0, k].get_title(), "shows the autocorrelogram of unit", match)
# panel 3 shows the autocorrelogram of unit ['1'] expected ['3']
# panel 1 shows the autocorrelogram of unit ['3'] expected ['1']
merged = analyzer.merge_units([["0", "1"]], new_id_strategy="join")
plot_potential_merges(merged, [["0-1", "2"]], backend="ipywidgets", display=False)
# ValueError: '0' is not in list
Fix: select the correlograms with the index of each unit of the group, in the group order, and keep the groups themselves for the dropdown instead of joined strings.
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 小时 新手友好度 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 天内回复
-
难度 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 天内回复