read_tdt / TdtRawIO: stitched TDT blocks with time gaps lose their gaps and timing, float32 streams are mislabeled as µV with gain 1, and SEV-flagged stores without .sev files block opening

未关闭
#4,980 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, data

调研方向

Start with read_tdt and Neo’s TdtRawIO in neo/rawio/tdtrawio.py, especially the header parsing and timestamp handling described in the report. Reproduce the four failures with the supplied environment and compare stitched-block timing and float32 values against the tdt package. Done means blocks without .Tdx open or produce a clear error, gaps retain correct timing, float32 units are reported correctly, and a missing .sev store does not prevent reading the requested stream.

由索引模型根据 Issue 内容生成。

描述

Environment: spikeinterface 0.106.0, neo 0.14.6 (also checked neo 0.13.4), numpy 2.4.6, Python 3.11, macOS. The reference reader is the tdt package 0.7.6.

Context: I record a single session as several TDT blocks and concatenate them into one stitched block, so the stitched block's .tsq/.tev hold the chunks of every source block with their original timestamps, including long real-time gaps between blocks. I tested whether si.read_tdt can read the stitched block directly in place of my own binary writer. The data are 32-channel float32 streams at 12,207.03125 Hz, and the stores report Scale: Unity in TDT's StoresListing.

1. A block without a .Tdx file fails with an IndexError

UserWarning: Could not find any data set belonging to .../rec0
  File ".../neo/rawio/tdtrawio.py", line 193, in _parse_header
    self._global_t_start = self._seg_t_starts[0]
IndexError: list index out of range

A block made outside Synapse may have .tsq/.tev but no .Tdx. Adding an empty .Tdx (through a symlink view) makes it open. Expected behavior: open from .tsq/.tev alone, or raise a clear error that names the missing file.

2. Time gaps inside a block are dropped and the time axis is wrong after each gap
When the .tsq chunk timestamps jump (here by 134.854 s and 4,290.876 s), TdtRawIO reports one segment and simply concatenates the chunks: 141,986,816 samples (11,631.56 s), when the timestamps span 15,922.39 s. Every sample after a jump has the wrong time, early by exactly the gap length. The samples themselves are bit-identical to the tdt package's (max abs diff 0.0). Expected behavior: split into segments at timestamp discontinuities larger than one chunk (each with the correct t_start), or at least warn. Opening the parent tank folder of the unstitched source blocks gives correct segments and t_start values.

3. Float32 streams are labeled µV with gain 1, but the values are volts
TdtRawIO hard-codes units "uV", gain 1.0 and offset 0.0. For these stores (Scale: Unity, float32), the values are volts, so the reported µV are wrong by exactly 1e6, which silently affects amplitude-based metrics and thresholds. Expected behavior: report units V (gain 1e6 to µV), or read the store's scale/format.

4. neo 0.14.6 refuses to open a block where an unused store is flagged as SEV-mode but has no .sev files
A block whose eye-tracker store eyeL is flagged SEV in the .tsq with no .sev files present fails to open in neo 0.14.6, even when only the RAW stream is requested. neo 0.13.4 opens the same block, and its samples match the reference reader. Expected behavior: skip or warn on that store, not refuse the whole block.

I can share small .tsq/StoresListing excerpts or a reproducer script if that helps. Issues 1, 3 and 4 may belong in python-neo (TdtRawIO); I'm filing here first because I hit them through read_tdt. Happy to move or cross-post them.

主要语言
Python
星标
883
派生
291
平均合并
3 天 17 小时
30 天内合并 PR
40

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SpikeInterface/spikeinterface 的其他 Issue

查看 SpikeInterface/spikeinterface 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。