`make_residual_recording` subtracts templates in uV from traces in raw units
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 benchmark/residual_analysis.py 开始并检查 make_residual_recording,然后追踪当通道增益不等于 1 时 analyzer 模板和录制轨迹的表示方式。复现提供的增益用例,并添加回归测试,以证明残差标准差(单位为 uV)在各种增益下保持一致。三个用例中的残差都符合预期的 5.05 uV 时,即为完成。
由索引模型根据 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.
make_residual_recording takes the templates from the analyzer, in uV by default, and injects them with a negative sign into analyzer.recording, whose traces are in raw units. When the gain is not 1, the residual is wrong, without an error. In the example below the traces in uV are the same for the three gains.
from spikeinterface.core import generate_ground_truth_recording, create_sorting_analyzer
from spikeinterface.preprocessing import scale
from spikeinterface.benchmark import make_residual_recording
recording, sorting = generate_ground_truth_recording(durations=[10.0], num_channels=8, num_units=4, seed=0)
print(f"recording std {recording.get_traces(return_in_uV=True).std():.2f} uV")
for gain in (1.0, 0.195, 2.34):
# same traces in uV, stored in raw units (uV / gain)
raw = scale(recording, gain=1 / gain, dtype="float32")
raw.set_channel_gains(gain)
raw.set_channel_offsets(0.0)
analyzer = create_sorting_analyzer(sorting, raw, sparse=False)
analyzer.compute(["random_spikes", "templates", "noise_levels"])
analyzer.compute("amplitude_scalings", handle_collisions=False)
residual = make_residual_recording(analyzer)
print(f"gain {gain}: residual std {residual.get_traces(return_in_uV=True).std():.2f} uV")
# Output on current main:
# recording std 7.17 uV
# gain 1.0: residual std 5.05 uV
# gain 0.195: residual std 6.48 uV
# gain 2.34: residual std 8.91 uV
# Expected: 5.05 uV for the three gains
With create_sorting_analyzer(..., return_in_uV=False), the residual std is 5.05 uV for the three gains.
Fix: divide the templates by the channel gains before injecting them when they are in uV, or inject them into scale_to_uV(analyzer.recording). The second option changes the dtype and units of the residual, so I leave the choice to you.
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 小时 新手友好度 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 天内回复