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 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
40

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SpikeInterface/spikeinterface のほかの issue

SpikeInterface/spikeinterface の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。